mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
use r-values hasValue function
This commit is contained in:
@@ -329,27 +329,27 @@ bool Helpers::check_abs(const int32_t i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// for booleans, use isBool true (EMS_VALUE_BOOL)
|
// for booleans, use isBool true (EMS_VALUE_BOOL)
|
||||||
bool Helpers::hasValue(const uint8_t v, const uint8_t isBool) {
|
bool Helpers::hasValue(const uint8_t &v, const uint8_t isBool) {
|
||||||
if (isBool == EMS_VALUE_BOOL) {
|
if (isBool == EMS_VALUE_BOOL) {
|
||||||
return (v != EMS_VALUE_BOOL_NOTSET);
|
return (v != EMS_VALUE_BOOL_NOTSET);
|
||||||
}
|
}
|
||||||
return (v != EMS_VALUE_UINT_NOTSET);
|
return (v != EMS_VALUE_UINT_NOTSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Helpers::hasValue(const int8_t v) {
|
bool Helpers::hasValue(const int8_t &v) {
|
||||||
return (v != EMS_VALUE_INT_NOTSET);
|
return (v != EMS_VALUE_INT_NOTSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
// for short these are typically 0x8300, 0x7D00 and sometimes 0x8000
|
// for short these are typically 0x8300, 0x7D00 and sometimes 0x8000
|
||||||
bool Helpers::hasValue(const int16_t v) {
|
bool Helpers::hasValue(const int16_t &v) {
|
||||||
return (abs(v) < EMS_VALUE_USHORT_NOTSET);
|
return (abs(v) < EMS_VALUE_USHORT_NOTSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Helpers::hasValue(const uint16_t v) {
|
bool Helpers::hasValue(const uint16_t &v) {
|
||||||
return (v < EMS_VALUE_USHORT_NOTSET);
|
return (v < EMS_VALUE_USHORT_NOTSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Helpers::hasValue(const uint32_t v) {
|
bool Helpers::hasValue(const uint32_t &v) {
|
||||||
return (v != EMS_VALUE_ULONG_NOTSET);
|
return (v != EMS_VALUE_ULONG_NOTSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,11 +50,11 @@ class Helpers {
|
|||||||
static char * ultostr(char * ptr, uint32_t value, const uint8_t base);
|
static char * ultostr(char * ptr, uint32_t value, const uint8_t base);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool hasValue(const uint8_t v, const uint8_t isBool = 0);
|
static bool hasValue(const uint8_t &v, const uint8_t isBool = 0);
|
||||||
static bool hasValue(const int8_t v);
|
static bool hasValue(const int8_t &v);
|
||||||
static bool hasValue(const int16_t v);
|
static bool hasValue(const int16_t &v);
|
||||||
static bool hasValue(const uint16_t v);
|
static bool hasValue(const uint16_t &v);
|
||||||
static bool hasValue(const uint32_t v);
|
static bool hasValue(const uint32_t &v);
|
||||||
|
|
||||||
static std::string toLower(std::string const & s);
|
static std::string toLower(std::string const & s);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user