wip min
This commit is contained in:
@@ -78,6 +78,7 @@ impl PumpState {
|
||||
pub enum PlantWateringMode {
|
||||
OFF,
|
||||
TargetMoisture,
|
||||
MinMoisture,
|
||||
TimerOnly,
|
||||
}
|
||||
|
||||
@@ -235,6 +236,30 @@ impl PlantState {
|
||||
false
|
||||
}
|
||||
}
|
||||
PlantWateringMode::MinMoisture => {
|
||||
let (moisture_percent, _) = self.plant_moisture();
|
||||
if let Some(moisture_percent) = moisture_percent {
|
||||
if self.pump_in_timeout(plant_conf, current_time) {
|
||||
false
|
||||
} else if !in_time_range(
|
||||
current_time,
|
||||
plant_conf.pump_hour_start,
|
||||
plant_conf.pump_hour_end,
|
||||
) {
|
||||
false
|
||||
} else if (true) {
|
||||
//if not cooldown min and below max
|
||||
true
|
||||
} else if (true) {
|
||||
//if below min disable cooldown min
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
PlantWateringMode::TimerOnly => !self.pump_in_timeout(plant_conf, current_time),
|
||||
}
|
||||
}
|
||||
@@ -268,7 +293,9 @@ impl PlantState {
|
||||
.map(|t| t.with_timezone(¤t_time.timezone())),
|
||||
next_pump: if matches!(
|
||||
plant_conf.mode,
|
||||
PlantWateringMode::TimerOnly | PlantWateringMode::TargetMoisture
|
||||
PlantWateringMode::TimerOnly
|
||||
| PlantWateringMode::TargetMoisture
|
||||
| PlantWateringMode::MinMoisture
|
||||
) {
|
||||
self.pump.previous_pump.and_then(|last_pump| {
|
||||
last_pump
|
||||
|
||||
Reference in New Issue
Block a user