main.py: watchdog timer for upload and OTA
This commit is contained in:
parent
9eabcacd16
commit
5242b178bf
1 changed files with 5 additions and 0 deletions
5
main.py
5
main.py
|
|
@ -223,6 +223,9 @@ def prepare_lowmem():
|
|||
del UART0
|
||||
gc.collect()
|
||||
|
||||
def setup_wdt(seconds):
|
||||
from machine import WDT
|
||||
wdt = WDT(timeout = seconds * 1000)
|
||||
|
||||
def exec_upload(cmd):
|
||||
# options:
|
||||
|
|
@ -235,6 +238,7 @@ def exec_upload(cmd):
|
|||
global OLD_LOG_FOLDER
|
||||
prepare_lowmem()
|
||||
debug(f"free memory before network connect: {gc.mem_free()}")
|
||||
setup_wdt(3600)
|
||||
network_connect(cmd)
|
||||
# upload file to server
|
||||
import requests
|
||||
|
|
@ -273,6 +277,7 @@ def exec_uota(cmd):
|
|||
# wlan_ssid
|
||||
# wlan_password - optional
|
||||
prepare_lowmem()
|
||||
setup_wdt(3600)
|
||||
import uota
|
||||
network_connect(cmd)
|
||||
if uota.check_for_updates():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue