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
|
del UART0
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
|
||||||
|
def setup_wdt(seconds):
|
||||||
|
from machine import WDT
|
||||||
|
wdt = WDT(timeout = seconds * 1000)
|
||||||
|
|
||||||
def exec_upload(cmd):
|
def exec_upload(cmd):
|
||||||
# options:
|
# options:
|
||||||
|
|
@ -235,6 +238,7 @@ def exec_upload(cmd):
|
||||||
global OLD_LOG_FOLDER
|
global OLD_LOG_FOLDER
|
||||||
prepare_lowmem()
|
prepare_lowmem()
|
||||||
debug(f"free memory before network connect: {gc.mem_free()}")
|
debug(f"free memory before network connect: {gc.mem_free()}")
|
||||||
|
setup_wdt(3600)
|
||||||
network_connect(cmd)
|
network_connect(cmd)
|
||||||
# upload file to server
|
# upload file to server
|
||||||
import requests
|
import requests
|
||||||
|
|
@ -273,6 +277,7 @@ def exec_uota(cmd):
|
||||||
# wlan_ssid
|
# wlan_ssid
|
||||||
# wlan_password - optional
|
# wlan_password - optional
|
||||||
prepare_lowmem()
|
prepare_lowmem()
|
||||||
|
setup_wdt(3600)
|
||||||
import uota
|
import uota
|
||||||
network_connect(cmd)
|
network_connect(cmd)
|
||||||
if uota.check_for_updates():
|
if uota.check_for_updates():
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue