fix wifi password, clean imports
This commit is contained in:
parent
0b848ae3d0
commit
14e142615d
8
boot.py
8
boot.py
@ -1,13 +1,13 @@
|
|||||||
|
import ujson
|
||||||
|
import network
|
||||||
from hal import *
|
from hal import *
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import socket, re, os, uwebsockets, network, binascii, ujson
|
|
||||||
|
|
||||||
print("Press Ctrl-C to stop boot script...")
|
print("Press Ctrl-C to stop boot script...")
|
||||||
sleep(0.2)
|
sleep(0.2)
|
||||||
|
|
||||||
# read the config file
|
# read the config file
|
||||||
config = ujson.loads(open("config.json", "r").read())
|
config = ujson.loads(open("config.json", "r").read())
|
||||||
print(config)
|
|
||||||
|
|
||||||
# connect to WiFi
|
# connect to WiFi
|
||||||
wlan = network.WLAN(network.STA_IF)
|
wlan = network.WLAN(network.STA_IF)
|
||||||
@ -25,9 +25,9 @@ if not wlan.isconnected():
|
|||||||
if ssid in config["wifis"].keys():
|
if ssid in config["wifis"].keys():
|
||||||
print("connecting to: " + ssid)
|
print("connecting to: " + ssid)
|
||||||
# start to connect to the pre-configured network
|
# start to connect to the pre-configured network
|
||||||
wlan.connect(ssid, wifis[ssid])
|
wlan.connect(ssid, config["wifis"][ssid])
|
||||||
break
|
break
|
||||||
|
|
||||||
# Clean up
|
# clean up
|
||||||
import gc
|
import gc
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
Loading…
Reference in New Issue
Block a user