fix tread safty issues by annotating Box Traits correctly

This commit is contained in:
2025-06-19 18:36:48 +02:00
parent e2cbf9618e
commit 69077239a5
5 changed files with 16 additions and 16 deletions

View File

@@ -75,7 +75,7 @@ const FAULT_2: usize = 23;
pub struct V3<'a> {
config: PlantControllerConfig,
battery_monitor: Box<dyn BatteryInteraction>,
battery_monitor: Box<dyn BatteryInteraction + Send>,
esp: ESP<'a>,
shift_register: ShiftRegister40<
PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>,
@@ -106,8 +106,8 @@ pub(crate) fn create_v3(
peripherals: FreePeripherals,
esp: ESP<'static>,
config: PlantControllerConfig,
battery_monitor: Box<dyn BatteryInteraction>,
) -> Result<Box<dyn BoardInteraction + '_ + Send + Sync>> {
battery_monitor: Box<dyn BatteryInteraction + Send>,
) -> Result<Box<dyn BoardInteraction + Send + '_>> {
let mut clock = PinDriver::input_output(peripherals.gpio15.downgrade())?;
clock.set_pull(Pull::Floating)?;
let mut latch = PinDriver::input_output(peripherals.gpio3.downgrade())?;
@@ -255,7 +255,7 @@ impl<'a> BoardInteraction<'a> for V3<'a> {
&self.config
}
fn get_battery_monitor(&mut self) -> &mut Box<(dyn BatteryInteraction + 'static)> {
fn get_battery_monitor(&mut self) -> &mut Box<(dyn BatteryInteraction + Send + 'static)> {
&mut self.battery_monitor
}