fix(bw): navigation for main view, logical switches and special functions (#5601)

This commit is contained in:
philmoz
2024-10-11 10:16:11 +10:00
committed by GitHub
parent 7f727cb15c
commit 49734e4336
7 changed files with 57 additions and 44 deletions
-2
View File
@@ -152,8 +152,6 @@ void readModelNotes();
void menuChannelsView(event_t event);
void menuChannelsViewCommon(event_t event);
void repeatLastCursorMove(event_t event);
#define EDIT_MODE_INIT 0
extern uint8_t editNameCursorPos;
+21 -15
View File
@@ -66,13 +66,27 @@ void menuModelLogicalSwitchOne(event_t event)
drawSwitch(14*FW, 0, sw, (getSwitch(sw) ? BOLD : 0));
SUBMENU_NOTITLE(LS_FIELD_COUNT, { 0, 0, uint8_t(cstate == LS_FAMILY_EDGE ? 1 : 0), 0 /*, 0...*/ });
SUBMENU_NOTITLE(LS_FIELD_COUNT, {
0,
0,
uint8_t(cstate == LS_FAMILY_EDGE ? 1 : 0),
0,
0,
uint8_t(cstate == LS_FAMILY_EDGE ? HIDDEN_ROW : 0),
uint8_t(cstate != LS_FAMILY_STICKY ? HIDDEN_ROW : 0),
});
int8_t sub = menuVerticalPosition;
coord_t y = MENU_HEADER_HEIGHT + 1;
for (uint8_t k=0; k<LCD_LINES-1; k++) {
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
uint8_t i = k + menuVerticalOffset;
for (int j=0; j<=i; ++j) {
if (j<(int)DIM(mstate_tab) && mstate_tab[j] == HIDDEN_ROW) {
++i;
}
}
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
switch (i) {
@@ -142,7 +156,6 @@ void menuModelLogicalSwitchOne(event_t event)
}
else if (cstate == LS_FAMILY_EDGE) {
putsEdgeDelayParam(CSWONE_2ND_COLUMN+5, y, cs, menuHorizontalPosition==0 ? attr : 0, menuHorizontalPosition==1 ? attr : 0);
if (s_editMode <= 0) continue;
if (attr && menuHorizontalPosition==1) {
CHECK_INCDEC_MODELVAR(event, cs->v3, -1, 222 - cs->v2);
break;
@@ -205,13 +218,6 @@ void menuModelLogicalSwitchOne(event_t event)
case LS_FIELD_DELAY:
lcdDrawTextAlignedLeft(y, STR_DELAY);
if (cstate == LS_FAMILY_EDGE) {
lcdDrawText(CSWONE_2ND_COLUMN, y, STR_NA);
if (attr) {
repeatLastCursorMove(event);
}
break;
}
if (cs->delay > 0)
lcdDrawNumber(CSWONE_2ND_COLUMN, y, cs->delay, attr|PREC1|LEFT);
else
@@ -222,13 +228,13 @@ void menuModelLogicalSwitchOne(event_t event)
break;
case LS_FIELD_PERSIST:
if (cstate == LS_FAMILY_STICKY) {
lcdDrawTextAlignedLeft(y, STR_PERSISTENT);
drawCheckBox(CSWONE_2ND_COLUMN, y, cs->lsPersist, attr);
if (attr) cs->lsPersist = checkIncDecModel(event, cs->lsPersist, 0, 1);
}
lcdDrawTextAlignedLeft(y, STR_PERSISTENT);
drawCheckBox(CSWONE_2ND_COLUMN, y, cs->lsPersist, attr);
if (attr) cs->lsPersist = checkIncDecModel(event, cs->lsPersist, 0, 1);
break;
}
y += FH;
}
}
@@ -234,7 +234,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
else {
j = 5; // skip other fields
if (sub==k && menuHorizontalPosition > 0) {
repeatLastCursorMove(event);
repeatLastCursorHorMove(event);
}
}
break;
@@ -279,7 +279,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
}
#endif
else if (attr) {
repeatLastCursorMove(event);
repeatLastCursorHorMove(event);
}
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_CH_INDEX(cfn), maxParam);
break;
@@ -453,7 +453,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
}
#endif // GVARS
else if (attr) {
repeatLastCursorMove(event);
repeatLastCursorHorMove(event);
}
#if defined(NAVIGATION_X7)
if (active || event==EVT_KEY_LONG(KEY_ENTER)) {
@@ -500,7 +500,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
}
}
else if (attr) {
repeatLastCursorMove(event);
repeatLastCursorHorMove(event);
}
break;
+3 -21
View File
@@ -301,8 +301,9 @@ void displayBattVoltage()
#define displayVoltageOrAlarm() displayBattVoltage()
#if defined(RADIO_T8) || defined(RADIO_COMMANDO8)
#define EVT_KEY_CONTEXT_MENU EVT_KEY_LONG(KEY_ENTER)
#if defined(RADIO_T8) || defined(RADIO_COMMANDO8)
#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_KEY_BREAK(KEY_PLUS)
@@ -311,7 +312,6 @@ void displayBattVoltage()
#define EVT_KEY_GENERAL_MENU EVT_KEY_BREAK(KEY_SYS)
#define EVT_KEY_TELEMETRY EVT_KEY_LONG(KEY_PAGEUP)
#elif defined(NAVIGATION_X7_TX12)
#define EVT_KEY_CONTEXT_MENU EVT_KEY_LONG(KEY_ENTER)
#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
@@ -319,32 +319,14 @@ void displayBattVoltage()
#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_BREAK(KEY_TELE)
#elif defined(NAVIGATION_X7) || defined(NAVIGATION_TBS)
#define EVT_KEY_CONTEXT_MENU EVT_KEY_LONG(KEY_ENTER)
#elif defined(NAVIGATION_X7) || defined(NAVIGATION_TBS)
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_PAGEDN)
#define EVT_KEY_NEXT_PAGE EVT_ROTARY_RIGHT
#define EVT_KEY_PREVIOUS_PAGE EVT_ROTARY_LEFT
#define EVT_KEY_MODEL_MENU EVT_KEY_BREAK(KEY_MENU)
#define EVT_KEY_GENERAL_MENU EVT_KEY_LONG(KEY_MENU)
#define EVT_KEY_TELEMETRY EVT_KEY_BREAK(KEY_PAGEUP)
#elif defined(NAVIGATION_XLITE)
#define EVT_KEY_CONTEXT_MENU EVT_KEY_LONG(KEY_ENTER)
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_BREAK(KEY_UP)
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_DOWN)
#define EVT_KEY_NEXT_PAGE EVT_KEY_BREAK(KEY_RIGHT)
#define EVT_KEY_PREVIOUS_PAGE EVT_KEY_BREAK(KEY_LEFT)
#define EVT_KEY_MODEL_MENU EVT_KEY_LONG(KEY_RIGHT)
#define EVT_KEY_GENERAL_MENU EVT_KEY_LONG(KEY_LEFT)
#define EVT_KEY_TELEMETRY EVT_KEY_LONG(KEY_DOWN)
#define EVT_KEY_STATISTICS EVT_KEY_LONG(KEY_UP)
#else
#if defined(NAVIGATION_9X)
#define EVT_KEY_CONTEXT_MENU EVT_KEY_BREAK(KEY_ENTER)
#define EVT_KEY_LAST_MENU EVT_KEY_LONG(KEY_ENTER)
#else
#define EVT_KEY_CONTEXT_MENU EVT_KEY_BREAK(KEY_MENU)
#define EVT_KEY_LAST_MENU EVT_KEY_LONG(KEY_MENU)
#endif
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_BREAK(KEY_UP)
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_DOWN)
#define EVT_KEY_NEXT_PAGE EVT_KEY_BREAK(KEY_RIGHT)
-2
View File
@@ -168,8 +168,6 @@ void readModelNotes();
void menuChannelsView(event_t event);
void repeatLastCursorMove(event_t event);
#define EDIT_MODE_INIT 0
void onSwitchLongEnterPress(const char *result);
+24
View File
@@ -56,6 +56,30 @@ void repeatLastCursorMove(event_t event)
}
}
#if defined(NAVIGATION_9X) || defined(NAVIGATION_XLITE)
inline bool IS_NEXT_HOR_MOVE_EVENT(event_t evt)
{
return evt == EVT_KEY_FIRST(KEY_RIGHT) || evt == EVT_KEY_REPT(KEY_RIGHT) ||
evt == EVT_ROTARY_RIGHT;
}
inline bool IS_PREVIOUS_HOR_MOVE_EVENT(event_t evt)
{
return evt == EVT_KEY_FIRST(KEY_LEFT) || evt == EVT_KEY_REPT(KEY_LEFT) ||
evt == EVT_ROTARY_LEFT;
}
void repeatLastCursorHorMove(event_t event)
{
if (IS_PREVIOUS_HOR_MOVE_EVENT(event) || IS_NEXT_HOR_MOVE_EVENT(event)) {
pushEvent(event);
}
else {
menuHorizontalPosition = 0;
}
}
#endif
void onSwitchLongEnterPress(const char * result)
{
if (result == STR_MENU_SWITCHES) {
+5
View File
@@ -142,6 +142,11 @@ swsrc_t checkIncDecMovedSwitch(swsrc_t val);
#endif
void repeatLastCursorMove(event_t event);
#if defined(NAVIGATION_9X) || defined(NAVIGATION_XLITE)
void repeatLastCursorHorMove(event_t event);
#else
#define repeatLastCursorHorMove(event) repeatLastCursorMove(event)
#endif
void onSwitchLongEnterPress(const char * result);
void onSourceLongEnterPress(const char * result);