esp32-lightbar/src/boot.py

27 lines
589 B
Python
Raw Normal View History

2021-12-28 22:10:27 +01:00
# boot.py -- run on boot-up
import network
import pycom
from config import Config
import wlan_manager
# Disable Pybytes and smart configuration
pycom.pybytes_on_boot(False)
pycom.smart_config_on_boot(False)
# Load config from flash memory
config = Config()
config.load()
# Enable or disable heartbeat
pycom.heartbeat(config.get('heartbeat'))
# Reconfigure FTP and Telnet server
server = network.Server()
server.deinit()
server.init(login=(config.get('login_user'), config.get('login_password')), timeout=600)
# Connect to WLAN
wlan_manager.connect(config)