mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 16:59:50 +03:00
masked enums with single mask, update seltemp in advance
This commit is contained in:
@@ -197,16 +197,17 @@ class EMSdevice {
|
||||
}
|
||||
}
|
||||
|
||||
void has_enumupdate(std::shared_ptr<const Telegram> telegram,
|
||||
uint8_t & value,
|
||||
const uint8_t index,
|
||||
const std::vector<uint8_t> & maskIn,
|
||||
const std::vector<uint8_t> & maskOut) {
|
||||
void has_enumupdate(std::shared_ptr<const Telegram> telegram, uint8_t & value, const uint8_t index, const std::vector<uint8_t> & maskIn) {
|
||||
uint8_t val = value < maskIn.size() ? maskIn[value] : EMS_VALUE_UINT8_NOTSET;
|
||||
if (telegram->read_value(val, index)) {
|
||||
value = val < maskOut.size() ? maskOut[val] : EMS_VALUE_UINT8_NOTSET;
|
||||
has_update_ = true;
|
||||
publish_value((void *)&value);
|
||||
for (uint8_t i = 0; i < maskIn.size(); i++) {
|
||||
if (val == maskIn[i]) {
|
||||
value = i;
|
||||
has_update_ = true;
|
||||
publish_value((void *)&value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user