Resolve Conflicts between PIN_BUtton and the Rotary Select and keep screen powered during plugin operation. Forward Port from 1.2 firmware fix.

raytac-diy
Thomas Göttgens 2022-03-25 12:27:14 +01:00
rodzic 8bfe277269
commit e320850707
6 zmienionych plików z 24 dodań i 5 usunięć

Wyświetl plik

@ -147,7 +147,11 @@ class ButtonThread : public concurrency::OSThread
static void userButtonPressed()
{
// DEBUG_MSG("press!\n");
powerFSM.trigger(EVENT_PRESS);
#ifdef BUTTON_PIN
if ((BUTTON_PIN != radioConfig.preferences.rotary1_pin_press) || !radioConfig.preferences.canned_message_module_enabled) {
powerFSM.trigger(EVENT_PRESS);
}
#endif
}
static void userButtonPressedLong()
{

Wyświetl plik

@ -279,6 +279,12 @@ void PowerFSM_setup()
powerFSM.add_transition(&stateON, &stateSHUTDOWN, EVENT_SHUTDOWN, NULL, "Shutdown");
powerFSM.add_transition(&stateSERIAL, &stateSHUTDOWN, EVENT_SHUTDOWN, NULL, "Shutdown");
// Inputbroker
powerFSM.add_transition(&stateLS, &stateON, EVENT_INPUT, NULL, "Input Device");
powerFSM.add_transition(&stateNB, &stateON, EVENT_INPUT, NULL, "Input Device");
powerFSM.add_transition(&stateDARK, &stateON, EVENT_INPUT, NULL, "Input Device");
powerFSM.add_transition(&stateON, &stateON, EVENT_INPUT, NULL, "Input Device"); // restarts the sleep timer
powerFSM.add_transition(&stateDARK, &stateON, EVENT_BLUETOOTH_PAIR, NULL, "Bluetooth pairing");
powerFSM.add_transition(&stateON, &stateON, EVENT_BLUETOOTH_PAIR, NULL, "Bluetooth pairing");

Wyświetl plik

@ -20,6 +20,7 @@
#define EVENT_POWER_DISCONNECTED 14
#define EVENT_FIRMWARE_UPDATE 15 // We just received a new firmware update packet from the phone
#define EVENT_SHUTDOWN 16 //force a full shutdown now (not just sleep)
#define EVENT_INPUT 17 // input broker wants something, we need to wake up and enable screen
extern Fsm powerFSM;
extern State statePOWER, stateSERIAL;

Wyświetl plik

@ -1,4 +1,5 @@
#include "InputBroker.h"
#include "PowerFSM.h" // needed for event trigger
InputBroker *inputBroker;
@ -13,6 +14,7 @@ void InputBroker::registerSource(Observable<const InputEvent *> *source)
int InputBroker::handleInputEvent(const InputEvent *event)
{
powerFSM.trigger(EVENT_INPUT);
this->notifyObservers(event);
return 0;
}

Wyświetl plik

@ -54,7 +54,7 @@ int32_t RotaryEncoderInterruptBase::runOnce()
}
else if (this->action == ROTARY_ACTION_CCW)
{
DEBUG_MSG("Rotary event CW\n");
DEBUG_MSG("Rotary event CCW\n");
e.inputEvent = this->_eventCcw;
}
@ -84,7 +84,7 @@ void RotaryEncoderInterruptBase::intAHandler()
return;
}
this->rotaryLevelA = currentLevelA;
intHandler(
this->rotaryStateCCW = intHandler(
currentLevelA == HIGH,
this->rotaryLevelB,
ROTARY_ACTION_CCW,

Wyświetl plik

@ -1,5 +1,6 @@
#include "configuration.h"
#include "CannedMessageModule.h"
#include "PowerFSM.h" // neede for button bypass
#include "MeshService.h"
#include "FSCommon.h"
#include "mesh/generated/cannedmessages.pb.h"
@ -140,8 +141,13 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
if (event->inputEvent == static_cast<char>(InputEventChar_KEY_SELECT))
{
DEBUG_MSG("Canned message event Select\n");
this->runState = CANNED_MESSAGE_RUN_STATE_ACTION_SELECT;
validEvent = true;
// when inactive, call the onebutton shortpress instead. Activate Module only on up/down
if ((this->runState == CANNED_MESSAGE_RUN_STATE_INACTIVE) || (this->runState == CANNED_MESSAGE_RUN_STATE_DISABLED)) {
powerFSM.trigger(EVENT_PRESS);
}else{
this->runState = CANNED_MESSAGE_RUN_STATE_ACTION_SELECT;
validEvent = true;
}
}
if (validEvent)