@@ -108,6 +108,7 @@ typedef struct
108108
109109uint16_t wifi_settings_offset;
110110wifi_settings_t wifi_settings;
111+
111112#endif
112113
113114#ifdef BOARD_HAS_CUSTOM_SYSTEM_COMMANDS
@@ -607,30 +608,14 @@ extern "C" void ota_server_start(void)
607608}
608609#endif
609610
610- #ifdef USE_STATIC_IP
611- #ifndef STATIC_IP_IP
612- // 192.168.1.200
613- #define STATIC_IP_IP 3355551936
614- #endif
615- #ifndef STATIC_IP_GW
616- // 192.168.1.1
617- #define STATIC_IP_GW 16885952
618- #endif
619- #ifndef STATIC_IP_SUB
620- // 255.255.255.0
621- #define STATIC_IP_SUB 16777215
622- #endif
623-
624- static IPAddress local_IP (STATIC_IP_IP );
625- static IPAddress gateway (STATIC_IP_GW );
626- static IPAddress subnet (STATIC_IP_SUB );
627- #endif
628-
629611extern " C" void __attribute__ ((weak)) mcu_network_init(void )
630612{
631613#ifdef ENABLE_WIFI
632614#ifdef USE_STATIC_IP
633- WiFi.config (local_IP, gateway, gateway, subnet);
615+ if (!WiFi.config (IPAddress (STATIC_IP_IP ), IPAddress (STATIC_IP_GW ), IPAddress (STATIC_IP_SUB )))
616+ {
617+ proto_info (" Static IP config failed" );
618+ }
634619#endif
635620 WiFi.mode (WIFI_AP );
636621 WiFi.begin ((char *)BOARD_NAME , (char *)WIFI_PASS );
@@ -666,7 +651,10 @@ extern "C" void rp2040_wifi_bt_init(void)
666651 case 1 :
667652 WiFi.mode (WIFI_STA );
668653#ifdef USE_STATIC_IP
669- WiFi.config (local_IP, gateway, subnet);
654+ if (!WiFi.config (IPAddress (STATIC_IP_IP ), IPAddress (STATIC_IP_GW ), IPAddress (STATIC_IP_SUB )))
655+ {
656+ proto_info (" Static IP config failed" );
657+ }
670658#endif
671659 WiFi.begin ((char *)wifi_settings.ssid , (char *)wifi_settings.pass );
672660 proto_info (" Trying to connect to WiFi" );
@@ -681,7 +669,10 @@ extern "C" void rp2040_wifi_bt_init(void)
681669 default :
682670 WiFi.mode (WIFI_AP_STA );
683671#ifdef USE_STATIC_IP
684- WiFi.config (local_IP, gateway, gateway, subnet);
672+ if (!WiFi.config (IPAddress (STATIC_IP_IP ), IPAddress (STATIC_IP_GW ), IPAddress (STATIC_IP_SUB )))
673+ {
674+ proto_info (" Static IP config failed" );
675+ }
685676#endif
686677 WiFi.begin ((char *)wifi_settings.ssid , (char *)wifi_settings.pass );
687678 proto_info (" Trying to connect to WiFi" );
0 commit comments