Skip to content

Commit

Permalink
RP2040 WDT=8.3secs - enable after wifi connect
Browse files Browse the repository at this point in the history
  • Loading branch information
tyeth committed Dec 17, 2024
1 parent 16bc28a commit 2475f33
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/Wippersnapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion src/Wippersnapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 2475f33

Please sign in to comment.