From 938d3c390c1d5c4738fc914774390a51c1afa328 Mon Sep 17 00:00:00 2001 From: Arne Zachlod Date: Thu, 13 Feb 2025 19:53:44 +0100 Subject: [PATCH] initialize big buffer before imports so the chances are higher that the RAM is available in one piece --- sdlogger.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sdlogger.py b/sdlogger.py index 794f579..f5c5806 100755 --- a/sdlogger.py +++ b/sdlogger.py @@ -1,5 +1,11 @@ #! /usr/bin/python +BUFSIZE_BUFFER = const(49 * 1024) +BUFSIZE_RXBUF = const(32 * 1024) +BUF_THRESHOLD = const(16 * 1024) +UART_TIMEOUT = const(1000) # timeout to start writing in ms +BUFFER = bytearray(BUFSIZE_BUFFER) + import os, vfs import time @@ -8,11 +14,6 @@ from machine import SPI from machine import Pin from sdcard import SDCard -BUFSIZE_BUFFER = const(49 * 1024) -BUFSIZE_RXBUF = const(32 * 1024) -BUF_THRESHOLD = const(16 * 1024) -UART_TIMEOUT = const(1000) # timeout to start writing in ms -BUFFER = bytearray(BUFSIZE_BUFFER) BUF_POS = 0 SD_MOUNT = '/sd' LOG_FOLDER = 'logs'