allow startup with initial board mode and nearly no pin configs

This commit is contained in:
2025-06-11 22:08:59 +02:00
parent a9d7936376
commit 6499b18ada
8 changed files with 627 additions and 469 deletions

View File

@@ -1,7 +1,7 @@
use serde::Serialize;
use crate::config::TankConfig;
use crate::plant_hal::{BoardInteraction, HAL};
use crate::config::{PlantControllerConfig, TankConfig};
const OPEN_TANK_VOLTAGE: f32 = 3.0;
pub const WATER_FROZEN_THRESH: f32 = 4.0;
@@ -156,10 +156,9 @@ impl TankState {
}
pub fn determine_tank_state(
board: &mut std::sync::MutexGuard<'_, HAL<'_>>,
config: &PlantControllerConfig,
board: &mut std::sync::MutexGuard<'_, HAL<'_>>
) -> TankState {
if config.tank.tank_sensor_enabled {
if board.config.tank.tank_sensor_enabled {
match board.tank_sensor_voltage() {
Ok(raw_sensor_value_mv) => TankState::Present(raw_sensor_value_mv),
Err(err) => TankState::Error(TankError::BoardError(err.to_string())),