mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 12:46:34 +00:00
Refactor timer GUI save result enabling rule trigger (#11612)
This commit is contained in:
parent
b6e77cd3d7
commit
ea64f7b9c5
@ -879,14 +879,12 @@ void HandleTimerConfiguration(void)
|
|||||||
|
|
||||||
void TimerSaveSettings(void)
|
void TimerSaveSettings(void)
|
||||||
{
|
{
|
||||||
char tmp[MAX_TIMERS *12]; // Need space for MAX_TIMERS x 10 digit numbers separated by a comma
|
|
||||||
char message[32 + (MAX_TIMERS *11)]; // MQT: Timers 0,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000
|
|
||||||
Timer timer;
|
Timer timer;
|
||||||
|
|
||||||
Settings.flag3.timers_enable = Webserver->hasArg(F("e0")); // CMND_TIMERS
|
Settings.flag3.timers_enable = Webserver->hasArg(F("e0")); // CMND_TIMERS
|
||||||
|
char tmp[MAX_TIMERS *12]; // Need space for MAX_TIMERS x 10 digit numbers separated by a comma
|
||||||
WebGetArg(PSTR("t0"), tmp, sizeof(tmp));
|
WebGetArg(PSTR("t0"), tmp, sizeof(tmp));
|
||||||
char *p = tmp;
|
char *p = tmp;
|
||||||
snprintf_P(message, sizeof(message), PSTR(D_LOG_MQTT D_CMND_TIMERS " %d"), Settings.flag3.timers_enable); // CMND_TIMERS
|
|
||||||
for (uint32_t i = 0; i < MAX_TIMERS; i++) {
|
for (uint32_t i = 0; i < MAX_TIMERS; i++) {
|
||||||
timer.data = strtol(p, &p, 10);
|
timer.data = strtol(p, &p, 10);
|
||||||
p++; // Skip comma
|
p++; // Skip comma
|
||||||
@ -895,9 +893,10 @@ void TimerSaveSettings(void)
|
|||||||
Settings.timer[i].data = timer.data;
|
Settings.timer[i].data = timer.data;
|
||||||
if (flag) TimerSetRandomWindow(i);
|
if (flag) TimerSetRandomWindow(i);
|
||||||
}
|
}
|
||||||
snprintf_P(message, sizeof(message), PSTR("%s,0x%08X"), message, Settings.timer[i].data);
|
|
||||||
}
|
}
|
||||||
AddLogData(LOG_LEVEL_DEBUG, message);
|
char command[CMDSZ];
|
||||||
|
snprintf_P(command, sizeof(command), PSTR(D_CMND_TIMERS));
|
||||||
|
ExecuteWebCommand(command);
|
||||||
}
|
}
|
||||||
#endif // USE_TIMERS_WEB
|
#endif // USE_TIMERS_WEB
|
||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
|
Loading…
x
Reference in New Issue
Block a user