Skip to content

Wi-Fi changes, host names and REPL keys for a board shown in a browser - #861

Merged
bdbarnett merged 4 commits into
mainfrom
rdbugs
Nov 26, 2026
Merged

bdbarnett merged 4 commits into
mainfrom
rdbugs

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

Four fixes for a board shown in a browser through RemoteDisplay, found on an ESP32-S31 running Home.

Changing Wi-Fi from the picker could leave the board off every network. On esp32 the station still reads as connected, with the old address, for a moment after disconnect(), so wifi_manager's join took the old link for the new one and returned at once: a wrong password passed, was saved over the right one, and the station kept retrying it. A join now waits for the station to leave first. And when a join from the picker fails, wifinet goes back to the network the board was on and says so ("Couldn't join none: timed out after 20s. Back on nothing"), because a board reached over Wi-Fi is otherwise cut off with the error on a page nobody can see.

Two S31 boards answered to the same host name. machine.unique_id() on chips with an 802.15.4 radio (C5, C6, H2, S31) is a truncated EUI-64 (1c2904fffed0), the same on every board of a batch, so boarddev's default name now comes from the Wi-Fi MAC on an ESP32. RemoteDisplay also prints its http://<name>.local/ address beside the numeric one. The firmware side of the unique ID is a separate patch in omnipython-builds.

The REPL app read only USB and BLE keyboards, so keys typed in the browser went nowhere. display_driver.take_keys() lets a terminal take the display's own keys, and vtterm's new DisplayKeyboard uses it.

Tested with the scoped suites (test_wifi_manager, test_endpoint_providers, test_board_name, test_lvgl_display_driver, test_remotedisplay, vtterm's tests/run.py); each new test fails without its fix. On a Waveshare ESP32-S31-Zero with these files copied over the frozen ones: the page opened at http://omnipython-d0a23a.local/ from Windows; print(6*7) typed in the browser ran in the REPL app; a picker move from one network to the other and back came back at the same address in about 15 s; and a pair with a wrong password failed after 20 s, went back to the first network and left the saved passwords as they were. Not verified on a board: the name_url print (displaydev is frozen there). The first time the REPL app opened after a boot, twice out of three tries it showed no prompt or lost the first keys; later opens worked every time. That looks separate from this change and isn't fixed here.

Joining a network from a picker left the one the board was on first, and
when the new join failed (a wrong password, a network that never answered)
the board stayed off every network. A board reached over Wi-Fi, through
WebREPL or a browser display, was cut off with the error shown on a page
nobody could reach. wifinet now rejoins the network it was on with its saved
password, and the error says so: "Wrong password for Cafe. Back on Home",
or that the way back failed too.

The checks' stand-in station now leaves its network when it joins another,
as the real one does; with it, the old wifinet fails four new checks.
On a chip with an IEEE 802.15.4 radio (ESP32-C5, C6, H2, S31),
machine.unique_id() is an EUI-64 cut to six bytes: the vendor's three, ff:fe
and one byte of the MAC. Every default name ended in fffe and that byte, so
two ESP32-S31 boards on one network both answered to omnipython-fffed0.local.
The default name now takes the station MAC's last three bytes, which equal
unique_id()'s on every ESP32 without 802.15.4, so no other board's name
changes. A build without Wi-Fi still uses unique_id().

RemoteDisplay also prints the address by host name beside the IP address,
and keeps it as RemoteServer.name_url.
vtterm read USB and BLE keyboards only, so the REPL on a desktop window or
in the browser showing a RemoteDisplay ignored the keyboard in front of it.
display_driver.take_keys() hands the display's own keys to a callback
instead of LVGL's focused widget, and vtterm.keyboards.DisplayKeyboard uses
it: start_all() starts it wherever the display has a keyboard of its own.
On esp32 the station still reads as connected, with the old address, for a
moment after disconnect(). A join from one network to another took that for
the new link and returned at once: a wrong password passed, was saved over the
right one, and the board was left off the network.
@bdbarnett
bdbarnett merged commit 1bf51cf into main Nov 26, 2026
12 checks passed
@bdbarnett
bdbarnett deleted the rdbugs branch November 26, 2026 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant