mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
added const to help remind us of which value is a boolean
This commit is contained in:
@@ -329,7 +329,7 @@ bool Helpers::check_abs(const int32_t i) {
|
|||||||
return ((i < 0 ? -i : i) != 0xFFFFFF);
|
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) {
|
bool Helpers::hasValue(const uint8_t v, bool isBool) {
|
||||||
if (isBool) {
|
if (isBool) {
|
||||||
return (v != EMS_VALUE_BOOL_NOTSET);
|
return (v != EMS_VALUE_BOOL_NOTSET);
|
||||||
|
|||||||
@@ -38,7 +38,8 @@
|
|||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
// default values for null values
|
// 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_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
|
static constexpr uint8_t EMS_VALUE_BOOL_NOTSET = 0xFE; // random number for booleans, that's not 0, 1 or FF
|
||||||
|
|||||||
Reference in New Issue
Block a user