From 621a48f0116ba8318f1ebfcd0dff1b964b19a8e1 Mon Sep 17 00:00:00 2001 From: sickprodigy Date: Sat, 15 Nov 2025 13:15:45 -0500 Subject: [PATCH] fix: Adjust memory threshold for Discord message sending to enhance reliability --- Scripts/discord_webhook.py | 2 +- main.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/discord_webhook.py b/Scripts/discord_webhook.py index cb7ef0f..9177f0f 100644 --- a/Scripts/discord_webhook.py +++ b/Scripts/discord_webhook.py @@ -60,7 +60,7 @@ def send_discord_message(message, username="Auto Garden Bot", is_alert=False, de # Quick mem check before importing urequests/SSL mem = getattr(gc, "mem_free", lambda: None)() # Require larger headroom based on device testing (adjust if you re-test) - if mem is not None and mem < 105000: + if mem is not None and mem < 95000: print("Discord send skipped: ENOMEM ({} bytes free)".format(mem)) return False diff --git a/main.py b/main.py index 41609be..07d4312 100644 --- a/main.py +++ b/main.py @@ -201,7 +201,7 @@ if wifi and wifi.isconnected(): gc.collect() ram_free = gc.mem_free() print(f"DEBUG: Free RAM before Discord send: {ram_free // 1024} KB") - mem_ok = ram_free > 105000 + mem_ok = ram_free > 95000 if mem_ok: ok = discord_webhook.send_discord_message("Pico W online at http://{}".format(ifconfig[0]), debug=False) if ok: