after pump fast restart cycle

This commit is contained in:
Empire 2024-02-24 16:25:56 +01:00
parent bfee21796a
commit 5be6197f8c

View File

@ -361,7 +361,7 @@ fn safe_main() -> anyhow::Result<()> {
let _webserver = httpd(reboot_now.clone());
wait_infinity(WaitType::StayAlive, reboot_now.clone());
}
let mut did_pump = false;
match plant_to_pump {
Some(plant) => {
let mut state = plantstate[plant];
@ -385,7 +385,7 @@ fn safe_main() -> anyhow::Result<()> {
"Trying to pump for {}s with pump {} now",
plant_config.pump_time_s, plant
);
did_pump = true;
board.any_pump(true)?;
board.store_last_pump_time(plant, cur);
board.pump(plant, true)?;
@ -512,14 +512,25 @@ fn safe_main() -> anyhow::Result<()> {
}
12 * 60
} else if is_day {
if online_mode == OnlineMode::Online {
let _ = board.mqtt_publish(
&config,
"/deepsleep",
"Entering normal mode 20m deep sleep".as_bytes(),
);
if did_pump {
if online_mode == OnlineMode::Online {
let _ = board.mqtt_publish(
&config,
"/deepsleep",
"Entering after pump restart deep sleep".as_bytes(),
);
}
0
} else {
if online_mode == OnlineMode::Online {
let _ = board.mqtt_publish(
&config,
"/deepsleep",
"Entering normal mode 20m deep sleep".as_bytes(),
);
}
20
}
20
} else {
if online_mode == OnlineMode::Online {
let _ = board.mqtt_publish(