mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-28 04:38:55 +08:00
AP_Networking: make lwip debugging easier
This commit is contained in:
1 parent
f924497194
commit
fec0ec79c5
2 files changed
+31
No files matched your search
@@ -292,4 +292,31 @@ AP_Networking &network()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
debug printfs from LWIP
|
||||
*/
|
||||
int ap_networking_printf(const char *fmt, ...)
|
||||
{
|
||||
#ifdef AP_NETWORKING_LWIP_DEBUG_PORT
|
||||
static AP_HAL::UARTDriver *uart;
|
||||
if (uart == nullptr) {
|
||||
uart = hal.serial(AP_NETWORKING_LWIP_DEBUG_PORT);
|
||||
if (uart == nullptr) {
|
||||
return -1;
|
||||
}
|
||||
uart->begin(921600, 0, 50000);
|
||||
}
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
uart->vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
#else
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
hal.console->vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // AP_NETWORKING_ENABLED
|
||||
@@ -319,4 +319,8 @@ namespace AP
|
||||
AP_Networking &network();
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
int ap_networking_printf(const char *fmt, ...);
|
||||
}
|
||||
|
||||
#endif // AP_NETWORKING_ENABLED
|
||||
Reference in new issue
Block a user