chore(radio): remove hardware definitions present in JSON (#6437)
Co-authored-by: philmoz <phil.a.mitchell@gmail.com>
This commit is contained in:
co-authored by
philmoz
parent
2ca8e3e7b6
commit
df981597c6
@@ -76,6 +76,12 @@ static void field_focus_leave(lv_event_t* e) { Keyboard::hide(false); }
|
||||
Keyboard::Keyboard(coord_t height) :
|
||||
NavWindow(MainWindow::instance(), {0, LCD_H - height, LCD_W, height})
|
||||
{
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
hasTwoPageKeys = true;
|
||||
#else
|
||||
hasTwoPageKeys = keyIsSupported(KEY_PAGEUP);
|
||||
#endif
|
||||
|
||||
lv_obj_set_parent(lvobj, lv_layer_top()); // the keyboard is always on top
|
||||
|
||||
// use a separate group for the keyboard
|
||||
|
||||
@@ -36,8 +36,7 @@ class Keyboard : public NavWindow
|
||||
protected:
|
||||
static Keyboard *activeKeyboard;
|
||||
|
||||
void deleteLater() override;
|
||||
|
||||
bool hasTwoPageKeys;
|
||||
lv_group_t* group = nullptr;
|
||||
lv_obj_t* keyboard = nullptr;
|
||||
|
||||
@@ -48,4 +47,5 @@ class Keyboard : public NavWindow
|
||||
|
||||
void setField(FormField* newField);
|
||||
bool attachKeyboard();
|
||||
void deleteLater() override;
|
||||
};
|
||||
|
||||
@@ -112,36 +112,14 @@ void NumberKeyboard::changeSign()
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
|
||||
#if (defined(KEYS_GPIO_REG_PAGEUP) || defined(USE_HATS_AS_KEYS)) && \
|
||||
!defined(PCBX12S)
|
||||
// Radios with both PGUP and PGDN buttons except X12S
|
||||
void NumberKeyboard::onPressSYS() { decLarge(); }
|
||||
void NumberKeyboard::onPressSYS() { if (hasTwoPageKeys) decLarge(); else decSmall(); }
|
||||
void NumberKeyboard::onLongPressSYS() { setMIN(); }
|
||||
void NumberKeyboard::onPressMDL() { incLarge(); }
|
||||
void NumberKeyboard::onLongPressMDL() { setMAX(); }
|
||||
void NumberKeyboard::onPressTELE() { changeSign(); }
|
||||
void NumberKeyboard::onLongPressTELE() { setDEF(); }
|
||||
void NumberKeyboard::onPressPGUP() { decSmall(); }
|
||||
void NumberKeyboard::onPressPGDN() { incSmall(); }
|
||||
void NumberKeyboard::onLongPressPGUP() {}
|
||||
void NumberKeyboard::onLongPressPGDN() {}
|
||||
#else
|
||||
// Radios witb only a single PGUP/DN button or X12S
|
||||
void NumberKeyboard::onPressSYS() { decSmall(); }
|
||||
void NumberKeyboard::onLongPressSYS() { setMIN(); }
|
||||
void NumberKeyboard::onPressMDL() { incLarge(); }
|
||||
void NumberKeyboard::onLongPressMDL() { changeSign(); }
|
||||
void NumberKeyboard::onPressTELE() { incSmall(); }
|
||||
void NumberKeyboard::onLongPressTELE() { setMAX(); }
|
||||
#if defined(PCBX12S)
|
||||
void NumberKeyboard::onPressPGUP() { decLarge(); }
|
||||
#else
|
||||
void NumberKeyboard::onPressPGUP() { setDEF(); }
|
||||
#endif
|
||||
void NumberKeyboard::onPressPGDN() { decLarge(); }
|
||||
void NumberKeyboard::onLongPressPGUP() { setDEF(); }
|
||||
void NumberKeyboard::onLongPressPGDN() { setDEF(); }
|
||||
#endif
|
||||
void NumberKeyboard::onLongPressMDL() { if (hasTwoPageKeys) setMAX(); else changeSign(); }
|
||||
void NumberKeyboard::onPressTELE() { if (hasTwoPageKeys) changeSign(); else incSmall(); }
|
||||
void NumberKeyboard::onLongPressTELE() { if (hasTwoPageKeys) setDEF(); else setMAX(); }
|
||||
void NumberKeyboard::onPressPGUP() { if (hasTwoPageKeys) decSmall(); else setDEF(); }
|
||||
void NumberKeyboard::onPressPGDN() { if (hasTwoPageKeys) incSmall(); else decLarge(); }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -53,8 +53,6 @@ class NumberKeyboard : public Keyboard
|
||||
void onLongPressTELE() override;
|
||||
void onPressPGUP() override;
|
||||
void onPressPGDN() override;
|
||||
void onLongPressPGUP() override;
|
||||
void onLongPressPGDN() override;
|
||||
#endif
|
||||
|
||||
static NumberKeyboard* _instance;
|
||||
|
||||
@@ -95,36 +95,16 @@ void TextKeyboard::cursorEnd()
|
||||
lv_textarea_cursor_right(kb->ta);
|
||||
}
|
||||
|
||||
#if (defined(KEYS_GPIO_REG_PAGEUP) || defined(USE_HATS_AS_KEYS)) && \
|
||||
!defined(PCBX12S)
|
||||
// Radios with both PGUP and PGDN buttons except X12S
|
||||
void TextKeyboard::onPressSYS() { changeMode(); }
|
||||
void TextKeyboard::onLongPressSYS() {}
|
||||
void TextKeyboard::onPressMDL() {}
|
||||
void TextKeyboard::onPressSYS() { if (hasTwoPageKeys) changeMode(); else cursorLeft(); }
|
||||
void TextKeyboard::onLongPressSYS() { if (!hasTwoPageKeys) cursorStart(); }
|
||||
void TextKeyboard::onPressMDL() { if (!hasTwoPageKeys) changeMode(); }
|
||||
void TextKeyboard::onLongPressMDL() { backspace(); }
|
||||
void TextKeyboard::onPressTELE() { toggleCase(); }
|
||||
void TextKeyboard::onLongPressTELE() { deleteChar(); }
|
||||
void TextKeyboard::onPressPGUP() { cursorLeft(); }
|
||||
void TextKeyboard::onPressPGDN() { cursorRight(); }
|
||||
void TextKeyboard::onPressTELE() { if (hasTwoPageKeys) toggleCase(); else cursorRight(); }
|
||||
void TextKeyboard::onLongPressTELE() { if (hasTwoPageKeys) deleteChar(); else cursorEnd(); }
|
||||
void TextKeyboard::onPressPGUP() { if (hasTwoPageKeys) cursorLeft(); else deleteChar(); }
|
||||
void TextKeyboard::onPressPGDN() { if (hasTwoPageKeys) cursorRight(); else toggleCase(); }
|
||||
void TextKeyboard::onLongPressPGUP() { cursorStart(); }
|
||||
void TextKeyboard::onLongPressPGDN() { cursorEnd(); }
|
||||
#else
|
||||
// Radios witb only a single PGUP/DN button or X12S
|
||||
void TextKeyboard::onPressSYS() { cursorLeft(); }
|
||||
void TextKeyboard::onLongPressSYS() { cursorStart(); }
|
||||
void TextKeyboard::onPressMDL() { changeMode(); }
|
||||
void TextKeyboard::onLongPressMDL() { backspace(); }
|
||||
void TextKeyboard::onPressTELE() { cursorRight(); }
|
||||
void TextKeyboard::onLongPressTELE() { cursorEnd(); }
|
||||
#if defined(PCBX12S)
|
||||
void TextKeyboard::onPressPGUP() { toggleCase(); }
|
||||
#else
|
||||
void TextKeyboard::onPressPGUP() { deleteChar(); }
|
||||
#endif
|
||||
void TextKeyboard::onPressPGDN() { toggleCase(); }
|
||||
void TextKeyboard::onLongPressPGUP() {}
|
||||
void TextKeyboard::onLongPressPGDN() { deleteChar(); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void TextKeyboard::open(FormField* field)
|
||||
|
||||
@@ -38,26 +38,18 @@ void menuGhostModuleConfig(event_t event)
|
||||
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||
break;
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
case EVT_ROTARY_LEFT:
|
||||
#elif defined(KEYS_GPIO_REG_UP)
|
||||
case EVT_KEY_BREAK(KEY_UP):
|
||||
#elif defined(KEYS_GPIO_REG_PLUS)
|
||||
case EVT_KEY_BREAK(KEY_PLUS):
|
||||
#endif
|
||||
case EVT_KEY_BREAK(KEY_UP):
|
||||
case EVT_KEY_BREAK(KEY_PLUS):
|
||||
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_JOYUP;
|
||||
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_NONE;
|
||||
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||
audioKeyPress();
|
||||
break;
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
case EVT_ROTARY_RIGHT:
|
||||
#elif defined(KEYS_GPIO_REG_DOWN)
|
||||
case EVT_KEY_BREAK(KEY_DOWN):
|
||||
#elif defined(KEYS_GPIO_REG_MINUS)
|
||||
case EVT_KEY_BREAK(KEY_DOWN):
|
||||
case EVT_KEY_BREAK(KEY_MINUS):
|
||||
#endif
|
||||
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_JOYDOWN;
|
||||
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_NONE;
|
||||
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||
|
||||
@@ -304,14 +304,12 @@ void menuRadioSdManager(event_t _event)
|
||||
|
||||
switch (_event) {
|
||||
|
||||
#if defined(KEYS_GPIO_REG_MENU)
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
if (SD_CARD_PRESENT() && s_editMode == 0) {
|
||||
POPUP_MENU_ADD_ITEM(STR_SD_INFO);
|
||||
POPUP_MENU_START(onSdManagerMenu);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
REFRESH_FILES();
|
||||
|
||||
@@ -21,18 +21,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// Define navigation type based on available keys
|
||||
#if LCD_W == 212
|
||||
#define NAVIGATION_X9D
|
||||
#elif defined(KEYS_GPIO_REG_SHIFT)
|
||||
// Define navigation type if not defined already
|
||||
#if defined(RADIO_XLITE) || defined(RADIO_XLITES)
|
||||
#define NAVIGATION_XLITE
|
||||
#elif defined(KEYS_GPIO_REG_LEFT)
|
||||
#elif defined(RADIO_LR3PRO) || defined(RADIO_T12) || defined(RADIO_TLITE)
|
||||
#define NAVIGATION_9X
|
||||
#elif defined(KEYS_GPIO_REG_PAGEUP) && defined(KEYS_GPIO_REG_TELE)
|
||||
#define NAVIGATION_X7
|
||||
#define NAVIGATION_X7_TX12
|
||||
#elif defined(RADIO_X9D) || defined(RADIO_X9DP) || defined(RADIO_X9DP2019) || defined(RADIO_X9E)
|
||||
#define NAVIGATION_X9D
|
||||
#else
|
||||
#define NAVIGATION_X7
|
||||
#if defined(MANUFACTURER_RADIOMASTER) && !defined(RADIO_T8)
|
||||
#define NAVIGATION_X7_RM
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_X7) || defined(NAVIGATION_X9D)
|
||||
@@ -55,7 +55,7 @@
|
||||
#define EVT_KEY_MODEL_MENU EVT_KEY_BREAK(KEY_MODEL)
|
||||
#define EVT_KEY_GENERAL_MENU EVT_KEY_BREAK(KEY_SYS)
|
||||
#define EVT_KEY_TELEMETRY EVT_KEY_LONG(KEY_PAGEUP)
|
||||
#elif defined(NAVIGATION_X7_TX12)
|
||||
#elif defined(NAVIGATION_X7_RM)
|
||||
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_BREAK(KEY_PAGEUP)
|
||||
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_PAGEDN)
|
||||
#define EVT_KEY_NEXT_PAGE EVT_ROTARY_RIGHT
|
||||
@@ -86,7 +86,7 @@
|
||||
#if defined(NAVIGATION_XLITE)
|
||||
#define EVT_KEY_PREVIOUS_TELEM_VIEW(evt) (evt == EVT_KEY_LONG(KEY_LEFT) && keysGetState(KEY_SHIFT))
|
||||
#define EVT_KEY_NEXT_TELEM_VIEW(evt) (evt == EVT_KEY_LONG(KEY_RIGHT) && keysGetState(KEY_SHIFT))
|
||||
#elif defined(KEYS_GPIO_REG_PAGEUP)
|
||||
#elif defined(NAVIGATION_X7_RM) || defined(RADIO_T8) || defined(RADIO_COMMANDO8)
|
||||
#define EVT_KEY_PREVIOUS_TELEM_VIEW(evt) (evt == EVT_KEY_FIRST(KEY_PAGEUP))
|
||||
#define EVT_KEY_NEXT_TELEM_VIEW(evt) (evt == EVT_KEY_FIRST(KEY_PAGEDN))
|
||||
#elif defined(NAVIGATION_X7) || defined(NAVIGATION_X9D)
|
||||
|
||||
Reference in New Issue
Block a user