I've spent several hours cleaning up all the P4wnP1 WiFi scripts.
In the process, I managed to replace a few lines of code in wifi-disp.py and wifi-pw.py so that they now check to make sure the "Saved SSID" is inside (scanned) ssids.txt.
Why Check if SavedSSID is in ssids.txt?
This is so that the Choose WiFi Network screen (wifi-disp.py) and the Enter Password screen (wifi-pw.py) DO NOT appear when the user selected "Yes - Reconnect WiFi".
This is true while the two mentioned screens (Choose WiFi Network and Enter Password) DO appear when the "Saved SSID" is not found in the list of scanned WiFi networks (ssids.txt).
WiFi AutoReconnect Now Working as Intended (Mostly)
This may seem minor, but it was a big step in bringing all the pieces together.
Essentially, this means the WiFi Auto-Reconnect feature was (mostly) working properly!
Since my goal was to have wifi-disp.py and wifi-pw.py NOT shown when auto-reconnecting - and have those two screens SHOWN when not auto-reconnecting, I can safely say the goal was achieved.
To Do List Items Done:
- Replaced all .txt file references with a variable that's set near the top of each script
- Wifi-disp and wifi-pw now appear when Saved SSID is not found in ssids.txt, so the user can choose a network that was found in the WiFi scan and enter a password
A few more issues / cases to deal with:
- Wrong WiFi password
- 0 APs found (re-scan X times)
- What to do when WiFi hotspot is turned off (connection hangs after that and is unusable - need to reboot or find another way to get WiFi to work after that)
- (DONE) Add a screen that prints "Reconnecting" on the OLED screen just before/after WiFi-reconnect command is sent
- NEXT: After "Save Password?" screen is done, make it go away and show the IP address
- Use a Python QR code generator to display QR code of IP address
- NEXT: Also start making a Dashboard (icons/panels for
- VNC server
- Notifications (envelope icon)
- Battery % / hard-wire (⚡)
- Menu button
- Time & date