mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 23:33:57 -04:00
AP_Networking: make lwip debugging easier
This commit is contained in:
parent
f924497194
commit
fec0ec79c5
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user