Iambic B fixed

This commit is contained in:
Martin Brodbeck 2024-02-16 20:05:03 +01:00
parent e99c590cda
commit 9a07c24d8f
2 changed files with 6 additions and 10 deletions

View file

@ -80,18 +80,17 @@ void Keyer::run()
if (!m_currentlyKeying)
{
m_currentlyKeying = true;
m_bothPaddlesPressed = (left_paddle_pressed() && right_paddle_pressed()) ? true : false;
m_keying_until = make_timeout_time_us(m_elementDuration);
gpio_put(LED_PIN, 1);
m_Sidetone.on(SIDETONE_FREQ);
}
else
{
// If both paddles are released during this dit -> note for Iambic B
if (m_bothPaddlesPressed && !right_paddle_pressed() && !left_paddle_pressed() && !m_keyNextIambicB)
// If right paddle üressed -> note for Iambic B
if (right_paddle_pressed() && !m_keyNextIambicB)
{
printf("Iambic B -> lang\n");
m_keyNextIambicB = true;
m_bothPaddlesPressed = false;
}
if (absolute_time_diff_us(timestamp, m_keying_until) <= 0)
@ -108,18 +107,17 @@ void Keyer::run()
if (!m_currentlyKeying)
{
m_currentlyKeying = true;
m_bothPaddlesPressed = (left_paddle_pressed() && right_paddle_pressed()) ? true : false;
m_keying_until = make_timeout_time_us(m_elementDuration * 3);
gpio_put(LED_PIN, 1);
m_Sidetone.on(SIDETONE_FREQ);
}
else
{
// If both paddles are released during this dah -> note for Iambic B
if (m_bothPaddlesPressed && !right_paddle_pressed() && !left_paddle_pressed() && !m_keyNextIambicB)
// If left paddle pressed -> Note for Iambic B
if (left_paddle_pressed() && !m_keyNextIambicB)
{
printf("Iambic B -> kurz\n");
m_keyNextIambicB = true;
m_bothPaddlesPressed = false;
}
if (absolute_time_diff_us(timestamp, m_keying_until) <= 0)
@ -196,7 +194,6 @@ void Keyer::run()
m_keyNextIambicB = false;
m_currentlyPausing = false;
m_currentlyKeying = false;
m_bothPaddlesPressed = false;
m_previousState = State::Abort;
m_state = State::Wait;
break;

View file

@ -43,7 +43,6 @@ private:
bool m_currentlyKeying{false};
bool m_currentlyPausing{false};
bool m_keyNextIambicB{false};
bool m_bothPaddlesPressed{false};
};
#endif