ha optimistic, cs6800 changes, custom entity hide

This commit is contained in:
MichaelDvP
2025-05-10 13:38:19 +02:00
parent dc1094b6ba
commit b3320c3e48
26 changed files with 320 additions and 166 deletions

View File

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