From 60f993d2ca042cedb2650445343ccf4f94df8530 Mon Sep 17 00:00:00 2001 From: netmindz Date: Sun, 8 Oct 2023 10:26:04 +0100 Subject: [PATCH] Revert "Try and fix problems raised in Issue#46" --- sensor/src/sensor.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sensor/src/sensor.ino b/sensor/src/sensor.ino index 9a23df0..2418dbb 100644 --- a/sensor/src/sensor.ino +++ b/sensor/src/sensor.ino @@ -537,7 +537,7 @@ void handleBytes(size_t len, uint8_t buf[]) { } result += String(buf[i], HEX); } - if (msgLength == 0 && result.length() >= 2) { + if (msgLength == 0 && result.length() == 2) { String messageType = result.substring(0, 2); if (messageType == "fa") { msgLength = 46; @@ -547,8 +547,8 @@ void handleBytes(size_t len, uint8_t buf[]) { Serial.print("Unknown message length for "); Serial.println(messageType); } - } else if (result.length() >= msgLength) { // Shouldn't really be longer, but we might have been slow reading before pin5 HIGH - if (msgLength == 46) { + } else if (result.length() == msgLength) { + if (result.length() == 46) { sendCommand(); // send reply *before* we parse the FA string as we don't want to delay the reply by // say sending MQTT updates }