bugfix in submode check logic

This commit is contained in:
Robin Müller 2023-03-07 16:29:10 +01:00
parent 4c48668125
commit af58c414fc
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -25,13 +25,18 @@ ReturnValue_t SubsystemBase::checkStateAgainstTable(HybridIterator<ModeListEntry
std::map<object_id_t, ChildInfo>::iterator childIter; std::map<object_id_t, ChildInfo>::iterator childIter;
auto checkSubmode = [&]() { auto checkSubmode = [&]() {
uint8_t mask;
bool submodesAllowedMask = tableIter.value->submodesAllowed(&mask);
uint8_t submodeToCheckAgainst = tableIter.value->getSubmode();
if (tableIter.value->inheritSubmode()) { if (tableIter.value->inheritSubmode()) {
if (childIter->second.submode != targetSubmode) { submodeToCheckAgainst = targetSubmode;
}
if (not submodesAllowedMask) {
if (childIter->second.submode != submodeToCheckAgainst) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
} }
uint8_t mask; if (submodesAllowedMask) {
if (tableIter.value->submodesAllowed(&mask)) {
if ((childIter->second.submode | mask) != mask) { if ((childIter->second.submode | mask) != mask) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }