From 39231b30ca2f2e4769326d3be9620a538b6e8df2 Mon Sep 17 00:00:00 2001 From: tyeth Date: Tue, 17 Dec 2024 18:49:04 +0000 Subject: [PATCH] RP2040 WDT=8.3secs - enable after wifi connect --- platformio.ini | 6 ++++++ src/Wippersnapper.cpp | 8 +++++++- src/Wippersnapper.h | 25 +++++++++++++++++++------ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/platformio.ini b/platformio.ini index dd4acafc2..26b8a7bcb 100644 --- a/platformio.ini +++ b/platformio.ini @@ -471,6 +471,12 @@ upload_port = /dev/cu.usbmodem1201 [env:raspberypi_picow] extends = common:rp2040 +[env:raspberypi_picow_debug_port_only] +extends = common:rp2040 +build_flags = + -DUSE_TINYUSB + -DDEBUG_RP2040_PORT=Serial + [env:raspberypi_picow_debug] extends = common:rp2040 platform = https://github.com/maxgerhardt/platform-raspberrypi.git diff --git a/src/Wippersnapper.cpp b/src/Wippersnapper.cpp index a4c190825..b8bf018b2 100644 --- a/src/Wippersnapper.cpp +++ b/src/Wippersnapper.cpp @@ -2748,8 +2748,10 @@ void Wippersnapper::connect() { // Dump device info to the serial monitor printDeviceInfo(); - // enable global WDT +// enable global WDT +#ifndef ARDUINO_ARCH_RP2040 WS.enableWDT(WS_WDT_TIMEOUT); +#endif // Generate device identifier if (!generateDeviceUID()) { @@ -2772,7 +2774,11 @@ void Wippersnapper::connect() { WS_DEBUG_PRINTLN("Running Network FSM..."); // Run the network fsm runNetFSM(); +#ifdef ARDUINO_ARCH_RP2040 + WS.enableWDT(WS_WDT_TIMEOUT); // wifi multi doesn't feed the WDT +#else WS.feedWDT(); +#endif #ifdef USE_DISPLAY WS._ui_helper->set_load_bar_icon_complete(loadBarIconCloud); diff --git a/src/Wippersnapper.h b/src/Wippersnapper.h index ede523228..78f6b14e4 100644 --- a/src/Wippersnapper.h +++ b/src/Wippersnapper.h @@ -47,16 +47,24 @@ // Define actual debug output functions when necessary. #ifdef WS_DEBUG #define WS_DEBUG_PRINT(...) \ - { WS_PRINTER.print(__VA_ARGS__); } ///< Prints debug output. + { \ + WS_PRINTER.print(__VA_ARGS__); \ + } ///< Prints debug output. #define WS_DEBUG_PRINTLN(...) \ - { WS_PRINTER.println(__VA_ARGS__); } ///< Prints line from debug output. + { \ + WS_PRINTER.println(__VA_ARGS__); \ + } ///< Prints line from debug output. #define WS_DEBUG_PRINTHEX(...) \ - { WS_PRINTER.print(__VA_ARGS__, HEX); } ///< Prints debug output. + { \ + WS_PRINTER.print(__VA_ARGS__, HEX); \ + } ///< Prints debug output. #else #define WS_DEBUG_PRINT(...) \ - {} ///< Prints debug output + { \ + } ///< Prints debug output #define WS_DEBUG_PRINTLN(...) \ - {} ///< Prints line from debug output. + { \ + } ///< Prints line from debug output. #endif #define WS_DELAY_WITH_WDT(timeout) \ @@ -214,7 +222,12 @@ typedef enum { FSM_NET_ESTABLISH_MQTT, } fsm_net_t; -#define WS_WDT_TIMEOUT 60000 ///< WDT timeout +#ifdef ARDUINO_ARCH_RP2040 +#define WS_WDT_TIMEOUT 8388 ///< Pico Max WDT timeout +#else +#define WS_WDT_TIMEOUT 60000 ///< WDT timeout +#endif + #define WS_MAX_ALT_WIFI_NETWORKS 3 ///< Maximum number of alternative networks /* MQTT Configuration */ #define WS_KEEPALIVE_INTERVAL_MS \