also disable warning light at start
This commit is contained in:
parent
e87012cc9c
commit
27858948e5
@ -97,6 +97,7 @@ enum SensorError {
|
||||
#[derive(Serialize, Deserialize, Copy, Clone, Debug, PartialEq, Default)]
|
||||
struct TankState {
|
||||
enough_water: bool,
|
||||
warn_level: bool,
|
||||
left_ml: u32,
|
||||
sensor_error: bool,
|
||||
raw: u16,
|
||||
@ -156,7 +157,7 @@ fn safe_main() -> anyhow::Result<()> {
|
||||
|
||||
println!("Board hal init");
|
||||
let mut board: std::sync::MutexGuard<'_, PlantCtrlBoard<'_>> = BOARD_ACCESS.lock().unwrap();
|
||||
|
||||
board.general_fault(false);
|
||||
println!("Mounting filesystem");
|
||||
board.mount_file_system()?;
|
||||
let free_space = board.file_system_size()?;
|
||||
@ -337,6 +338,11 @@ fn safe_main() -> anyhow::Result<()> {
|
||||
"/water/enough_water",
|
||||
tank_state.enough_water.to_string().as_bytes(),
|
||||
);
|
||||
let _ = board.mqtt_publish(
|
||||
&config,
|
||||
"/water/low_warning",
|
||||
tank_state.warn_level.to_string().as_bytes(),
|
||||
);
|
||||
let _ =
|
||||
board.mqtt_publish(&config, "/water/raw", tank_state.raw.to_string().as_bytes());
|
||||
}
|
||||
@ -722,6 +728,7 @@ fn determine_tank_state(
|
||||
"Low water, current percent is {}, minimum warn level is {}",
|
||||
percent as u8, config.tank_warn_percent
|
||||
);
|
||||
rv.warn_level = true;
|
||||
}
|
||||
if config.tank_empty_percent < percent as u8 {
|
||||
println!(
|
||||
|
Loading…
Reference in New Issue
Block a user