From 5f28d755416a8fe98a0120ee3ea92efeeb10a878 Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 21 Jul 2020 14:34:08 +0200 Subject: [PATCH] added const to help remind us of which value is a boolean --- src/helpers.cpp | 2 +- src/telegram.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/helpers.cpp b/src/helpers.cpp index f3a15a9ab..5cdde4c60 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -329,7 +329,7 @@ bool Helpers::check_abs(const int32_t i) { return ((i < 0 ? -i : i) != 0xFFFFFF); } -// for booleans, use isBool true +// for booleans, use isBool true (VALUE_BOOL) bool Helpers::hasValue(const uint8_t v, bool isBool) { if (isBool) { return (v != EMS_VALUE_BOOL_NOTSET); diff --git a/src/telegram.h b/src/telegram.h index b62c5df09..c7a696612 100644 --- a/src/telegram.h +++ b/src/telegram.h @@ -38,7 +38,8 @@ #include "helpers.h" // default values for null values -static constexpr uint8_t EMS_VALUE_BOOL = 0xFF; // boolean +static constexpr uint8_t VALUE_BOOL = true; // is a boolean +static constexpr uint8_t EMS_VALUE_BOOL = 0xFF; // is a boolean static constexpr uint8_t EMS_VALUE_BOOL_OFF = 0x00; // boolean false. True can be 0x01 or 0xFF sometimes. static constexpr uint8_t EMS_VALUE_BOOL_NOTSET = 0xFE; // random number for booleans, that's not 0, 1 or FF