blbuvzdor 2 - exit manual mode after 1 hour

v2
Ondřej Hruška 5 months ago
parent 76b2da8ed3
commit e58dafad2b
  1. 8
      src/screens/app_gui.c
  2. 2
      src/screens/app_gui.h

@ -65,6 +65,7 @@ static void read_time_and_moisture()
} else { } else {
uint8_t cur_wd = s_app.rtc_time.weekday; uint8_t cur_wd = s_app.rtc_time.weekday;
if (cur_wd != prev_wd) { if (cur_wd != prev_wd) {
// Weekday change, decide now
s_app.today_is_watering_day = false; s_app.today_is_watering_day = false;
uint8_t now_normalized = cur_wd + (cur_wd < s_app.last_watering_day_wd ? 7 : 0); uint8_t now_normalized = cur_wd + (cur_wd < s_app.last_watering_day_wd ? 7 : 0);
uint8_t elapsed_days = now_normalized - s_app.last_watering_day_wd; uint8_t elapsed_days = now_normalized - s_app.last_watering_day_wd;
@ -143,6 +144,13 @@ void gui_loop_iter(GuiEvent message)
} }
} }
// exit manual mode after long time
if (s_app.screen == screen_manual_control) {
if ((tickNow - s_app.screen_open_time) >= (3600 * 1000)) {
switch_screen(screen_home, true);
}
}
// Read RTC every second // Read RTC every second
if (tickNow - s_app.last_1s_time >= 1000) { if (tickNow - s_app.last_1s_time >= 1000) {
s_app.screen(GUI_EVENT_SCREEN_TICK_1S); s_app.screen(GUI_EVENT_SCREEN_TICK_1S);

@ -79,7 +79,7 @@ struct State {
uint16_t moisture_raw; uint16_t moisture_raw;
uint16_t moisture_pt; uint16_t moisture_pt;
struct rtc_time last_cycle_time; struct rtc_time last_cycle_time;
bool cycle_time_checking; bool cycle_time_checking; // TODO unclear what this does???
/// Repaint was requested from the screen code /// Repaint was requested from the screen code
bool paint_needed; bool paint_needed;

Loading…
Cancel
Save