From 6f7fa6abd9d554ef0b696951f2ac5623e9c9208a Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Tue, 20 Dec 2022 08:26:00 +0100 Subject: [PATCH] fix #820, NOTSET check for 4 byte values. --- src/devices/boiler.cpp | 1 + src/helpers.cpp | 2 +- src/telegram.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index d151c58b1..49b1c9924 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -1302,6 +1302,7 @@ void Boiler::process_HpInConfig(std::shared_ptr telegram) { has_update(hpInput[3].option, option, 12); } +// Boiler(0x08) -W-> Me(0x0B), HpHeaterConfig(0x0492), data: 03 00 00 04 00 void Boiler::process_HpHeaterConfig(std::shared_ptr telegram) { has_update(maxHeatComp_, 2); has_update(maxHeatHeat_, 3); diff --git a/src/helpers.cpp b/src/helpers.cpp index 5b4cad590..fd44244a2 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -522,7 +522,7 @@ bool Helpers::hasValue(const uint16_t & value) { } bool Helpers::hasValue(const uint32_t & value) { - return (value != EMS_VALUE_ULONG_NOTSET); + return (value < EMS_VALUE_ULONG_NOTSET); } // checks if we can convert a char string to an int value diff --git a/src/telegram.h b/src/telegram.h index 452edcb8b..1e679c33e 100644 --- a/src/telegram.h +++ b/src/telegram.h @@ -47,6 +47,7 @@ static constexpr int8_t EMS_VALUE_INT_NOTSET = 0x7F; // for signed 8- static constexpr uint16_t EMS_VALUE_USHORT_NOTSET = 0x7D00; // 32000: for 2-byte unsigned shorts static constexpr int16_t EMS_VALUE_SHORT_NOTSET = 0x7D00; // 32000: for 2-byte signed shorts static constexpr uint32_t EMS_VALUE_ULONG_NOTSET = 0x00FFFFFF; // for 3-byte and 4-byte longs +// 4 byte value is 21474836 (0x147AE14), we use only the lower one, see https://github.com/emsesp/EMS-ESP32/issues/820 static constexpr uint8_t EMS_MAX_TELEGRAM_LENGTH = 32; // max length of a complete EMS telegram static constexpr uint8_t EMS_MAX_TELEGRAM_MESSAGE_LENGTH = 27; // max length of message block, assuming EMS1.0