27 lines
589 B
Python
27 lines
589 B
Python
|
|
# 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)
|