AP_Networking: make lwip debugging easier

This commit is contained in:
Andrew Tridgell committed 2023-12-11 18:00:38 +11:00
1 parent f924497194
commit fec0ec79c5
2 files changed
+31

No files matched your search

+27
View File
@@ -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
+4
View File
@@ -319,4 +319,8 @@ namespace AP
AP_Networking &network();
};
extern "C" {
int ap_networking_printf(const char *fmt, ...);
}
#endif // AP_NETWORKING_ENABLED