Iambic B mode (hopefully) corrected.

This commit is contained in:
Martin Brodbeck 2024-02-13 10:46:11 +01:00
parent 0d4131653e
commit 0d091aee62

View file

@ -49,6 +49,8 @@ void Keyer::run()
case State::Wait: case State::Wait:
if (left_paddle_pressed() && right_paddle_pressed()) if (left_paddle_pressed() && right_paddle_pressed())
{ {
m_keyNextIambicB = false;
if (m_previousState == State::Dit) if (m_previousState == State::Dit)
{ {
state = State::Dah; state = State::Dah;
@ -57,16 +59,29 @@ void Keyer::run()
{ {
state = State::Dit; state = State::Dit;
} }
break;
} }
if (left_paddle_pressed()) else if (left_paddle_pressed())
{ {
m_keyNextIambicB = false;
state = State::Dit; state = State::Dit;
} }
else if (right_paddle_pressed()) else if (right_paddle_pressed())
{ {
m_keyNextIambicB = false;
state = State::Dah; state = State::Dah;
} }
else
{
if (m_mode == Mode::IAMBIC_B && m_keyNextIambicB)
{
if (m_previousState == State::Dit)
state = State::Dah;
else
state = State::Dit;
m_keyNextIambicB = false;
}
}
break; break;
case State::Dit: case State::Dit:
if (!m_currentlyKeying) if (!m_currentlyKeying)
@ -124,18 +139,6 @@ void Keyer::run()
if (absolute_time_diff_us(timestamp, m_pausing_until) <= 0) if (absolute_time_diff_us(timestamp, m_pausing_until) <= 0)
{ {
m_currentlyPausing = false; m_currentlyPausing = false;
if (m_mode == Mode::IAMBIC_B && m_keyNextIambicB)
{
if (m_previousState == State::Dit)
state = State::Dah;
else
state = State::Dit;
m_keyNextIambicB = false;
break;
}
state = State::Wait; state = State::Wait;
} }