code cleanup

This commit is contained in:
Martin Brodbeck 2024-02-15 13:59:30 +01:00
parent 20dc5c8a03
commit 86cd97b721
2 changed files with 10 additions and 10 deletions

View file

@ -146,14 +146,14 @@ void Keyer::run()
{ {
if (left_paddle_pressed() && m_previousState == State::Dah && m_nextState == State::Wait) if (left_paddle_pressed() && m_previousState == State::Dah && m_nextState == State::Wait)
{ {
printf("--- Pause --- Next state is Dit!\n"); // printf("--- Pause --- Next state is Dit!\n");
m_nextState = State::Dit; m_nextState = State::Dit;
m_keyNextIambicB = right_paddle_pressed() ? true : false; m_keyNextIambicB = right_paddle_pressed() ? true : false;
} }
else if (right_paddle_pressed() && m_previousState == State::Dit && m_nextState == State::Wait) else if (right_paddle_pressed() && m_previousState == State::Dit && m_nextState == State::Wait)
{ {
printf("--- Pause --- Next state is Dah!\n"); // printf("--- Pause --- Next state is Dah!\n");
m_nextState = State::Dah; m_nextState = State::Dah;
m_keyNextIambicB = left_paddle_pressed() ? true : false; m_keyNextIambicB = left_paddle_pressed() ? true : false;

View file

@ -9,14 +9,6 @@ extern const uint BUZZER_PIN;
class Keyer final class Keyer final
{ {
public: public:
enum class State
{
Wait,
Dit,
Dah,
InterCharSpace,
Abort,
};
Keyer() = delete; Keyer() = delete;
Keyer(uint8_t wpm, Mode mode); Keyer(uint8_t wpm, Mode mode);
@ -27,6 +19,14 @@ public:
void stop(); void stop();
private: private:
enum class State
{
Wait,
Dit,
Dah,
InterCharSpace,
Abort,
};
State state{State::Wait}; State state{State::Wait};
State m_previousState{State::Wait}; State m_previousState{State::Wait};
State m_nextState{State::Wait}; State m_nextState{State::Wait};