Refactor extra1 to fertilizer_pump in HAL and main logic
- Renamed `extra1` method and related calls to `fertilizer_pump` for clarity and better domain alignment. - Updated HAL implementation to control `extra2` GPIO for fertilizer pump operations. - Added build script trigger to refresh `VERGEN_BUILD_TIMESTAMP` on each build.
This commit is contained in:
@@ -49,5 +49,8 @@ fn linker_be_nice() {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
linker_be_nice();
|
linker_be_nice();
|
||||||
|
// Non-existent path causes Cargo to always re-run this script,
|
||||||
|
// keeping VERGEN_BUILD_TIMESTAMP fresh on every build.
|
||||||
|
println!("cargo:rerun-if-changed=ALWAYS_REBUILD_SENTINEL");
|
||||||
let _ = EmitBuilder::builder().all_git().all_build().emit();
|
let _ = EmitBuilder::builder().all_git().all_build().emit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ pub trait BoardInteraction<'a> {
|
|||||||
async fn get_mptt_voltage(&mut self) -> FatResult<Voltage>;
|
async fn get_mptt_voltage(&mut self) -> FatResult<Voltage>;
|
||||||
async fn get_mptt_current(&mut self) -> FatResult<Current>;
|
async fn get_mptt_current(&mut self) -> FatResult<Current>;
|
||||||
async fn can_power(&mut self, state: bool) -> FatResult<()>;
|
async fn can_power(&mut self, state: bool) -> FatResult<()>;
|
||||||
async fn extra1(&mut self, enable: bool) -> FatResult<()>;
|
async fn fertilizer_pump(&mut self, enable: bool) -> FatResult<()>;
|
||||||
|
|
||||||
async fn backup_config(&mut self, config: &PlantControllerConfig) -> FatResult<()>;
|
async fn backup_config(&mut self, config: &PlantControllerConfig) -> FatResult<()>;
|
||||||
async fn read_backup(&mut self) -> FatResult<PlantControllerConfig>;
|
async fn read_backup(&mut self) -> FatResult<PlantControllerConfig>;
|
||||||
|
|||||||
@@ -484,11 +484,11 @@ impl<'a> BoardInteraction<'a> for V4<'a> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn extra1(&mut self, enable: bool) -> FatResult<()> {
|
async fn fertilizer_pump(&mut self, enable: bool) -> FatResult<()> {
|
||||||
if enable {
|
if enable {
|
||||||
self.extra1.set_high();
|
self.extra2.set_high();
|
||||||
} else {
|
} else {
|
||||||
self.extra1.set_low();
|
self.extra2.set_low();
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -733,9 +733,9 @@ pub async fn do_secure_pump(
|
|||||||
&elapsed_minutes.to_string(),
|
&elapsed_minutes.to_string(),
|
||||||
"",
|
"",
|
||||||
);
|
);
|
||||||
board.board_hal.extra1(true).await?;
|
board.board_hal.fertilizer_pump(true).await?;
|
||||||
Timer::after_millis(plant_config.fertilizer_s as u64 * 1000).await;
|
Timer::after_millis(plant_config.fertilizer_s as u64 * 1000).await;
|
||||||
board.board_hal.extra1(false).await?;
|
board.board_hal.fertilizer_pump(false).await?;
|
||||||
info!("Fertilizer pump stopped");
|
info!("Fertilizer pump stopped");
|
||||||
|
|
||||||
// Store the current time as last fertilizer time
|
// Store the current time as last fertilizer time
|
||||||
|
|||||||
@@ -109,9 +109,9 @@ where
|
|||||||
T: Read + Write,
|
T: Read + Write,
|
||||||
{
|
{
|
||||||
let mut board = BOARD_ACCESS.get().await.lock().await;
|
let mut board = BOARD_ACCESS.get().await.lock().await;
|
||||||
board.board_hal.extra1(true).await?;
|
board.board_hal.fertilizer_pump(true).await?;
|
||||||
embassy_time::Timer::after_millis(1000).await;
|
embassy_time::Timer::after_millis(1000).await;
|
||||||
board.board_hal.extra1(false).await?;
|
board.board_hal.fertilizer_pump(false).await?;
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user