WIP refactor plant_state
This commit is contained in:
@@ -2,6 +2,7 @@ use std::str::FromStr;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::plant_state::PlantWateringMode;
|
||||
use crate::PLANT_COUNT;
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||
@@ -83,8 +84,8 @@ pub struct PlantControllerConfig {
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||
#[serde(default)]
|
||||
pub struct PlantConfig {
|
||||
pub mode: Mode,
|
||||
pub target_moisture: u8,
|
||||
pub mode: PlantWateringMode,
|
||||
pub target_moisture: f32,
|
||||
pub pump_time_s: u16,
|
||||
pub pump_cooldown_min: u16,
|
||||
pub pump_hour_start: u8,
|
||||
@@ -96,8 +97,8 @@ pub struct PlantConfig {
|
||||
impl Default for PlantConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
mode: Mode::OFF,
|
||||
target_moisture: 40,
|
||||
mode: PlantWateringMode::OFF,
|
||||
target_moisture: 40.,
|
||||
pump_time_s: 30,
|
||||
pump_cooldown_min: 60,
|
||||
pump_hour_start: 9,
|
||||
@@ -108,11 +109,3 @@ impl Default for PlantConfig {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||
pub enum Mode {
|
||||
OFF,
|
||||
TargetMoisture,
|
||||
TimerOnly,
|
||||
TimerAndDeadzone,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user