diff options
Diffstat (limited to 'sw/picardy/src/ui.rs')
-rw-r--r-- | sw/picardy/src/ui.rs | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sw/picardy/src/ui.rs b/sw/picardy/src/ui.rs index 1133582..b15a289 100644 --- a/sw/picardy/src/ui.rs +++ b/sw/picardy/src/ui.rs @@ -195,15 +195,16 @@ impl UI { } if button_updates.c { - let (new_ui_sel, new_filter_shift) = match (state.ui_sel, state.filter_shift) { - (UISelection::IFShift, FilterShift::USB) => (UISelection::IFShift, FilterShift::LSB), - (UISelection::IFShift, FilterShift::LSB) => (UISelection::IFShift, FilterShift::USB), - (UISelection::IFShift, FilterShift::Custom(_)) => (UISelection::IFShift, FilterShift::USB), + let (new_ui_sel, new_filter_shift) = match (state.ui_sel, state.mode) { + (UISelection::IFShift, Mode::USB) => (UISelection::IFShift, Mode::LSB), + (UISelection::IFShift, Mode::LSB) => (UISelection::IFShift, Mode::CW), + (UISelection::IFShift, Mode::CW) => (UISelection::IFShift, Mode::USB), + (UISelection::IFShift, Mode::CustomShift(_)) => (UISelection::IFShift, Mode::USB), (_, f) => (UISelection::IFShift, f), }; state.ui_sel = new_ui_sel; - state.filter_shift = new_filter_shift; + state.mode = new_filter_shift; result.display_update = true; } @@ -224,7 +225,7 @@ impl UI { state.rit = 0; }, UISelection::IFShift => { - state.filter_shift = FilterShift::USB; + state.mode = Mode::USB; }, } @@ -254,14 +255,14 @@ impl UI { }, UISelection::IFShift => { let new_bfo = (state.bfo() as i32 + delta * state.bfo_incr()) as u32; - state.filter_shift = FilterShift::Custom(new_bfo); + state.mode = Mode::CustomShift(new_bfo); true }, } } } -pub fn update_disp<T: hd44780_driver::bus::DataBus>(lcd: &mut HD44780<T>, state: &State, delay: &mut Delay, s_meter_value : i32) +pub fn update_disp<T: hd44780_driver::bus::DataBus>(lcd: &mut HD44780<T>, state: &State, delay: &mut Delay, s_meter_value: i32, bfo_tune_fail: bool) { let mut string = arrayvec::ArrayString::<[_; 16]>::new(); @@ -280,7 +281,7 @@ pub fn update_disp<T: hd44780_driver::bus::DataBus>(lcd: &mut HD44780<T>, state: string.clear(); - match (state.bfo_tune_fail, &state.vfo_sel) { + match (bfo_tune_fail, &state.vfo_sel) { (true, _) => write!(string, "VFO!").unwrap(), (false, VFOSelection::A) => write!(string, "VFOa").unwrap(), (false, VFOSelection::B) => write!(string, "VFOb").unwrap(), @@ -290,10 +291,11 @@ pub fn update_disp<T: hd44780_driver::bus::DataBus>(lcd: &mut HD44780<T>, state: write!(string, "{}", if state.ui_sel == UISelection::IFShift { ">" } else { " " }).unwrap(); - let mode = match state.filter_shift { - FilterShift::USB => "USB", - FilterShift::LSB => "LSB", - FilterShift::Custom(_) => "IFs", + let mode = match state.mode { + Mode::USB => "USB", + Mode::LSB => "LSB", + Mode::CustomShift(_) => "IFs", + Mode::CW => "CW ", }; let speed = match state.tune_speed { |