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