diff --git a/Scripts/discord_webhook.py b/Scripts/discord_webhook.py index c364882..c00fed8 100644 --- a/Scripts/discord_webhook.py +++ b/Scripts/discord_webhook.py @@ -56,8 +56,8 @@ def send_discord_message(message, username="Auto Garden Bot", is_alert=False): # 1b) quick mem check - avoid importing urequests/TLS when too low try: mem = getattr(gc, "mem_free", lambda: None)() - # raised threshold to reduce chance of spike during TLS/requests - if mem is not None and mem < 140000: + # lower threshold to match this board's free heap (~100 KB observed) + if mem is not None and mem < 90000: return False except: pass diff --git a/main.py b/main.py index 6c9de8b..224b231 100644 --- a/main.py +++ b/main.py @@ -408,7 +408,7 @@ while True: _gc.collect() _gc.collect() # require a conservative free memory threshold before TLS (adjust to your device) - mem_ok = getattr(_gc, 'mem_free', lambda: 0)() > 140000 + mem_ok = getattr(_gc, 'mem_free', lambda: 0)() > 90000 if mem_ok: try: ok = discord_webhook.send_discord_message(pending_discord_message)