diff --git a/sw/ne2000/cyw43_firmware.h b/sw/ne2000/cyw43_firmware.h index 517297a..a44e777 100644 --- a/sw/ne2000/cyw43_firmware.h +++ b/sw/ne2000/cyw43_firmware.h @@ -1,2 +1,10 @@ #include #define CYW43_RESOURCE_ATTRIBUTE __in_flash() + +#ifndef PGDEBUG +#define CYW43_PRINTF(...) (void)0 +#endif +// cyw43_config.h only includes inside its #ifndef CYW43_PRINTF +// fallback, so we must provide it for cyw43 sources that call printf directly +// (e.g. cyw43_stats.c:cyw43_dump_stats — dead code, stripped by --gc-sections). +#include diff --git a/sw/ne2000/ne2000.c b/sw/ne2000/ne2000.c index c52ad66..282235a 100644 --- a/sw/ne2000/ne2000.c +++ b/sw/ne2000/ne2000.c @@ -100,20 +100,28 @@ void PG_Wifi_GetStatus(void) switch(status) { - case CYW43_LINK_DOWN : sprintf(StatusStr, "Err: Link Down"); + case CYW43_LINK_DOWN : strcpy(StatusStr, "Err: Link Down"); break; case CYW43_LINK_JOIN : case CYW43_LINK_NOIP : case CYW43_LINK_UP : - sprintf(StatusStr, "Connected to SSID %s, Signal %d dB, Rate %d", tmp_ssid + 4, rssi, rate); + { + char numbuf[12]; + strcpy(StatusStr, "Connected to SSID "); + strcat(StatusStr, tmp_ssid + 4); + strcat(StatusStr, ", Signal "); + strcat(StatusStr, itoa(rssi, numbuf, 10)); + strcat(StatusStr, " dB, Rate "); + strcat(StatusStr, itoa(rate, numbuf, 10)); + } break; - case CYW43_LINK_FAIL : sprintf(StatusStr, "Err: Connection failed"); + case CYW43_LINK_FAIL : strcpy(StatusStr, "Err: Connection failed"); break; - case CYW43_LINK_NONET : sprintf(StatusStr, "Err: SSID not found"); + case CYW43_LINK_NONET : strcpy(StatusStr, "Err: SSID not found"); break; - case CYW43_LINK_BADAUTH : sprintf(StatusStr, "Err: Authentication failure"); + case CYW43_LINK_BADAUTH : strcpy(StatusStr, "Err: Authentication failure"); break; - default : sprintf(StatusStr, "Err: Unknown status"); + default : strcpy(StatusStr, "Err: Unknown status"); } }