feat: add fertilizer pump functionality with configuration, web UI, and HAL integration
This commit is contained in:
@@ -129,6 +129,7 @@ pub struct PlantConfig {
|
||||
pub min_pump_current_ma: u16,
|
||||
pub max_pump_current_ma: u16,
|
||||
pub ignore_current_error: bool,
|
||||
pub fertilizer_s: u16,
|
||||
}
|
||||
|
||||
impl Default for PlantConfig {
|
||||
@@ -150,6 +151,7 @@ impl Default for PlantConfig {
|
||||
min_pump_current_ma: 10,
|
||||
max_pump_current_ma: 3000,
|
||||
ignore_current_error: true,
|
||||
fertilizer_s: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,6 +715,15 @@ pub async fn do_secure_pump(
|
||||
let mut pump_time_ms: u32 = 0;
|
||||
|
||||
if !dry_run {
|
||||
// Run fertilizer pump first if configured
|
||||
if plant_config.fertilizer_s > 0 {
|
||||
info!("Starting fertilizer pump for {} seconds", plant_config.fertilizer_s);
|
||||
board.board_hal.extra2(true).await?;
|
||||
Timer::after_millis(plant_config.fertilizer_s as u64 * 1000).await;
|
||||
board.board_hal.extra2(false).await?;
|
||||
info!("Fertilizer pump stopped");
|
||||
}
|
||||
|
||||
board.board_hal.get_tank_sensor()?.reset_flow_meter();
|
||||
board.board_hal.get_tank_sensor()?.start_flow_meter();
|
||||
board.board_hal.pump(plant_id, true).await?;
|
||||
|
||||
Reference in New Issue
Block a user