From 9f031e57c559573731c5fe515fef60949eab32df Mon Sep 17 00:00:00 2001 From: Junior Date: Tue, 24 Nov 2026 20:45:42 -0500 Subject: [PATCH] Add status check for connectivity before making HTTP calls --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index aaf25f8..0b20e77 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -71,7 +71,7 @@ bool debouncing = false; void loop() { unsigned long currentMillis = millis(); if ( (currentMillis - lastStatusTime) >= STATUSINTERVAL ) { - lastStatusTime = sendDeviceStatus(); + if ( WiFi.status() == WL_CONNECTED ) lastStatusTime = sendDeviceStatus(); currentMillis = lastStatusTime; } unsigned short buttonCheck = digitalRead(BUTTONPIN); @@ -85,7 +85,7 @@ void loop() { buttonState = buttonCheck; if ( buttonState == LOW ) { actionState = !actionState; - sendActionMessage(actionState); + if ( WiFi.status() == WL_CONNECTED ) sendActionMessage(actionState); } } }