File tree Expand file tree Collapse file tree 2 files changed +12
-26
lines changed Expand file tree Collapse file tree 2 files changed +12
-26
lines changed Original file line number Diff line number Diff line change @@ -38,26 +38,18 @@ void menuGhostModuleConfig(event_t event)
3838 moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
3939 break ;
4040
41- #if defined(ROTARY_ENCODER_NAVIGATION)
4241 case EVT_ROTARY_LEFT:
43- #elif defined(KEYS_GPIO_REG_UP)
44- case EVT_KEY_BREAK (KEY_UP):
45- #elif defined(KEYS_GPIO_REG_PLUS)
46- case EVT_KEY_BREAK (KEY_PLUS):
47- #endif
42+ case EVT_KEY_BREAK (KEY_UP):
43+ case EVT_KEY_BREAK (KEY_PLUS):
4844 reusableBuffer.ghostMenu .buttonAction = GHST_BTN_JOYUP;
4945 reusableBuffer.ghostMenu .menuAction = GHST_MENU_CTRL_NONE;
5046 moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
5147 audioKeyPress ();
5248 break ;
5349
54- #if defined(ROTARY_ENCODER_NAVIGATION)
5550 case EVT_ROTARY_RIGHT:
56- #elif defined(KEYS_GPIO_REG_DOWN)
57- case EVT_KEY_BREAK (KEY_DOWN):
58- #elif defined(KEYS_GPIO_REG_MINUS)
51+ case EVT_KEY_BREAK (KEY_DOWN):
5952 case EVT_KEY_BREAK (KEY_MINUS):
60- #endif
6153 reusableBuffer.ghostMenu .buttonAction = GHST_BTN_JOYDOWN;
6254 reusableBuffer.ghostMenu .menuAction = GHST_MENU_CTRL_NONE;
6355 moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
Original file line number Diff line number Diff line change @@ -420,6 +420,8 @@ extern volatile uint32_t rotencDt;
420420
421421void OpenTxSimulator::rotaryEncoderEvent (int steps)
422422{
423+ if (steps == 0 ) return ;
424+
423425#if defined(ROTARY_ENCODER_NAVIGATION) && !defined(USE_HATS_AS_KEYS)
424426 static uint32_t last_tick = 0 ;
425427 if (steps != 0 ) {
@@ -433,22 +435,14 @@ void OpenTxSimulator::rotaryEncoderEvent(int steps)
433435 last_tick = now;
434436 }
435437#else
436- // TODO : this should probably be handled in the GUI
437438 int key;
438- #if defined(PCBXLITE)
439- if (steps > 0 )
440- key = KEY_DOWN;
441- else if (steps < 0 )
442- key = KEY_UP;
443- #elif defined(KEYS_GPIO_REG_PLUS) && defined(KEYS_GPIO_REG_MINUS)
444- if (steps > 0 )
445- key = KEY_MINUS;
446- else if (steps < 0 )
447- key = KEY_PLUS;
448- else
449- #endif
450- // Should not happen but Clang complains that key is unset otherwise
451- return ;
439+ if (keysGetSupported () & ((1 << KEY_UP) | (1 << KEY_DOWN))) {
440+ key = steps > 0 ? KEY_DOWN : KEY_UP;
441+ } else if (keysGetSupported () & ((1 << KEY_PLUS) | (1 << KEY_MINUS))) {
442+ key = steps > 0 ? KEY_MINUS : KEY_PLUS;
443+ } else {
444+ return ; // not supposed to happen???
445+ }
452446
453447 setKey (key, 1 );
454448#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
You can’t perform that action at this time.
0 commit comments