From fbd5b8b721e9c9abd86fe9d4e538d1da12eb947d Mon Sep 17 00:00:00 2001 From: Balazs Kelemen <10376327+prampec@users.noreply.github.com> Date: Sun, 9 Jan 2022 21:14:23 +0100 Subject: [PATCH] Canned message bugfixes. --- src/plugins/CannedMessagePlugin.cpp | 4 ++++ src/plugins/input/RotaryEncoderInterruptBase.cpp | 10 ++++++++-- src/plugins/input/RotaryEncoderInterruptImpl1.cpp | 7 +++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/plugins/CannedMessagePlugin.cpp b/src/plugins/CannedMessagePlugin.cpp index a6ebf3bae..43a411985 100644 --- a/src/plugins/CannedMessagePlugin.cpp +++ b/src/plugins/CannedMessagePlugin.cpp @@ -20,16 +20,19 @@ int CannedMessagePlugin::handleInputEvent(const InputEvent *event) bool validEvent = false; if (event->inputEvent == INPUT_EVENT_UP) { + DEBUG_MSG("Canned message event UP\n"); this->action = CANNED_MESSAGE_ACTION_UP; validEvent = true; } if (event->inputEvent == INPUT_EVENT_DOWN) { + DEBUG_MSG("Canned message event DOWN\n"); this->action = CANNED_MESSAGE_ACTION_DOWN; validEvent = true; } if (event->inputEvent == INPUT_EVENT_SELECT) { + DEBUG_MSG("Canned message event Select\n"); this->action = CANNED_MESSAGE_ACTION_SELECT; validEvent = true; } @@ -63,6 +66,7 @@ void CannedMessagePlugin::sendText(NodeNum dest, int32_t CannedMessagePlugin::runOnce() { + DEBUG_MSG("Check status\n"); if (this->sendingState == SENDING_STATE_ACTIVE) { // TODO: might have some feedback of sendig state diff --git a/src/plugins/input/RotaryEncoderInterruptBase.cpp b/src/plugins/input/RotaryEncoderInterruptBase.cpp index 2d6236e69..49143dedf 100644 --- a/src/plugins/input/RotaryEncoderInterruptBase.cpp +++ b/src/plugins/input/RotaryEncoderInterruptBase.cpp @@ -30,6 +30,8 @@ RotaryEncoderInterruptBase::RotaryEncoderInterruptBase( attachInterrupt(this->_pinB, onIntB, CHANGE); this->rotaryLevelA = digitalRead(this->_pinA); this->rotaryLevelB = digitalRead(this->_pinB); + DEBUG_MSG("Rotary initialized (%d, %d, %d)\n", + this->_pinA, this->_pinB, pinPress); } int32_t RotaryEncoderInterruptBase::runOnce() @@ -42,12 +44,14 @@ int32_t RotaryEncoderInterruptBase::runOnce() } else if (this->action == ROTARY_ACTION_CW) { + DEBUG_MSG("Rotary event CW\n"); InputEvent e; e.inputEvent = this->_eventCw; this->notifyObservers(&e); } else if (this->action == ROTARY_ACTION_CCW) { + DEBUG_MSG("Rotary event CW\n"); InputEvent e; e.inputEvent = this->_eventCcw; this->notifyObservers(&e); @@ -90,9 +94,10 @@ void RotaryEncoderInterruptBase::intAHandler() { this->rotaryStateCCW = ROTARY_EVENT_OCCURRED; if ((this->action == ROTARY_ACTION_NONE) - || (this->action == ROTARY_ACTION_CCW)) + || (this->action == ROTARY_ACTION_CW)) { - this->action = ROTARY_ACTION_CW; + this->action = ROTARY_ACTION_CCW; + DEBUG_MSG("Rotary action CCW\n"); } } } @@ -124,6 +129,7 @@ void RotaryEncoderInterruptBase::intBHandler() || (this->action == ROTARY_ACTION_CCW)) { this->action = ROTARY_ACTION_CW; + DEBUG_MSG("Rotary action CW\n"); } } } diff --git a/src/plugins/input/RotaryEncoderInterruptImpl1.cpp b/src/plugins/input/RotaryEncoderInterruptImpl1.cpp index 6c90b18da..ebd8e8309 100644 --- a/src/plugins/input/RotaryEncoderInterruptImpl1.cpp +++ b/src/plugins/input/RotaryEncoderInterruptImpl1.cpp @@ -13,18 +13,17 @@ RotaryEncoderInterruptImpl1::RotaryEncoderInterruptImpl1( RotaryEncoderInterruptImpl1::handleIntB, RotaryEncoderInterruptImpl1::handleIntPressed) { - } void RotaryEncoderInterruptImpl1::handleIntA() { - + rotaryEncoderInterruptImpl1->intAHandler(); } void RotaryEncoderInterruptImpl1::handleIntB() { - + rotaryEncoderInterruptImpl1->intBHandler(); } void RotaryEncoderInterruptImpl1::handleIntPressed() { - + rotaryEncoderInterruptImpl1->intPressHandler(); }