Merge pull request #5547 from Staars/development

always check for vars_events and mems_events
This commit is contained in:
Theo Arends 2019-04-05 13:30:47 +02:00 committed by GitHub
commit 2c227b8f75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 16 deletions

View File

@ -486,23 +486,25 @@ void RulesEvery50ms(void)
event_data[0] ='\0';
}
}
else if (vars_event) {
for (uint8_t i = 0; i < MAX_RULE_VARS-1; i++) {
if (bitRead(vars_event, i)) {
bitClear(vars_event, i);
snprintf_P(json_event, sizeof(json_event), PSTR("{\"Var%d\":{\"State\":%s}}"), i+1, vars[i]);
RulesProcessEvent(json_event);
break;
else if (vars_event || mems_event){
if (vars_event) {
for (uint8_t i = 0; i < MAX_RULE_VARS-1; i++) {
if (bitRead(vars_event, i)) {
bitClear(vars_event, i);
snprintf_P(json_event, sizeof(json_event), PSTR("{\"Var%d\":{\"State\":%s}}"), i+1, vars[i]);
RulesProcessEvent(json_event);
break;
}
}
}
}
else if (mems_event) {
for (uint8_t i = 0; i < MAX_RULE_MEMS-1; i++) {
if (bitRead(mems_event, i)) {
bitClear(mems_event, i);
snprintf_P(json_event, sizeof(json_event), PSTR("{\"Mem%d\":{\"State\":%s}}"), i+1, Settings.mems[i]);
RulesProcessEvent(json_event);
break;
if (mems_event) {
for (uint8_t i = 0; i < MAX_RULE_MEMS-1; i++) {
if (bitRead(mems_event, i)) {
bitClear(mems_event, i);
snprintf_P(json_event, sizeof(json_event), PSTR("{\"Mem%d\":{\"State\":%s}}"), i+1, Settings.mems[i]);
RulesProcessEvent(json_event);
break;
}
}
}
}
@ -1275,4 +1277,4 @@ bool Xdrv10(uint8_t function)
return result;
}
#endif // USE_RULES
#endif // USE_RULES