mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 22:22:05 +00:00
T-deck trackball debounce
This commit is contained in:
parent
34f22c40b3
commit
f1cebe9d1d
@ -40,7 +40,24 @@ int32_t TrackballInterruptBase::runOnce()
|
|||||||
{
|
{
|
||||||
InputEvent e;
|
InputEvent e;
|
||||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
||||||
|
#if defined(T_DECK) // T-deck gets a super-simple debounce on trackball
|
||||||
|
if (this->action == TB_ACTION_PRESSED) {
|
||||||
|
// LOG_DEBUG("Trackball event Press");
|
||||||
|
e.inputEvent = this->_eventPressed;
|
||||||
|
} else if (this->action == TB_ACTION_UP && lastEvent == TB_ACTION_UP) {
|
||||||
|
// LOG_DEBUG("Trackball event UP");
|
||||||
|
e.inputEvent = this->_eventUp;
|
||||||
|
} else if (this->action == TB_ACTION_DOWN && lastEvent == TB_ACTION_DOWN) {
|
||||||
|
// LOG_DEBUG("Trackball event DOWN");
|
||||||
|
e.inputEvent = this->_eventDown;
|
||||||
|
} else if (this->action == TB_ACTION_LEFT && lastEvent == TB_ACTION_LEFT) {
|
||||||
|
// LOG_DEBUG("Trackball event LEFT");
|
||||||
|
e.inputEvent = this->_eventLeft;
|
||||||
|
} else if (this->action == TB_ACTION_RIGHT && lastEvent == TB_ACTION_RIGHT) {
|
||||||
|
// LOG_DEBUG("Trackball event RIGHT");
|
||||||
|
e.inputEvent = this->_eventRight;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (this->action == TB_ACTION_PRESSED) {
|
if (this->action == TB_ACTION_PRESSED) {
|
||||||
// LOG_DEBUG("Trackball event Press");
|
// LOG_DEBUG("Trackball event Press");
|
||||||
e.inputEvent = this->_eventPressed;
|
e.inputEvent = this->_eventPressed;
|
||||||
@ -57,13 +74,14 @@ int32_t TrackballInterruptBase::runOnce()
|
|||||||
// LOG_DEBUG("Trackball event RIGHT");
|
// LOG_DEBUG("Trackball event RIGHT");
|
||||||
e.inputEvent = this->_eventRight;
|
e.inputEvent = this->_eventRight;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (e.inputEvent != meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE) {
|
if (e.inputEvent != meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE) {
|
||||||
e.source = this->_originName;
|
e.source = this->_originName;
|
||||||
e.kbchar = 0x00;
|
e.kbchar = 0x00;
|
||||||
this->notifyObservers(&e);
|
this->notifyObservers(&e);
|
||||||
}
|
}
|
||||||
|
lastEvent = action;
|
||||||
this->action = TB_ACTION_NONE;
|
this->action = TB_ACTION_NONE;
|
||||||
|
|
||||||
return 100;
|
return 100;
|
||||||
|
@ -41,4 +41,5 @@ class TrackballInterruptBase : public Observable<const InputEvent *>, public con
|
|||||||
char _eventRight = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
char _eventRight = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
||||||
char _eventPressed = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
char _eventPressed = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
||||||
const char *_originName;
|
const char *_originName;
|
||||||
|
TrackballInterruptBaseActionType lastEvent = TB_ACTION_NONE;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user