document PlantState struct and add TODO notes

This commit is contained in:
ju6ge 2025-02-27 21:30:58 +01:00
parent b2d5cf6416
commit 08ad2f504d
Signed by: judge
GPG Key ID: 6512C30DD8E017B5

View File

@ -71,23 +71,42 @@ struct LightState {
}
#[derive(Debug, PartialEq, Default)]
/// State of a single plant to be tracked
///
/// TODO can some state be replaced with functions
/// TODO unify with PlantStateMQTT
struct PlantState {
/// state of humidity sensor on bank a
a: Option<u8>,
/// raw measured frequency value for sensor on bank a in hertz
a_raw: Option<u32>,
/// state of humidity sensor on bank b
b: Option<u8>,
/// raw measured frequency value for sensor on bank b in hertz
b_raw: Option<u32>,
/// how often has the logic determined that plant should have been irrigated but wasn't
consecutive_pump_count: u32,
after_p: Option<u8>,
/// plant needs to be watered
do_water: bool,
/// is plant considerd to be dry according to settings
dry: bool,
/// is pump currently running
active: bool,
/// TODO: convert this to an Option<PumpErorr> enum for every case that can happen
pump_error: bool,
/// if pump count has increased higher than configured limit
not_effective: bool,
/// plant irrigation cooldown is active
cooldown: bool,
/// we want to irrigate but tank is empty
no_water: bool,
///TODO: combine with field a using Result
sensor_error_a: Option<SensorError>,
///TODO: combine with field b using Result
sensor_error_b: Option<SensorError>,
/// pump should not be watered at this time of day
out_of_work_hour: bool,
/// next time when pump should activate
next_pump: Option<DateTime<Tz>>,
}