mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
ha optimistic, cs6800 changes, custom entity hide
This commit is contained in:
@@ -627,10 +627,18 @@ bool Helpers::value2enum(const char * value, uint8_t & value_ui, const char * co
|
||||
}
|
||||
}
|
||||
value_ui = 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Helpers::value2enum(const char * value, uint8_t & value_ui, const char * const ** strs, const std::vector<uint8_t> & mask) {
|
||||
uint8_t v = value_ui;
|
||||
if (!value2enum(value, v, strs) || v >= mask.size()) {
|
||||
return false;
|
||||
}
|
||||
value_ui = mask[v];
|
||||
return true;
|
||||
}
|
||||
|
||||
// finds the string (value) of a list vector (strs)
|
||||
// returns true if found, and sets the value_ui to the index, else false
|
||||
// also allow true/false for on/off
|
||||
@@ -658,6 +666,15 @@ bool Helpers::value2enum(const char * value, uint8_t & value_ui, const char * co
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Helpers::value2enum(const char * value, uint8_t & value_ui, const char * const * strs, const std::vector<uint8_t> & mask) {
|
||||
uint8_t v = value_ui;
|
||||
if (!value2enum(value, v, strs) || v >= mask.size()) {
|
||||
return false;
|
||||
}
|
||||
value_ui = mask[v];
|
||||
return true;
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/313970/how-to-convert-stdstring-to-lower-case
|
||||
std::string Helpers::toLower(std::string const & s) {
|
||||
std::string lc = s;
|
||||
|
||||
Reference in New Issue
Block a user