mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
Helpers::hasValue()
This commit is contained in:
@@ -303,5 +303,33 @@ double Helpers::round2(double value) {
|
||||
return (int)(value * 100 + 0.5) / 100.0;
|
||||
}
|
||||
|
||||
bool Helpers::check_abs(const int32_t i) {
|
||||
return ((i < 0 ? -i : i) != 0xFFFFFF);
|
||||
}
|
||||
|
||||
// for booleans, use isBool true
|
||||
bool Helpers::hasValue(const uint8_t v, bool isBool) {
|
||||
if (isBool) {
|
||||
return (v != EMS_VALUE_BOOL_NOTSET);
|
||||
}
|
||||
return (v != EMS_VALUE_UINT_NOTSET);
|
||||
}
|
||||
|
||||
bool Helpers::hasValue(const int8_t v) {
|
||||
return (v != EMS_VALUE_INT_NOTSET);
|
||||
}
|
||||
|
||||
bool Helpers::hasValue(const int16_t v) {
|
||||
return (v != EMS_VALUE_SHORT_NOTSET);
|
||||
}
|
||||
|
||||
bool Helpers::hasValue(const uint16_t v) {
|
||||
return (v != EMS_VALUE_USHORT_NOTSET);
|
||||
}
|
||||
|
||||
bool Helpers::hasValue(const uint32_t v) {
|
||||
return (v != EMS_VALUE_ULONG_NOTSET);
|
||||
}
|
||||
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
Reference in New Issue
Block a user