suggestion for logging location
This commit is contained in:
parent
267578ef0b
commit
3a702cb84f
@ -401,6 +401,30 @@ fn safe_main() -> anyhow::Result<()> {
|
||||
let dry_run = false;
|
||||
|
||||
let tank_state = determine_tank_state(&mut board, &config);
|
||||
if let Some(_err) = tank_state.got_error(&config.tank) {
|
||||
//TODO log error state to serial
|
||||
} else if tank_state.warn_level(&config.tank).is_ok_and(|warn| warn) {
|
||||
//TODO(judge) enable logging again, might require returning level as well
|
||||
//println!(
|
||||
//"Low water, current percent is {}, minimum warn level is {}",
|
||||
//percent as u8, config.tank.tank_warn_percent
|
||||
//);
|
||||
board.general_fault(true);
|
||||
} else if tank_state.enough_water(&config.tank).is_ok_and(|enough| enough) {
|
||||
//TODO(judge) enable logging again, might require returning level as well
|
||||
//println!(
|
||||
//"Enough water, current percent is {}, minimum empty level is {}",
|
||||
//percent as u8, config.tank.tank_empty_percent
|
||||
//);
|
||||
} else {
|
||||
if let Ok(_left_ml) = tank_state.left_ml(&config.tank) {
|
||||
//TODO(judge) enable logging again, might require returning level as well
|
||||
//println!(
|
||||
//"Tank sensor returned mv {} as {}% leaving {} ml useable",
|
||||
//rv.raw, percent as u8, rv.left_ml
|
||||
//);
|
||||
}
|
||||
}
|
||||
let mut water_frozen = false;
|
||||
|
||||
let mut attempt = 1;
|
||||
|
@ -98,13 +98,6 @@ impl TankState {
|
||||
TankState::TankSensorPresent(raw_value_mv) => {
|
||||
let tank_fill_percent = raw_voltage_to_tank_fill_percent(*raw_value_mv, config)?;
|
||||
if tank_fill_percent < config.tank_warn_percent.into() {
|
||||
//TODO(judge) move logging to more sensible place
|
||||
//println!(
|
||||
//"Low water, current percent is {}, minimum warn level is {}",
|
||||
//percent as u8, config.tank.tank_warn_percent
|
||||
//);
|
||||
// TODO(judge) move board fault setting
|
||||
// board.general_fault(true);
|
||||
Ok(true)
|
||||
} else {
|
||||
Ok(false)
|
||||
|
Loading…
x
Reference in New Issue
Block a user