Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions firmware/include/ff_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@
// Always-awake model: failed polls back off to this interval after
// FF_MARK_FAILS consecutive failures.
#define FF_POLL_BACKOFF_MS 60000
// Always-awake model: with Wi-Fi down, join the saved network again this often
// (W-1056). One join, an all-channel scan included, takes a few seconds.
#define FF_WIFI_REJOIN_MS 30000UL

// --- Panel ---
// -DFF_BOARD_EE02 (the ee02 envs) builds for the EE02 board's 13.3" Spectra 6
Expand Down
16 changes: 16 additions & 0 deletions firmware/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,21 @@ bool ensureWifi(bool openPortal, bool showBoot) {
return connected;
}

// An always-awake frame joins Wi-Fi once, above, and is then kept on it by the
// core's auto-reconnect alone, which retries only some disconnect reasons and
// stops for good on the rest (W-1056: both kits sat off a working network,
// slashed Wi-Fi mark up, until they were unplugged). While the station is
// down, join again every FF_WIFI_REJOIN_MS, whatever the core decided.
static void keepWifi() {
static uint32_t downSince = 0; // 0 = connected
if (WiFi.status() == WL_CONNECTED || g_portalOpen) { downSince = 0; return; }
if (!downSince) { downSince = millis() | 1; return; } // the core's own retry goes first
if (millis() - downSince < FF_WIFI_REJOIN_MS) return;
downSince = millis() | 1;
Serial.println("wifi: down, joining again");
WiFi.begin(); // the saved network; starts the station if it stopped
}

// ---------------------------------------------------------------- display
// The server sends the framebuffer already in the panel's NATIVE landscape
// orientation (1872x1404) and in the panel's exact packing:
Expand Down Expand Up @@ -2377,6 +2392,7 @@ void loop() {
Serial.println("power: switching to deep sleep");
goToSleep(g_wakeMinutes);
}
keepWifi();
int k = pollButton();
if (k == 2) {
// KEY2: hold PORTAL_HOLD_MS -> setup portal; a quick tap -> status view.
Expand Down
Loading