scheduler: improve all the things

This commit is contained in:
Konstantin Koslowski 2019-07-04 21:21:29 +02:00
parent 3a4a368038
commit 3f8f174a07

14
boot.py
View file

@ -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):