|
|
@ -69,7 +69,7 @@ static void read_time_and_moisture() |
|
|
|
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; |
|
|
|
if (elapsed_days >= app_config.scheduler_dry_days) { |
|
|
|
if (elapsed_days > app_config.scheduler_dry_days) { |
|
|
|
s_app.today_is_watering_day = true; |
|
|
|
s_app.today_is_watering_day = true; |
|
|
|
s_app.last_watering_day_wd = cur_wd; |
|
|
|
s_app.last_watering_day_wd = cur_wd; |
|
|
|
} |
|
|
|
} |
|
|
@ -126,6 +126,11 @@ void gui_loop_iter(GuiEvent message) |
|
|
|
if (app_config.moisture_enable) { |
|
|
|
if (app_config.moisture_enable) { |
|
|
|
if (s_app.moisture_pt > app_config.moisture_threshold_percent) { |
|
|
|
if (s_app.moisture_pt > app_config.moisture_threshold_percent) { |
|
|
|
// watering not needed
|
|
|
|
// watering not needed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Pretend we started the cycle, so we don't get into this loop again and again for the whole minute
|
|
|
|
|
|
|
|
s_app.last_cycle_time.hour = s_app.rtc_time.hour; |
|
|
|
|
|
|
|
s_app.last_cycle_time.minute = s_app.rtc_time.minute; |
|
|
|
|
|
|
|
s_app.cycle_time_checking = false; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|