aboutsummaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/picardy/src/main.rs40
-rw-r--r--sw/picardy/src/state.rs31
-rw-r--r--sw/picardy/src/ui.rs8
3 files changed, 52 insertions, 27 deletions
diff --git a/sw/picardy/src/main.rs b/sw/picardy/src/main.rs
index b6bf098..2e7d9a1 100644
--- a/sw/picardy/src/main.rs
+++ b/sw/picardy/src/main.rs
@@ -365,25 +365,31 @@ fn TIM2() {
let cw_paddle_tip_low = shared.cw_paddle_tip.is_low().unwrap();
let cw_paddle_ring_low = shared.cw_paddle_ring.is_low().unwrap();
+ if cw_paddle_tip_low || cw_paddle_ring_low {
+ shared.state.send_tone = false;
+ }
+
let cw_ptt_delay : u32 = TICKS_PER_SECOND * 800 / 1000;
- let cw_ptt = match shared.state.mode {
- Mode::CW(_) => {
- if cw_paddle_tip_low || cw_paddle_ring_low {
- shared.cw_ptt_timestamp = *ticks;
- true
- }
- else {
- shared.cw_ptt_timestamp + cw_ptt_delay > *ticks
- }
- },
- _ => false,
- };
+ let cw_ptt = shared.state.send_tone ||
+ match shared.state.mode {
+ Mode::CW(_) => {
+ if cw_paddle_tip_low || cw_paddle_ring_low {
+ shared.cw_ptt_timestamp = *ticks;
+ true
+ }
+ else {
+ shared.cw_ptt_timestamp + cw_ptt_delay > *ticks
+ }
+ },
+ _ => false,
+ };
- let cw_beep = match shared.state.mode {
- Mode::CW(CWMode::StraightKey) => cw_paddle_tip_low,
- Mode::CW(CWMode::Iambic) => shared.cw_keyer.tick(*ticks, cw_paddle_tip_low, cw_paddle_ring_low),
- _ => false,
- };
+ let cw_beep = shared.state.send_tone ||
+ match shared.state.mode {
+ Mode::CW(CWMode::StraightKey) => cw_paddle_tip_low,
+ Mode::CW(CWMode::Iambic) => shared.cw_keyer.tick(*ticks, cw_paddle_tip_low, cw_paddle_ring_low),
+ _ => false,
+ };
let next_state = match shared.state.sequence_state {
SequenceState::Rx => {
diff --git a/sw/picardy/src/state.rs b/sw/picardy/src/state.rs
index 4e6af33..08826e7 100644
--- a/sw/picardy/src/state.rs
+++ b/sw/picardy/src/state.rs
@@ -64,6 +64,7 @@ pub struct State {
pub vfo_sel : VFOSelection,
pub rit : i32,
pub mode : Mode,
+ pub send_tone : bool,
pub sequence_state : SequenceState,
pub update_disp_counter : u8,
pub cw_wpm : u32,
@@ -79,6 +80,7 @@ impl State {
vfo_sel : VFOSelection::A,
rit : 0,
mode : Mode::USB,
+ send_tone : false,
sequence_state : SequenceState::Rx,
update_disp_counter : 0,
cw_wpm : 14,
@@ -86,14 +88,19 @@ impl State {
}
pub fn bfo(&self) -> u32 {
- match self.mode {
- Mode::LSB => BFO_LSB,
- Mode::USB => BFO_USB,
- Mode::CustomShift(fs) => fs,
- Mode::CW(_) => match self.sequence_state {
- SequenceState::SwitchingCW | SequenceState::TxCW => 0,
- _ => BFO_CW,
- },
+ if self.send_tone {
+ 0
+ }
+ else {
+ match self.mode {
+ Mode::LSB => BFO_LSB,
+ Mode::USB => BFO_USB,
+ Mode::CustomShift(fs) => fs,
+ Mode::CW(_) => match self.sequence_state {
+ SequenceState::SwitchingCW | SequenceState::TxCW => 0,
+ _ => BFO_CW,
+ },
+ }
}
}
@@ -109,8 +116,14 @@ impl State {
}
pub fn vfo(&self) -> u32 {
+ let cw_offset = match self.sequence_state {
+ SequenceState::SwitchingCW | SequenceState::TxCW => 500,
+ _ => 0,
+ };
+
let vfo = (self.if_qrg() - self.bfo()) as i32 +
- if self.sequence_state.apply_rit() { self.rit } else { 0 };
+ if self.sequence_state.apply_rit() { self.rit } else { 0 } +
+ cw_offset;
vfo as u32
}
}
diff --git a/sw/picardy/src/ui.rs b/sw/picardy/src/ui.rs
index 728e6e7..ad85a3e 100644
--- a/sw/picardy/src/ui.rs
+++ b/sw/picardy/src/ui.rs
@@ -239,9 +239,11 @@ impl UI {
state.ui_sel = UISelection::VFO;
if button_updates.a {
+ state.send_tone = true;
}
if button_updates.b {
+ state.send_tone = false;
}
if button_updates.c {
@@ -257,6 +259,10 @@ impl UI {
},
}
+ if result.ptt {
+ state.send_tone = false;
+ }
+
result
}
@@ -363,7 +369,7 @@ pub fn update_disp<T: hd44780_driver::bus::DataBus>(lcd: &mut HD44780<T>, state:
write!(string, "{} 1/2", mode).unwrap();
},
MenuPage::Two => {
- write!(string, "---- --- --- 2/2").unwrap();
+ write!(string, "TUT STOP --- 2/2").unwrap();
},
}