sforkowany z mirror/meshtastic-firmware
Resolve Conflicts between PIN_BUtton and the Rotary Select and keep screen powered during plugin operation. Forward Port from 1.2 firmware fix.
rodzic
8bfe277269
commit
e320850707
|
@ -147,7 +147,11 @@ class ButtonThread : public concurrency::OSThread
|
||||||
static void userButtonPressed()
|
static void userButtonPressed()
|
||||||
{
|
{
|
||||||
// DEBUG_MSG("press!\n");
|
// 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()
|
static void userButtonPressedLong()
|
||||||
{
|
{
|
||||||
|
|
|
@ -279,6 +279,12 @@ void PowerFSM_setup()
|
||||||
powerFSM.add_transition(&stateON, &stateSHUTDOWN, EVENT_SHUTDOWN, NULL, "Shutdown");
|
powerFSM.add_transition(&stateON, &stateSHUTDOWN, EVENT_SHUTDOWN, NULL, "Shutdown");
|
||||||
powerFSM.add_transition(&stateSERIAL, &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(&stateDARK, &stateON, EVENT_BLUETOOTH_PAIR, NULL, "Bluetooth pairing");
|
||||||
powerFSM.add_transition(&stateON, &stateON, EVENT_BLUETOOTH_PAIR, NULL, "Bluetooth pairing");
|
powerFSM.add_transition(&stateON, &stateON, EVENT_BLUETOOTH_PAIR, NULL, "Bluetooth pairing");
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#define EVENT_POWER_DISCONNECTED 14
|
#define EVENT_POWER_DISCONNECTED 14
|
||||||
#define EVENT_FIRMWARE_UPDATE 15 // We just received a new firmware update packet from the phone
|
#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_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 Fsm powerFSM;
|
||||||
extern State statePOWER, stateSERIAL;
|
extern State statePOWER, stateSERIAL;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "InputBroker.h"
|
#include "InputBroker.h"
|
||||||
|
#include "PowerFSM.h" // needed for event trigger
|
||||||
|
|
||||||
InputBroker *inputBroker;
|
InputBroker *inputBroker;
|
||||||
|
|
||||||
|
@ -13,6 +14,7 @@ void InputBroker::registerSource(Observable<const InputEvent *> *source)
|
||||||
|
|
||||||
int InputBroker::handleInputEvent(const InputEvent *event)
|
int InputBroker::handleInputEvent(const InputEvent *event)
|
||||||
{
|
{
|
||||||
|
powerFSM.trigger(EVENT_INPUT);
|
||||||
this->notifyObservers(event);
|
this->notifyObservers(event);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -54,7 +54,7 @@ int32_t RotaryEncoderInterruptBase::runOnce()
|
||||||
}
|
}
|
||||||
else if (this->action == ROTARY_ACTION_CCW)
|
else if (this->action == ROTARY_ACTION_CCW)
|
||||||
{
|
{
|
||||||
DEBUG_MSG("Rotary event CW\n");
|
DEBUG_MSG("Rotary event CCW\n");
|
||||||
e.inputEvent = this->_eventCcw;
|
e.inputEvent = this->_eventCcw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ void RotaryEncoderInterruptBase::intAHandler()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->rotaryLevelA = currentLevelA;
|
this->rotaryLevelA = currentLevelA;
|
||||||
intHandler(
|
this->rotaryStateCCW = intHandler(
|
||||||
currentLevelA == HIGH,
|
currentLevelA == HIGH,
|
||||||
this->rotaryLevelB,
|
this->rotaryLevelB,
|
||||||
ROTARY_ACTION_CCW,
|
ROTARY_ACTION_CCW,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "CannedMessageModule.h"
|
#include "CannedMessageModule.h"
|
||||||
|
#include "PowerFSM.h" // neede for button bypass
|
||||||
#include "MeshService.h"
|
#include "MeshService.h"
|
||||||
#include "FSCommon.h"
|
#include "FSCommon.h"
|
||||||
#include "mesh/generated/cannedmessages.pb.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))
|
if (event->inputEvent == static_cast<char>(InputEventChar_KEY_SELECT))
|
||||||
{
|
{
|
||||||
DEBUG_MSG("Canned message event Select\n");
|
DEBUG_MSG("Canned message event Select\n");
|
||||||
this->runState = CANNED_MESSAGE_RUN_STATE_ACTION_SELECT;
|
// when inactive, call the onebutton shortpress instead. Activate Module only on up/down
|
||||||
validEvent = true;
|
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)
|
if (validEvent)
|
||||||
|
|
Ładowanie…
Reference in New Issue