Added some tests, fixed mistakes tests found

This commit is contained in:
2024-09-01 08:53:50 -04:00
parent aa1d4a9371
commit 84a105639c
6 changed files with 526 additions and 49 deletions

View File

@ -27,8 +27,12 @@ impl MotorDriverDebug {
pub async fn run(&self) -> Result<()> {
loop {
let cmd = self.recv_q.recv().await.expect("Unexpected failure in motor driver command queue");
self.handle_cmd(cmd).await.expect("Unexpected failure of motor driver notification queue");
let cmd = self.recv_q.recv()
.await
.expect("Unexpected failure in motor driver command queue");
self.handle_cmd(cmd)
.await
.expect("Unexpected failure of motor driver notification queue");
}
}
@ -41,20 +45,26 @@ impl MotorDriverDebug {
Ok(())
}
pub async fn start_up(&self) -> Result<()> {
async fn start_up(&self) -> Result<()> {
warn!("Starting motor, direction: Up");
Ok(())
}
pub async fn start_down(&self) -> Result<()> {
async fn start_down(&self) -> Result<()> {
warn!("Starting motor, direction: Down");
Ok(())
}
pub async fn stop(&self) -> Result<()> {
async fn stop(&self) -> Result<()> {
warn!("Stopping motor");
Ok(())
}
}
//TODO: we should fix panic to ensure that we shut down motors before rebooting ESP!
// Maybe by getting another endpoint and passing it to the panic handler? Add a different command that doesn't just stop, but stops and stops processing any new commands.
// Maybe by getting another endpoint and passing it to the panic handler? Add a different
// command that doesn't just stop, but stops and stops processing any new commands.
//TODO: Design - are there any implications to the PIC motor driver essentially sending button
// presses instead of commanding the motor on/off? Feedback loops? No way to know without PIC
// code.