scheduler: improve all the things
This commit is contained in:
parent
3a4a368038
commit
3f8f174a07
1 changed files with 132 additions and 130 deletions
14
boot.py
14
boot.py
|
@ -1,14 +1,15 @@
|
||||||
# ssid, password
|
|
||||||
import wifi
|
|
||||||
import usocket as socket
|
import usocket as socket
|
||||||
from utime import sleep
|
from utime import sleep
|
||||||
|
|
||||||
from machine import Pin, RTC, I2C
|
from machine import Pin, RTC, I2C
|
||||||
import network
|
import network
|
||||||
from DS3231 import DS3231
|
from DS3231 import DS3231
|
||||||
import web
|
import web
|
||||||
|
|
||||||
import esp
|
import esp
|
||||||
|
## wifi.py
|
||||||
|
# ssid = xxx
|
||||||
|
# password = yyy
|
||||||
|
import wifi
|
||||||
|
|
||||||
esp.osdebug(None)
|
esp.osdebug(None)
|
||||||
|
|
||||||
import ure
|
import ure
|
||||||
|
@ -16,6 +17,7 @@ import uos
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
import gc
|
import gc
|
||||||
|
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
|
||||||
# global variables
|
# global variables
|
||||||
|
@ -32,13 +34,13 @@ pin_cfg = Pin(12, Pin.IN)
|
||||||
pin_led = Pin(2, Pin.OUT)
|
pin_led = Pin(2, Pin.OUT)
|
||||||
|
|
||||||
## CONFIG
|
## CONFIG
|
||||||
CONFIG_FILE="schedule.json"
|
CONFIG_FILE = "schedule.json"
|
||||||
config = {}
|
config = {}
|
||||||
# try loading config from filesystem
|
# try loading config from filesystem
|
||||||
files = uos.listdir()
|
files = uos.listdir()
|
||||||
if CONFIG_FILE in files:
|
if CONFIG_FILE in files:
|
||||||
f = open(CONFIG_FILE, "r")
|
f = open(CONFIG_FILE, "r")
|
||||||
config_raw=f.read()
|
config_raw = f.read()
|
||||||
config = ujson.loads(config_raw)
|
config = ujson.loads(config_raw)
|
||||||
f.close()
|
f.close()
|
||||||
for i in range(7):
|
for i in range(7):
|
||||||
|
|
Loading…
Reference in a new issue