feat: self-heal from transient WiFi loss, add dBm indicator during WebServerActivity (#1780)
## Summary * **What is the goal of this PR?** I was seeing hangs during File Transfer. Troubleshooting via serial showed it had to do with the SHUTTING_DOWN state. Strengthened the WiFi State Machine a bit and added self-healing. Additionally, I found it obnoxious to need to keep referring to serial for my wifi strength, so a dBm meter is added opposing the SSID when on the File Transfer page. * **What changes are included?** The dBm meter was at risk of causing rapid screen updates (if, say, we hovered right around a threshold), so I've implemented a basic hysteresis around this. RISING/FALLING would be more canonical variable names, but are reserved in the framework. ## Additional Context My X4 has a terrible antenna, apparently, and I was running into this failure condition pretty regularly. Wifi "bars" were chosen as a relatively pan-cultural glyph rather than relying on localization. Tested on hardware at -83 dBm under sustained EPUB upload (60 books, ~30 MB). Transient losses up to ~14s now ride through; pre-fix the same losses required a power-cycle after as little as a 2s blip. --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? Nope. Commits are hand written. Claude was used to build a local test harness for validation only during iteration.
This commit is contained in:
@@ -44,7 +44,16 @@ class CrossPointWebServerActivity final : public Activity {
|
||||
// Performance monitoring
|
||||
unsigned long lastHandleClientTime = 0;
|
||||
|
||||
// Sustained WiFi-loss tracking; abandon only after WIFI_ABANDON_MS.
|
||||
int consecutiveDisconnects = 0;
|
||||
unsigned long firstDisconnectAt = 0;
|
||||
static constexpr unsigned long WIFI_ABANDON_MS = 5UL * 60UL * 1000UL;
|
||||
|
||||
// Cached signal-strength bracket (0..4) for the WiFi indicator.
|
||||
int lastWifiBars = 0;
|
||||
|
||||
void renderServerRunning() const;
|
||||
void renderWifiIndicator(int subHeaderTop) const;
|
||||
|
||||
void onNetworkModeSelected(NetworkMode mode);
|
||||
void onWifiSelectionComplete(bool connected);
|
||||
|
||||
Reference in New Issue
Block a user