mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-25 07:17:16 +00:00
fix %timerx% variable for negative values
This commit is contained in:
parent
1b04a00488
commit
0c5f67709a
@ -477,7 +477,11 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule, bool stop_all
|
|||||||
if ((index > 0) && (index <= MAX_TIMERS)) {
|
if ((index > 0) && (index <= MAX_TIMERS)) {
|
||||||
snprintf_P(stemp, sizeof(stemp), PSTR("%%TIMER%d%%"), index);
|
snprintf_P(stemp, sizeof(stemp), PSTR("%%TIMER%d%%"), index);
|
||||||
if (rule_param.startsWith(stemp)) {
|
if (rule_param.startsWith(stemp)) {
|
||||||
rule_param = String(Settings->timer[index -1].time);
|
int32_t timer = Settings->timer[index -1].time;
|
||||||
|
if (Settings->timer[index -1].mode && (timer >= 12*60)) {
|
||||||
|
timer = -(timer - (12*60));
|
||||||
|
}
|
||||||
|
rule_param = String(timer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -796,7 +800,11 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved)
|
|||||||
#if defined(USE_TIMERS)
|
#if defined(USE_TIMERS)
|
||||||
for (uint32_t i = 0; i < MAX_TIMERS; i++) {
|
for (uint32_t i = 0; i < MAX_TIMERS; i++) {
|
||||||
snprintf_P(stemp, sizeof(stemp), PSTR("%%TIMER%d%%"), i +1);
|
snprintf_P(stemp, sizeof(stemp), PSTR("%%TIMER%d%%"), i +1);
|
||||||
RulesVarReplace(commands, stemp, String(Settings->timer[i].time));
|
int32_t timer = Settings->timer[i].time;
|
||||||
|
if (Settings->timer[i].mode && (timer >= 12*60)) {
|
||||||
|
timer = -(timer - 12*60);
|
||||||
|
}
|
||||||
|
RulesVarReplace(commands, stemp, String(timer));
|
||||||
}
|
}
|
||||||
#if defined(USE_SUNRISE)
|
#if defined(USE_SUNRISE)
|
||||||
RulesVarReplace(commands, F("%SUNRISE%"), String(SunMinutes(0)));
|
RulesVarReplace(commands, F("%SUNRISE%"), String(SunMinutes(0)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user