getting rid of symbol type

This commit is contained in:
Martin Brodbeck 2024-02-13 09:03:14 +01:00
parent 7e26ea2c06
commit 6970ca8182
2 changed files with 2 additions and 10 deletions

View file

@ -49,11 +49,11 @@ void Keyer::run()
case State::Wait: case State::Wait:
if (left_paddle_pressed() && right_paddle_pressed()) if (left_paddle_pressed() && right_paddle_pressed())
{ {
if (m_lastSymbolWas == Symbol::Dit) if (m_previousState == State::Dit)
{ {
state = State::Dah; state = State::Dah;
} }
else if (m_lastSymbolWas == Symbol::Dah) else if (m_previousState == State::Dah)
{ {
state = State::Dit; state = State::Dit;
} }
@ -75,7 +75,6 @@ void Keyer::run()
m_keying_until = make_timeout_time_us(m_elementDuration); m_keying_until = make_timeout_time_us(m_elementDuration);
gpio_put(LED_PIN, 1); gpio_put(LED_PIN, 1);
m_Sidetone.on(SIDETONE_FREQ); m_Sidetone.on(SIDETONE_FREQ);
m_lastSymbolWas = Symbol::Dit;
} }
else else
{ {
@ -99,7 +98,6 @@ void Keyer::run()
m_keying_until = make_timeout_time_us(m_elementDuration * 3); m_keying_until = make_timeout_time_us(m_elementDuration * 3);
gpio_put(LED_PIN, 1); gpio_put(LED_PIN, 1);
m_Sidetone.on(SIDETONE_FREQ); m_Sidetone.on(SIDETONE_FREQ);
m_lastSymbolWas = Symbol::Dah;
} }
else else
{ {

View file

@ -22,11 +22,6 @@ public:
void run(); void run();
private: private:
enum class Symbol
{
Dit,
Dah
};
Keyer(){}; Keyer(){};
State state{State::Wait}; State state{State::Wait};
State m_previousState{State::Wait}; State m_previousState{State::Wait};
@ -37,7 +32,6 @@ private:
bool m_currentlyPausing{false}; bool m_currentlyPausing{false};
absolute_time_t m_keying_until{0}; absolute_time_t m_keying_until{0};
absolute_time_t m_pausing_until{0}; absolute_time_t m_pausing_until{0};
Symbol m_lastSymbolWas{Symbol::Dit};
Sidetone m_Sidetone{BUZZER_PIN}; Sidetone m_Sidetone{BUZZER_PIN};
bool m_keyNextIambicB{false}; bool m_keyNextIambicB{false};
}; };