diff --git a/gem-remotes-lib/src/fake_pic.rs b/gem-remotes-lib/src/fake_pic.rs index 433e4a7..86e35cd 100644 --- a/gem-remotes-lib/src/fake_pic.rs +++ b/gem-remotes-lib/src/fake_pic.rs @@ -115,8 +115,10 @@ impl FakePic { else { info!("Starting motors moving up!"); self.motor_state.update_status(MotorStatus::GoingUp); - self.send_q.send(Commands::ButtonTimerRestart).await?; self.send_q.send(Commands::BluetoothStatusMotor{ data: self.motor_state }).await?; + if self.status_state.intersection(Statuses::AUTO).is_empty() { + self.send_q.send(Commands::ButtonTimerRestart).await?; + } } Ok(()) } @@ -136,15 +138,17 @@ impl FakePic { else { info!("Starting motors moving down!"); self.motor_state.update_status(MotorStatus::GoingDown); - self.send_q.send(Commands::ButtonTimerRestart).await?; self.send_q.send(Commands::BluetoothStatusMotor{ data: self.motor_state }).await?; + if self.status_state.intersection(Statuses::AUTO).is_empty() { + self.send_q.send(Commands::ButtonTimerRestart).await?; + } } Ok(()) } pub async fn press_stop(&mut self) -> Result<()> { self.motor_state.stop(); self.send_q.send(Commands::BluetoothStatusMotor { data: self.motor_state }).await?; - //self.send_q.send(Commands::ButtonTimerClear).await?; // Stop waiting on button timeouts + info!("Stopping motors"); Ok(()) } pub async fn toggle_panic(&mut self) -> Result<()> { @@ -224,14 +228,14 @@ impl FakePic { Commands::BluetoothUp { data } => { if data.is_pressed() { self.press_up().await?; - } else { - self.press_stop().await?; // Releasing up is equivalent to stop + } else if self.status_state.intersection(Statuses::AUTO).is_empty() { + self.press_stop().await?; // Releasing up is equivalent to stop, if not in auto } } Commands::BluetoothDown { data } => { if data.is_pressed() { self.press_down().await?; - } else { + } else if self.status_state.intersection(Statuses::AUTO).is_empty(){ self.press_stop().await?; // Releasing down is equivalent to stop } }