pub trait MineralInjectionTrait {
// Required method
fn inject_mineral(
&mut self,
balling_channels: &mut BallingChannels,
mineral_pump: AquariumDevice,
dosing_duration_millis: u32,
) -> (bool, u32);
}Expand description
Trait for the execution of the Balling mineral dosing. This trait allows running the main control with a mock implementation for testing.
Required Methods§
Sourcefn inject_mineral(
&mut self,
balling_channels: &mut BallingChannels,
mineral_pump: AquariumDevice,
dosing_duration_millis: u32,
) -> (bool, u32)
fn inject_mineral( &mut self, balling_channels: &mut BallingChannels, mineral_pump: AquariumDevice, dosing_duration_millis: u32, ) -> (bool, u32)
Actuates a specific peristaltic pump to inject a mineral solution into the main tank for a defined duration.
This method controls the selected mineral_pump by sending SwitchOn and SwitchOff commands
to the relay manager. It runs the pump for the dosing_duration_millis or until a
Quit command is received from the signal handler, allowing for early termination.
§Arguments
balling_channels- A mutable reference to theBallingChannelsstruct.mineral_pump- TheAquariumDeviceenum variant identifying which peristaltic pump to actuate.dosing_duration_millis- The target duration (in milliseconds) for which the pump should run.
§Returns
A tuple (bool, u32):
- The
boolistrueif aQuitcommand was received from the signal handler during injection, indicating that the operation was interrupted. It’sfalseotherwise. - The
u32is the actual duration (in milliseconds) the pump ran before stopping or being interrupted.