delete UART entity to free up rxbuf in low memory conditions
This commit is contained in:
parent
9f0c5d419a
commit
35d062baaa
1 changed files with 8 additions and 1 deletions
9
main.py
9
main.py
|
|
@ -22,7 +22,8 @@ from machine import WDT
|
||||||
from machine import reset
|
from machine import reset
|
||||||
from sdcard import SDCard
|
from sdcard import SDCard
|
||||||
|
|
||||||
DEBUG = True # set True for debug output
|
DEBUG = True
|
||||||
|
# set True for debug output
|
||||||
|
|
||||||
BUF_POS = 0
|
BUF_POS = 0
|
||||||
SD_MOUNT = '/sd'
|
SD_MOUNT = '/sd'
|
||||||
|
|
@ -225,6 +226,9 @@ def exec_upload(cmd):
|
||||||
global LOG_FOLDER
|
global LOG_FOLDER
|
||||||
global OLD_LOG_FOLDER
|
global OLD_LOG_FOLDER
|
||||||
del BUFFER # delete buffer to free some memory for upload process
|
del BUFFER # delete buffer to free some memory for upload process
|
||||||
|
global UART0
|
||||||
|
UART0.deinit()
|
||||||
|
del UART0
|
||||||
gc.collect()
|
gc.collect()
|
||||||
debug(f"free memory before network connect: {gc.mem_free()}")
|
debug(f"free memory before network connect: {gc.mem_free()}")
|
||||||
network_connect(cmd)
|
network_connect(cmd)
|
||||||
|
|
@ -266,6 +270,9 @@ def exec_uota(cmd):
|
||||||
# wlan_password - optional
|
# wlan_password - optional
|
||||||
global BUFFER
|
global BUFFER
|
||||||
del BUFFER
|
del BUFFER
|
||||||
|
global UART0
|
||||||
|
UART0.deinit()
|
||||||
|
del UART0
|
||||||
gc.collect()
|
gc.collect()
|
||||||
import uota
|
import uota
|
||||||
network_connect(cmd)
|
network_connect(cmd)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue