More consistent error handling in loops
This commit is contained in:
@ -8,7 +8,7 @@ use closure::closure;
|
||||
use crate::dispatch::{Dispatch, RecvQ, SendQ};
|
||||
use crate::commands::Commands;
|
||||
|
||||
// TODO: test these values to see if they are suitable
|
||||
// TODO HARDWARE: test these values to see if they are suitable
|
||||
const BLE_MIN_INTERVAL: u16 = 24; // x 1.25ms
|
||||
const BLE_MAX_INTERVAL: u16 = 48; // x 1.25ms
|
||||
const BLE_LATENCY: u16 = 0; // Number of packets that can be missed, extending interval
|
||||
@ -106,10 +106,10 @@ impl BleServer {
|
||||
|
||||
loop {
|
||||
debug!("Waiting for updates that should be notified via bluetooth");
|
||||
let cmd = self.recv_q.recv().await?;
|
||||
let cmd =self.recv_q.recv().await.expect("Bluetooth notification queue unexpectedly closed");
|
||||
trace!("Received update to bluetooth variable {:?}", cmd);
|
||||
match cmd {
|
||||
// TODO: This logic (if one button is pressed others are released) could be done in app instead.
|
||||
// TODO DISCUSS: This logic (if one button is pressed others are released) could be done in app instead.
|
||||
Commands::NotifyMotorUp => {
|
||||
button_up.lock().set_value(&BUTTON_PRESSED).notify();
|
||||
button_down.lock().set_value(&BUTTON_RELEASED).notify();
|
||||
|
||||
Reference in New Issue
Block a user