From 4aa2a750d9b87b2884f6e2e1fab05f33929546ff Mon Sep 17 00:00:00 2001 From: eddy Date: Sun, 2 Aug 2026 20:56:37 +0200 Subject: [PATCH] =?UTF-8?q?Review=20fixes:=20Serial=20ERROR=E2=86=92ESP=5F?= =?UTF-8?q?LOGE,=20heartbeat=E2=86=92ESP=5FLOGD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace remaining Serial.println("ERROR:...") with ESP_LOGE in client.cpp - Add Serial.println("ERROR") for protocol response where needed - Downgrade heartbeat from ESP_LOGI to ESP_LOGD (not needed in production) --- src/client.cpp | 11 +++++++---- src/main.cpp | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index b0ac929..0dc079c 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -290,7 +290,8 @@ void loop() { ESP_LOGI(TAG, "BLE: initialized after key provisioning"); } } else { - Serial.println("ERROR: invalid key format"); + ESP_LOGE(TAG, "Invalid key format"); + Serial.println("ERROR"); } } else if (serialBuf.startsWith("SET_ID:")) { String hex = serialBuf.substring(7); @@ -305,7 +306,8 @@ void loop() { Serial.println("OK"); Serial.println("UUID stored in NVS"); } else { - Serial.println("ERROR: invalid UUID format"); + ESP_LOGE(TAG, "Invalid UUID format"); + Serial.println("ERROR"); } } else if (serialBuf.startsWith("SET_SERVER:")) { String hex = serialBuf.substring(11); @@ -331,7 +333,8 @@ void loop() { ESP_LOGI(TAG, "BLE: initialized after server provisioning"); } } else { - Serial.println("ERROR: invalid server UUID format"); + ESP_LOGE(TAG, "Invalid server UUID format"); + Serial.println("ERROR"); } } serialBuf = ""; @@ -451,7 +454,7 @@ void loop() { static uint32_t heartbeat = 0; if (millis() - heartbeat > 60000) { - ESP_LOGI(TAG, "[heartbeat] t1=%s t2=%s btn=%s r1=%s r2=%s connected=%s", + ESP_LOGD(TAG, "[heartbeat] t1=%s t2=%s btn=%s r1=%s r2=%s connected=%s", !t1Active ? "YES" : "no", !t2Active ? "YES" : "no", btnActive ? "YES" : "no", diff --git a/src/main.cpp b/src/main.cpp index 4146962..e12cbd5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -653,7 +653,7 @@ void loop() { if (!otaInProgress && millis() - heartbeat > 60000) { bool anyBle1 = (connActive[0] && bleRelay1[0]) || (connActive[1] && bleRelay1[1]); bool anyBle2 = (connActive[0] && bleRelay2[0]) || (connActive[1] && bleRelay2[1]); - ESP_LOGI(TAG, "[heartbeat] R1=%s R2=%s t1=%s t2=%s btn=%s ble1=%s ble2=%s clients=%d", + ESP_LOGD(TAG, "[heartbeat] R1=%s R2=%s t1=%s t2=%s btn=%s ble1=%s ble2=%s clients=%d", relay1State ? "ON" : "OFF", relay2State ? "ON" : "OFF", t1Active ? "YES" : "no",