mirror of
https://github.com/xoseperez/espurna.git
synced 2026-03-03 15:04:17 +01:00
Restore was unintentionally broken after switching from per-relay to per-schedule setting. Instead of using schedules count it used the number of relays (or curtains), and never light channels. Instead, loop over available schedules and check the 'restore' flag, calling the action when the schedule was supposed to be active. Similar to the old approach, check for the most recent action and call it (also, discarding the same type & target pairs, to avoid scheduling conflicting actions) time_t seconds offset is refactored into tm.tm_mday offset. this causes the function to only work with local time, however it *should* correctly offset day-by-day in case it somehow stumbles upon dst transition For settings: - schSwitch renamed into schTarget - schTarget default is no longer 0xff, but 0 - schType is a mandatory setting, instead of 1 (switch) default to 0 (none) - move getSetting into functions to reduce code size - delSetting case moved into the initial block that runs before restore() and check() Plus, refactor C-style naming into namespaces similar to the other modules