mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 22:22:05 +00:00
Trunk
This commit is contained in:
parent
b177329813
commit
f4c5e31f3d
@ -8,12 +8,12 @@
|
|||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "RadioLibInterface.h"
|
#include "RadioLibInterface.h"
|
||||||
#include "buzz.h"
|
#include "buzz.h"
|
||||||
|
#include "input/InputBroker.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "modules/CannedMessageModule.h"
|
#include "modules/CannedMessageModule.h"
|
||||||
#include "modules/ExternalNotificationModule.h"
|
#include "modules/ExternalNotificationModule.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
#include "input/InputBroker.h"
|
|
||||||
#ifdef ARCH_PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
#include "platform/portduino/PortduinoGlue.h"
|
#include "platform/portduino/PortduinoGlue.h"
|
||||||
#endif
|
#endif
|
||||||
@ -264,45 +264,45 @@ int32_t ButtonThread::runOnce()
|
|||||||
|
|
||||||
if (btnEvent != BUTTON_EVENT_NONE) {
|
if (btnEvent != BUTTON_EVENT_NONE) {
|
||||||
#if HAS_SCREEN
|
#if HAS_SCREEN
|
||||||
switch (btnEvent) {
|
switch (btnEvent) {
|
||||||
case BUTTON_EVENT_PRESSED: {
|
case BUTTON_EVENT_PRESSED: {
|
||||||
LOG_BUTTON("press!");
|
LOG_BUTTON("press!");
|
||||||
|
|
||||||
// Play boop sound for every button press
|
// Play boop sound for every button press
|
||||||
playBoop();
|
playBoop();
|
||||||
|
|
||||||
// Forward single press to InputBroker (but NOT as DOWN/SELECT, just forward a "button press" event)
|
// Forward single press to InputBroker (but NOT as DOWN/SELECT, just forward a "button press" event)
|
||||||
if (inputBroker) {
|
if (inputBroker) {
|
||||||
InputEvent evt = { "button", INPUT_BROKER_MSG_BUTTON_PRESSED, 0, 0, 0 };
|
InputEvent evt = {"button", INPUT_BROKER_MSG_BUTTON_PRESSED, 0, 0, 0};
|
||||||
inputBroker->injectInputEvent(&evt);
|
inputBroker->injectInputEvent(&evt);
|
||||||
}
|
|
||||||
|
|
||||||
// Start tracking for potential combination
|
|
||||||
waitingForLongPress = true;
|
|
||||||
shortPressTime = millis();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case BUTTON_EVENT_LONG_PRESSED: {
|
|
||||||
LOG_BUTTON("Long press!");
|
|
||||||
|
|
||||||
// Play beep sound
|
// Start tracking for potential combination
|
||||||
playBeep();
|
waitingForLongPress = true;
|
||||||
|
shortPressTime = millis();
|
||||||
|
|
||||||
// Forward long press to InputBroker (but NOT as DOWN/SELECT, just forward a "button long press" event)
|
break;
|
||||||
if (inputBroker) {
|
}
|
||||||
InputEvent evt = { "button", INPUT_BROKER_MSG_BUTTON_LONG_PRESSED, 0, 0, 0 };
|
case BUTTON_EVENT_LONG_PRESSED: {
|
||||||
inputBroker->injectInputEvent(&evt);
|
LOG_BUTTON("Long press!");
|
||||||
}
|
|
||||||
|
|
||||||
waitingForLongPress = false;
|
// Play beep sound
|
||||||
break;
|
playBeep();
|
||||||
|
|
||||||
|
// Forward long press to InputBroker (but NOT as DOWN/SELECT, just forward a "button long press" event)
|
||||||
|
if (inputBroker) {
|
||||||
|
InputEvent evt = {"button", INPUT_BROKER_MSG_BUTTON_LONG_PRESSED, 0, 0, 0};
|
||||||
|
inputBroker->injectInputEvent(&evt);
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
// Ignore all other events on screen devices
|
waitingForLongPress = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
btnEvent = BUTTON_EVENT_NONE;
|
default:
|
||||||
|
// Ignore all other events on screen devices
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
btnEvent = BUTTON_EVENT_NONE;
|
||||||
#else
|
#else
|
||||||
// On devices without screen: full legacy logic
|
// On devices without screen: full legacy logic
|
||||||
switch (btnEvent) {
|
switch (btnEvent) {
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_SCREEN
|
#ifdef HAS_SCREEN
|
||||||
#undef BUTTON_LONGPRESS_MS
|
#undef BUTTON_LONGPRESS_MS
|
||||||
#define BUTTON_LONGPRESS_MS 500
|
#define BUTTON_LONGPRESS_MS 500
|
||||||
#else
|
#else
|
||||||
#ifndef BUTTON_LONGPRESS_MS
|
#ifndef BUTTON_LONGPRESS_MS
|
||||||
#define BUTTON_LONGPRESS_MS 5000
|
#define BUTTON_LONGPRESS_MS 5000
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef BUTTON_TOUCH_MS
|
#ifndef BUTTON_TOUCH_MS
|
||||||
|
Loading…
Reference in New Issue
Block a user