From 2475f33072db884c5e78cd1c70fe50562957a97c 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 | 7 ++++++- 3 files changed, 19 insertions(+), 2 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..3d597713b 100644 --- a/src/Wippersnapper.h +++ b/src/Wippersnapper.h @@ -214,7 +214,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 \