Initialize motor, limit, status states
This commit is contained in:
@ -72,6 +72,7 @@ async fn main_loop() -> Result<()> {
|
|||||||
|
|
||||||
// Setup of various drivers that need to out-live the executor
|
// Setup of various drivers that need to out-live the executor
|
||||||
let mut f_pic = FakePic::with_defaults(&mut dp);
|
let mut f_pic = FakePic::with_defaults(&mut dp);
|
||||||
|
f_pic.sync_pic().await?;
|
||||||
// Setup callback timers
|
// Setup callback timers
|
||||||
let mut button_timer = MessageTimer::<Commands, Commands>::new_on_dispatch(
|
let mut button_timer = MessageTimer::<Commands, Commands>::new_on_dispatch(
|
||||||
Commands::ButtonTimerRestart,
|
Commands::ButtonTimerRestart,
|
||||||
|
|||||||
@ -71,6 +71,15 @@ impl FakePic {
|
|||||||
recv_q: dp.get_callback_channel(&cmd_filter),
|
recv_q: dp.get_callback_channel(&cmd_filter),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// === Sync with the pic controller =========================================================
|
||||||
|
// Since we don't have a pic controller, just update the bluetooth with the internal state
|
||||||
|
// of the fake controller.
|
||||||
|
pub async fn sync_pic(&mut self) -> Result<()> {
|
||||||
|
self.send_q.send(Commands::BluetoothStatusMotor { data: self.motor_state }).await?;
|
||||||
|
self.send_q.send(Commands::BluetoothStatusLimits { data: self.limit_state }).await?;
|
||||||
|
self.send_q.send(Commands::BluetoothStatusStatus { data: self.status_state }).await?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
// === Change Fake Hardware Parameters ======================================================
|
// === Change Fake Hardware Parameters ======================================================
|
||||||
pub fn change_limits(&mut self, l: Limits) -> () {
|
pub fn change_limits(&mut self, l: Limits) -> () {
|
||||||
self.limit_state = l;
|
self.limit_state = l;
|
||||||
|
|||||||
Reference in New Issue
Block a user