feat(color): allow user to change key shortcut action; add Favorites quick menu (#6753)

Co-authored-by: elecpower <elecpower@users.noreply.github.com>
This commit is contained in:
philmoz
2025-11-19 18:40:23 +10:00
committed by GitHub
co-authored by elecpower
parent 5c96b1e15c
commit 72d290f89f
103 changed files with 2605 additions and 921 deletions
+80
View File
@@ -24,6 +24,10 @@
#include "hal/switch_driver.h"
#include "tasks/mixer_task.h"
#if defined(COLORLCD)
#include "view_main.h"
#endif
char* RadioData::getSwitchCustomName(uint8_t n)
{
return switchConfig[n].name;
@@ -85,3 +89,79 @@ void RadioData::cfsSetOffColorLuaOverride(uint8_t n, bool v) {
}
#endif
#endif
#if defined(COLORLCD)
QMPage RadioData::getKeyShortcut(event_t event)
{
QMPage page = QM_NONE;
switch(event) {
case EVT_KEY_BREAK(KEY_MODEL):
page = (QMPage)keyShortcuts[0].shortcut;
break;
case EVT_KEY_BREAK(KEY_SYS):
page = (QMPage)keyShortcuts[1].shortcut;
break;
case EVT_KEY_BREAK(KEY_TELE):
page = (QMPage)keyShortcuts[2].shortcut;
break;
case EVT_KEY_LONG(KEY_MODEL):
page = (QMPage)keyShortcuts[3].shortcut;
break;
case EVT_KEY_LONG(KEY_SYS):
page = (QMPage)keyShortcuts[4].shortcut;
break;
case EVT_KEY_LONG(KEY_TELE):
page = (QMPage)keyShortcuts[5].shortcut;
break;
default:
break;
}
if (page >= QM_UI_SCREEN1 && page <= QM_UI_SCREEN10)
page = (QMPage)(QM_UI_SCREEN1 + ViewMain::instance()->getCurrentMainView());
return page;
}
void RadioData::setKeyShortcut(event_t event, QMPage shortcut)
{
switch(event) {
case EVT_KEY_BREAK(KEY_MODEL):
keyShortcuts[0].shortcut = shortcut;
break;
case EVT_KEY_BREAK(KEY_SYS):
keyShortcuts[1].shortcut = shortcut;
break;
case EVT_KEY_BREAK(KEY_TELE):
keyShortcuts[2].shortcut = shortcut;
break;
case EVT_KEY_LONG(KEY_MODEL):
keyShortcuts[3].shortcut = shortcut;
break;
case EVT_KEY_LONG(KEY_SYS):
keyShortcuts[4].shortcut = shortcut;
break;
case EVT_KEY_LONG(KEY_TELE):
keyShortcuts[5].shortcut = shortcut;
break;
default:
break;
}
}
bool RadioData::hasKeyShortcut(QMPage shortcut)
{
for (int i = 0; i < MAX_KEY_SHORTCUTS; i += 1)
if (keyShortcuts[i].shortcut == shortcut)
return true;
return false;
}
void RadioData::defaultKeyShortcuts()
{
setKeyShortcut(EVT_KEY_BREAK(KEY_MODEL), QM_MODEL_SETUP);
setKeyShortcut(EVT_KEY_LONG(KEY_MODEL), QM_MANAGE_MODELS);
setKeyShortcut(EVT_KEY_BREAK(KEY_SYS), QM_OPEN_QUICK_MENU);
setKeyShortcut(EVT_KEY_LONG(KEY_SYS), QM_TOOLS_APPS);
setKeyShortcut(EVT_KEY_BREAK(KEY_TELE), QM_UI_SCREEN1);
setKeyShortcut(EVT_KEY_LONG(KEY_TELE), QM_TOOLS_CHAN_MON);
}
#endif