-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Wi-Fi autoconnect and title bar status #6473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This adds support for CIRCUITPY_WIFI_SSID and CIRCUITPY_WIFI_PASSWORD in `/.env`. When both are defined, CircuitPython will attempt to connect to the network even when user code isn't running. If the user code attempts to a network with the same SSID, it will return immediately. Connecting to another SSID will disconnect from the auto-connected network. If the user code initiates the connection, then it will be shutdown after user code exits. (Should match <8 behavior.) This PR also reworks the default displayio terminal. It now supports a title bar TileGrid in addition to the (newly renamed) scroll area. The default title bar is the top row of the display and is positioned to the right of the Blinka logo when it is enabled. The scroll area is now below the Blinka logo. The Wi-Fi auto-connect code now uses the title bar to show its state including the IP address when connected. It does this through the "standard" OSC control sequence `ESC ] 0 ; <s> ESC \` where <s> is the title bar string. This is commonly supported by terminals so it should work over USB and UART as well. Related to micropython#6174
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested with a Feather ESP32-S2 no PSRAM, and also with a FunHouse.
With both, I saw the title bar of the terminal change (neat!) when I connected successfully.
If I gave SSID that could not be reached in .env
, things failed fairly quickly. However, if I gave an incorrect password in .env
, there was a long time waiting before the FunHouse showed the status code, and even longer for the /dev/ttyACMx to come up. Sometimes it did not respond at all and I had to disconnect and reconnect (with tio).
I tried going into safe modeso I could edit .env
by clicking during the three flashes, but it didn't seem to work. It also didn't work on an older build, so this seems like an existing problem. Eventually, it did come up, even with the bad password, and I was able to edit.
So try these scenarios yourself, and see how it works for you. I'm not sure about having the connect be blocking, especially when the connect is not happening, but not blocking may have its own problems.
Make them CIRCUITPY_FULL_BUILD = 0 and rework the boards to have the same modules enabled (ish.) Also make ZLIB require FULL_BUILD and disable advanced `micropython` module APIs by default on all builds.
This adds basic timeout support to connect by preventing subsequent retries if over time. The first connect may still take more than the timeout.
I've added basic timeout support to I've added a TODO to do our own scan first but didn't give in to doing it now. |
@dhalbert This is ready for another look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the improved timeout. With a bad password, I am seeing "authentication failure" after about 7 seconds, and CIRCUITPY appears after about 15 seconds. Eventually I see "off" instead of "authentication failure", as I expect you wanted.
Also thanks for the nRF52833 cleanup!
This adds support for CIRCUITPY_WIFI_SSID and CIRCUITPY_WIFI_PASSWORD
in
/.env
. When both are defined, CircuitPython will attempt toconnect to the network even when user code isn't running. If the
user code attempts to a network with the same SSID, it will return
immediately. Connecting to another SSID will disconnect from the
auto-connected network. If the user code initiates the connection,
then it will be shutdown after user code exits. (Should match <8
behavior.)
This PR also reworks the default displayio terminal. It now supports
a title bar TileGrid in addition to the (newly renamed) scroll area.
The default title bar is the top row of the display and is positioned
to the right of the Blinka logo when it is enabled. The scroll area
is now below the Blinka logo.
The Wi-Fi auto-connect code now uses the title bar to show its
state including the IP address when connected. It does this through
the "standard" OSC control sequence
ESC ] 0 ; <s> ESC \
where <s>is the title bar string. This is commonly supported by terminals
so it should work over USB and UART as well.
Related to #6174