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,6 +512,16 @@ fn safe_main() -> anyhow::Result<()> {
} }
12 * 60 12 * 60
} else if is_day { } else if is_day {
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 { if online_mode == OnlineMode::Online {
let _ = board.mqtt_publish( let _ = board.mqtt_publish(
&config, &config,
@ -520,6 +530,7 @@ fn safe_main() -> anyhow::Result<()> {
); );
} }
20 20
}
} else { } else {
if online_mode == OnlineMode::Online { if online_mode == OnlineMode::Online {
let _ = board.mqtt_publish( let _ = board.mqtt_publish(