feat(v16): add CI1302 voice control (VGR/VFL, motion control, menu navigation) (#7501)

Co-authored-by: Peter Feerick <5500713+pfeerick@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
helloradiosky
2026-09-20 11:48:49 +10:00
committed by GitHub
co-authored by Peter Feerick Claude Sonnet 5
parent f364c6ef63
commit 4aa9a258ee
26 changed files with 1625 additions and 13 deletions
+37
View File
@@ -175,6 +175,37 @@ static void keyboardDriverRead(lv_indev_drv_t *drv, lv_indev_data_t *data)
}
}
#if defined(VOICE_CONTROL_SENSOR)
static bool voiceEnterPending = false;
static void lvglInjectKeyboardEnter()
{
if (!keyboardDevice) return;
auto obj = get_focus_obj(keyboardDevice);
if (obj) {
lv_group_t* g = keyboardDevice->group;
if (g && !lv_obj_has_state(obj, LV_STATE_DISABLED)) {
// Same sequence as lv_indev keypad Enter (press then release).
lv_group_send_data(g, LV_KEY_ENTER);
lv_event_send(obj, LV_EVENT_PRESSED, keyboardDevice);
lv_event_send(obj, LV_EVENT_RELEASED, keyboardDevice);
lv_event_send(obj, LV_EVENT_SHORT_CLICKED, keyboardDevice);
lv_event_send(obj, LV_EVENT_CLICKED, keyboardDevice);
}
return;
}
auto w = Window::topWindow();
dispatch_kb_event(w, EVT_KEY_BREAK(KEY_ENTER));
}
void lvglRequestKeyboardEnter()
{
voiceEnterPending = true;
}
#endif
extern "C" void touchDriverRead(lv_indev_drv_t *drv, lv_indev_data_t *data)
{
#if defined(HARDWARE_TOUCH)
@@ -370,6 +401,12 @@ void LvglWrapper::run()
if (!updating) {
// Normal UI loop - call lgvl timer handler
updating = true;
#if defined(VOICE_CONTROL_SENSOR)
if (voiceEnterPending) {
voiceEnterPending = false;
lvglInjectKeyboardEnter();
}
#endif
lv_timer_handler();
updating = false;
} else {
+4
View File
@@ -37,3 +37,7 @@ class LvglWrapper
LvglWrapper();
~LvglWrapper() {}
};
#if defined(VOICE_CONTROL_SENSOR)
void lvglRequestKeyboardEnter();
#endif
@@ -54,6 +54,9 @@ class SourceChoiceMenuToolbar : public MenuToolbar
[=](int16_t index) {
#if defined(LUMINOSITY_SENSOR)
if (index == MIXSRC_LIGHT) return true;
#endif
#if defined(VOICE_CONTROL_SENSOR)
if (index >= MIXSRC_VGR && index <= MIXSRC_LAST_VOICE) return true;
#endif
return (index >= MIXSRC_MIN && index <= MIXSRC_MAX) ||
(index >= MIXSRC_TX_VOLTAGE && index <= MIXSRC_LAST_TIMER);
+35 -1
View File
@@ -26,6 +26,9 @@
#include "edgetx.h"
#include "switches.h"
#if defined(VOICE_CONTROL_SENSOR)
#include "drivers/CI1302_voice_integration.h"
#endif
#include "mixes.h"
#include "os/sleep.h"
@@ -206,9 +209,19 @@ static bool isSourceTrimAvailable(int source) {
}
static bool isSourceSwitchAvailable(int source) {
#if defined(VOICE_CONTROL_SENSOR)
// VGR/VFL have their own dedicated sources
if (CI1302_voiceSwitchIsIndex(source)) return false;
#endif
return SWITCH_EXISTS(source);
}
#if defined(VOICE_CONTROL_SENSOR)
static bool isSourceVoiceAvailable(int source) {
return CI1302_voiceIntegrationSourceAvailable(MIXSRC_VGR + source);
}
#endif
#if defined(FUNCTION_SWITCHES)
static bool isSourceFuncSwitchAvailable(int source) {
return getSwitchCountInFSGroup(source + 1) > 0;
@@ -281,6 +294,9 @@ static struct sourceAvailableCheck sourceChecks[] = {
{ MIXSRC_FIRST_CH, MIXSRC_LAST_CH, SRC_CHANNEL_ALL, sourceIsAvailable },
{ MIXSRC_FIRST_GVAR, MIXSRC_LAST_GVAR, SRC_GVAR, isSourceGvarAvailable },
{ MIXSRC_TX_VOLTAGE, MIXSRC_TX_GPS, SRC_TX, sourceIsAvailable },
#if defined(VOICE_CONTROL_SENSOR)
{ MIXSRC_VGR, MIXSRC_LAST_VOICE, SRC_VOICE, isSourceVoiceAvailable },
#endif
{ MIXSRC_FIRST_TIMER, MIXSRC_LAST_TIMER, SRC_TIMER, isSourceTimerAvailable },
{ MIXSRC_FIRST_TELEM, MIXSRC_LAST_TELEM, SRC_TELEM, isSourceTelemAvailable },
{ MIXSRC_NONE, MIXSRC_NONE, SRC_NONE, sourceIsAvailable },
@@ -307,7 +323,11 @@ bool checkSourceAvailable(int source, uint32_t sourceTypes)
bool isSourceAvailable(int source)
{
return checkSourceAvailable(source,
SRC_COMMON | SRC_INPUT | SRC_LUA | SRC_HELI | SRC_CHANNEL | SRC_TX | SRC_TIMER | SRC_TELEM | SRC_NONE
SRC_COMMON | SRC_INPUT | SRC_LUA | SRC_HELI | SRC_CHANNEL | SRC_TX | SRC_TIMER | SRC_TELEM
#if defined(VOICE_CONTROL_SENSOR)
| SRC_VOICE
#endif
| SRC_NONE
);
}
@@ -341,6 +361,13 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
return false;
}
#if defined(VOICE_CONTROL_SENSOR)
bool voiceAvailable;
if (CI1302_voiceIntegrationIsSwitchAvailable(swtch, (int)context, &voiceAvailable)) {
return voiceAvailable;
}
#endif
if (!SWITCH_EXISTS(swinfo.quot)) {
return false;
}
@@ -418,6 +445,13 @@ static bool isSwitchSwitchAvailable(int swtch, bool invert) {
return false;
}
#if defined(VOICE_CONTROL_SENSOR)
bool voiceAvailable;
if (CI1302_voiceIntegrationIsSwitchSwitchAvailable(swtch, &voiceAvailable)) {
return voiceAvailable;
}
#endif
if (!SWITCH_EXISTS(swinfo.quot)) {
return false;
}