mirror of
https://github.com/c0de-archive/pixoPython.git
synced 2024-12-22 05:12:41 +00:00
Add fallback wifi connection
This commit is contained in:
parent
3787d7bae0
commit
7039537eb9
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal 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
26
pixo/fallback.py
Normal 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
|
1
pixo/micropython-mpu9x50
Submodule
1
pixo/micropython-mpu9x50
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 11a6bd72472a8cf22763eb5ac32aa4ce07113fce
|
Loading…
Reference in New Issue
Block a user