try to workout buttons
This commit is contained in:
@@ -8,7 +8,9 @@ use embassy_futures::select::select6;
|
||||
pub async fn run(mut inputs: Inputs, display: &'static mut PrimaryLcdDisplay<'static>) {
|
||||
let mut state = MainMenu { selected: 0 };
|
||||
|
||||
log::info!("starting navigation");
|
||||
loop {
|
||||
log::info!("await button press");
|
||||
let selection = select6(
|
||||
inputs.up.wait_for_low(),
|
||||
inputs.down.wait_for_low(),
|
||||
@@ -19,13 +21,32 @@ pub async fn run(mut inputs: Inputs, display: &'static mut PrimaryLcdDisplay<'st
|
||||
)
|
||||
.await;
|
||||
|
||||
log::info!("button pressed");
|
||||
let value = match selection {
|
||||
Either6::First(_) => (state.selected.wrapping_sub(1)) % MAX_SELECTED,
|
||||
Either6::Second(_) => (state.selected.wrapping_add(1)) % MAX_SELECTED,
|
||||
_ => continue, // Either6::Third(_) => ,
|
||||
// Either6::Fourth(_) => (),
|
||||
// Either6::Fifth(_) => (),
|
||||
// Either6::Sixth(_) => (),
|
||||
Either6::First(_) => {
|
||||
log::info!("up pressed");
|
||||
(state.selected.wrapping_sub(1)) % MAX_SELECTED
|
||||
}
|
||||
Either6::Second(_) => {
|
||||
log::info!("down pressed");
|
||||
(state.selected.wrapping_add(1)) % MAX_SELECTED
|
||||
}
|
||||
Either6::Third(_) => {
|
||||
log::info!("left pressed");
|
||||
continue;
|
||||
}
|
||||
Either6::Fourth(_) => {
|
||||
log::info!("right pressed");
|
||||
continue;
|
||||
}
|
||||
Either6::Fifth(_) => {
|
||||
log::info!("ok pressed");
|
||||
continue;
|
||||
}
|
||||
Either6::Sixth(_) => {
|
||||
log::info!("back pressed");
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
state.selected = value;
|
||||
|
||||
Reference in New Issue
Block a user