changed network connecting
This commit is contained in:
parent
533bb1bd0d
commit
08610f2c70
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
wifi-credentials
|
wifi-credentials
|
||||||
.uploaded
|
.uploaded
|
||||||
uP-cheatsheet
|
uP-cheatsheet
|
||||||
|
.vscode/
|
10
boot.py
10
boot.py
@ -6,9 +6,15 @@ sta_if = network.WLAN(network.STA_IF)
|
|||||||
sta_if.active(True)
|
sta_if.active(True)
|
||||||
|
|
||||||
availableNetworkSSIDs = [s[0].decode() for s in sta_if.scan()]
|
availableNetworkSSIDs = [s[0].decode() for s in sta_if.scan()]
|
||||||
|
print(availableNetworkSSIDs)
|
||||||
#load wifi credentials from file
|
#load wifi credentials from file
|
||||||
with open("wifi-credentials","r") as f:
|
with open("wifi-credentials","r") as f:
|
||||||
ssid = f.readline().replace("\n","")
|
while True:
|
||||||
password = f.readline().replace("\n","")
|
ssid = f.readline()
|
||||||
|
password = f.readline()#
|
||||||
|
if not ssid or not password:
|
||||||
|
break
|
||||||
|
ssid = ssid.replace("\n","")
|
||||||
|
password = password.replace("\n","")
|
||||||
if ssid in availableNetworkSSIDs:
|
if ssid in availableNetworkSSIDs:
|
||||||
sta_if.connect(ssid,password)
|
sta_if.connect(ssid,password)
|
||||||
|
2
main.py
2
main.py
@ -13,7 +13,7 @@ async def run_screens():
|
|||||||
global modus,screens
|
global modus,screens
|
||||||
while True:
|
while True:
|
||||||
await screens[modus%len(screens)]
|
await screens[modus%len(screens)]
|
||||||
for i,b in enumerate(HW.buttons):
|
for b in HW.buttons:
|
||||||
b.setCallbacks()#Clear Callbacks
|
b.setCallbacks()#Clear Callbacks
|
||||||
modus += 1
|
modus += 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user