From 35d062baaa63312ed4078a1e4d48caeabf1de5dd Mon Sep 17 00:00:00 2001 From: Arne Zachlod Date: Tue, 4 Mar 2025 16:52:55 +0100 Subject: [PATCH] delete UART entity to free up rxbuf in low memory conditions --- main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 62928ee..42a2445 100755 --- a/main.py +++ b/main.py @@ -22,7 +22,8 @@ from machine import WDT from machine import reset from sdcard import SDCard -DEBUG = True # set True for debug output +DEBUG = True +# set True for debug output BUF_POS = 0 SD_MOUNT = '/sd' @@ -225,6 +226,9 @@ def exec_upload(cmd): global LOG_FOLDER global OLD_LOG_FOLDER del BUFFER # delete buffer to free some memory for upload process + global UART0 + UART0.deinit() + del UART0 gc.collect() debug(f"free memory before network connect: {gc.mem_free()}") network_connect(cmd) @@ -266,6 +270,9 @@ def exec_uota(cmd): # wlan_password - optional global BUFFER del BUFFER + global UART0 + UART0.deinit() + del UART0 gc.collect() import uota network_connect(cmd)