Add fallback wifi connection

This commit is contained in:
David Todd 2020-01-27 18:54:20 -06:00
parent 3787d7bae0
commit 7039537eb9
3 changed files with 30 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "pixo/micropython-mpu9x50"]
path = pixo/micropython-mpu9x50
url = https://github.com/micropython-IMU/micropython-mpu9x50.git

26
pixo/fallback.py Normal file
View File

@ -0,0 +1,26 @@
# Setup network
import network
import time
# Hardcoded network credentials
try:
import creds
except ImportError:
class creds:
WIFI_NETWORKS = [
('', '')
]
# We will attempt connections for this many seconds
MAX_WAIT = 15
# Setup the wifi connection
STA_IF = network.WLAN(network.STA_IF)
if not STA_IF.isconnected():
for network in creds.WIFI_NETWORKS:
if STA_IF.isconnected():
break
STA_IF.connect(network[0], network[1])
import uftpd

@ -0,0 +1 @@
Subproject commit 11a6bd72472a8cf22763eb5ac32aa4ce07113fce