Rewrite wifi menu #140
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
# Conflicts: # pistomp/lcd320x240.py
Cherry-picks (non-emulator portions): - 08c57d3 Fix multi-wifi / test / emulator integration (test hunks only) - aa0560f Snapshot updates - 1a9f520 Test update for nearby networks - 2c70da1 Snapshot updates - 1b89fe8 Tests for wifi menu upgrades (conflict on conftest.py: kept wifi helpers, dropped blend_system fixture per blend-stack separation) - bcacfe2 Tests for wifi menu: open glyph and BadNet failure - b7800e1 Tests for wifi menu pt 3 - e40fb24 Snapshot updates (will be regenerated locally — these baselines were rendered against the release/current bouquet) Fixes pre-existing failures on feat/multi-wifi: tests/integration/test_wifi.py::test_configure_wifi_credentials[v2,v3] tests/test_lcd320x240.py::test_wifi_menu_snapshot Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Previous baselines (from e40fb24) were rendered with the release/current bouquet active, which includes a system menu icon source branch that isn't part of feat/multi-wifi alone. Diffs are icon-only, no test logic. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
rreichenbach
left a comment
There was a problem hiding this comment.
This is super cool, but not ready. Switching to Hotspot works, but I can't get it back to WiFi. It sometimes wouldn't even show Nearby networks. When it did, it made me re-enter a password for the original wifi network. To avoid frustration, it should remember the password previously used so one can toggle back and forth between hotspot and wifi.
FWIW, I found that working/testing this kind of stuff gets really frustrating if you switch modes and rely on that connection for making your code changes. It's good to have a wired connection that's always available.
Randall, I apologise. I accidentally did not push up my latest round of changes 🙈 I'll see if I can repro your bug on the current tip. |
|
Fixed and added some tests for what you found. |
rreichenbach
left a comment
There was a problem hiding this comment.
Better, but I'm still having problems using this. When I first switched to Hotspot mode, the pi crashed. I power-cycled, it did come up in hotspot mode, so from that point maybe ok.
But then I disabled Hotspot mode and it does remember my previous network and connect - that's good, but the dialog title shows "WiFi - Disconnected". And if I choose that network, it will require I enter a password. It would be nice if the currently connected was identified that way (eg. "YYZ (current)" or has an icon), and maybe even not allowing it to be clicked, so the user doesn't waste time entering a password not knowing they don't need to.
Another UX issue: it's not intuitively obvious to me that clicking "Hotspot Mode" will toggle it on or off. I like the little dot indicator, but actually think it would be more clear if it showed "Switch to Hotspot Mode" when connected to WiFi, and "Disable Hotspot Mode" when in Hotspot mode.
Also when I click the wifi toolbar button, there's usually some significant lag time. I believe it's finding the networks. I wonder since that initial dialog doesn't show all the networks, if the network load could be lazy (after the dialog appears).
I know I'm asking for a lot of UX here and that's the UI lib isn't exactly robust. But lack of connectivity can cause major frustration, so if we're going to improve this, it should work rather smoothly.
| if self.wifi_status[key]: | ||
| hotspot_active = True | ||
| key = 'ip_address' | ||
| key = 'ip4_address' |
| def draw_selection_menu(self, items, title="", auto_dismiss=False, dismiss_option=False, | ||
| font=None, title_font=None, default_item=None): | ||
| # items is a list of tuples: (label, callback, arg) or (label, callback, arg, is_active) | ||
| # or (label, callback, arg, is_active, long_callback) where long_callback is called | ||
| # instead of callback on a long press. |
There was a problem hiding this comment.
This is getting pretty out-of-hand, will tackle in a future PR
rreichenbach
left a comment
There was a problem hiding this comment.
Seems to work great and usage feels intuitive. I know that was a lot of work. Thanks!
The new WifiManager (now on pistomp-v3 via PR TreeFallSound#140) is command-queue-based: callers invoke the queue with Cmd objects, poll() drains via on_status_change callback, saved profiles surface through get_cached_saved(), and connect_scanned/saved gained extra args (security, wait, reconnect). StubWifiManager still used the pre-queue interface and crashed the emulator on first wifi tick. Reuse the real CommandQueue against the stub (its run() methods match the new shape), add the missing methods, and drop the orphaned configure_wifi path which no caller invokes anymore. Relocated from release/patch bridge 54c590a now that feat/multi-wifi has landed on base.
Wifi system overview
modalapi/wifi.pyhas been refactored into a modalapi.wifi package with five modules:Command[T]and concrete command dataclasses (ConnectSavedCmd,ConnectScannedCmd,ScanCmd, etc.), plus a single-worker serializedCommandQueueexecutorBugfixes
Demo (out-of-date)
While not accurate to what the current wifi menu looks like, it's accurate in terms of functionality.
Wifi.Menu.mov
Author checklist