Helpers::hasValue()

This commit is contained in:
proddy
2020-06-16 14:49:58 +02:00
parent 257bcd3685
commit d742f16ba4
6 changed files with 158 additions and 124 deletions

View File

@@ -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