mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 01:35:21 +03:00
Fix xliteS/Pro switch warning, making it handle switch types properly
This commit is contained in:
parent
177cc6e866
commit
42f5d17baa
1 changed files with 10 additions and 9 deletions
|
@ -164,7 +164,7 @@ enum MenuModelSetupItems {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBXLITE)
|
#if defined(PCBXLITE)
|
||||||
#define SW_WARN_ROWS uint8_t(NAVIGATION_LINE_BY_LINE|getSwitchWarningsCount()), uint8_t(getSwitchWarningsCount() > 5 ? TITLE_ROW : HIDDEN_ROW) // X-Lite needs an additional column for full line selection (<])
|
#define SW_WARN_ROWS uint8_t(NAVIGATION_LINE_BY_LINE|getSwitchWarningsCount()), uint8_t(getSwitchWarningsCount() > 4 ? TITLE_ROW : HIDDEN_ROW) // X-Lite needs an additional column for full line selection (<])
|
||||||
#else
|
#else
|
||||||
#define SW_WARN_ROWS uint8_t(NAVIGATION_LINE_BY_LINE|(getSwitchWarningsCount()-1)), uint8_t(getSwitchWarningsCount() > 5 ? TITLE_ROW : HIDDEN_ROW)
|
#define SW_WARN_ROWS uint8_t(NAVIGATION_LINE_BY_LINE|(getSwitchWarningsCount()-1)), uint8_t(getSwitchWarningsCount() > 5 ? TITLE_ROW : HIDDEN_ROW)
|
||||||
#endif
|
#endif
|
||||||
|
@ -803,10 +803,11 @@ void menuModelSetup(event_t event)
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
{
|
{
|
||||||
#define FIRSTSW_STR STR_VSRCRAW+(MIXSRC_FIRST_SWITCH-MIXSRC_Rud+1)*length
|
#define FIRSTSW_STR STR_VSRCRAW+(MIXSRC_FIRST_SWITCH-MIXSRC_Rud+1)*length
|
||||||
|
uint8_t switchWarningsCount = getSwitchWarningsCount();
|
||||||
uint8_t length = STR_VSRCRAW[0];
|
uint8_t length = STR_VSRCRAW[0];
|
||||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||||
|
|
||||||
if (i>=NUM_BODY_LINES-2 && getSwitchWarningsCount() > 5*(NUM_BODY_LINES-i)) {
|
if (i>=NUM_BODY_LINES-2 && getSwitchWarningsCount() > 4*(NUM_BODY_LINES-i)) {
|
||||||
if (CURSOR_MOVED_LEFT(event))
|
if (CURSOR_MOVED_LEFT(event))
|
||||||
menuVerticalOffset--;
|
menuVerticalOffset--;
|
||||||
else
|
else
|
||||||
|
@ -821,10 +822,10 @@ void menuModelSetup(event_t event)
|
||||||
#if defined(PCBXLITE)
|
#if defined(PCBXLITE)
|
||||||
lcdDrawText(LCD_W, y, "<]", RIGHT);
|
lcdDrawText(LCD_W, y, "<]", RIGHT);
|
||||||
if (attr) {
|
if (attr) {
|
||||||
if (menuHorizontalPosition > NUM_SWITCHES)
|
if (menuHorizontalPosition > switchWarningsCount)
|
||||||
menuHorizontalPosition = NUM_SWITCHES;
|
menuHorizontalPosition = switchWarningsCount;
|
||||||
}
|
}
|
||||||
if (attr && menuHorizontalPosition == NUM_SWITCHES) {
|
if (attr && menuHorizontalPosition == switchWarningsCount) {
|
||||||
#else
|
#else
|
||||||
if (attr) {
|
if (attr) {
|
||||||
#endif
|
#endif
|
||||||
|
@ -835,7 +836,7 @@ void menuModelSetup(event_t event)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_LONG(KEY_ENTER):
|
case EVT_KEY_LONG(KEY_ENTER):
|
||||||
if (menuHorizontalPosition < 0 || menuHorizontalPosition >= NUM_SWITCHES) {
|
if (menuHorizontalPosition < 0 || menuHorizontalPosition >= switchWarningsCount) {
|
||||||
START_NO_HIGHLIGHT();
|
START_NO_HIGHLIGHT();
|
||||||
getMovedSwitch();
|
getMovedSwitch();
|
||||||
g_model.switchWarningState = switches_states;
|
g_model.switchWarningState = switches_states;
|
||||||
|
@ -851,9 +852,9 @@ void menuModelSetup(event_t event)
|
||||||
LcdFlags line = attr;
|
LcdFlags line = attr;
|
||||||
|
|
||||||
int current = 0;
|
int current = 0;
|
||||||
for (int i=0; i<NUM_SWITCHES; i++) {
|
for (int i=0; i<switchWarningsCount; i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
div_t qr = div(current, 5);
|
div_t qr = div(current, 4);
|
||||||
if (!READ_ONLY() && event==EVT_KEY_BREAK(KEY_ENTER) && line && l_posHorz==current && old_editMode) {
|
if (!READ_ONLY() && event==EVT_KEY_BREAK(KEY_ENTER) && line && l_posHorz==current && old_editMode) {
|
||||||
g_model.switchWarningEnable ^= (1 << i);
|
g_model.switchWarningEnable ^= (1 << i);
|
||||||
storageDirty(EE_MODEL);
|
storageDirty(EE_MODEL);
|
||||||
|
@ -870,7 +871,7 @@ void menuModelSetup(event_t event)
|
||||||
}
|
}
|
||||||
states >>= 2;
|
states >>= 2;
|
||||||
}
|
}
|
||||||
if (attr && ((menuHorizontalPosition < 0) || menuHorizontalPosition >= NUM_SWITCHES)) {
|
if (attr && ((menuHorizontalPosition < 0) || menuHorizontalPosition >= switchWarningsCount)) {
|
||||||
lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, 8*(2*FW+1), 1+FH*((current+4)/5));
|
lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, 8*(2*FW+1), 1+FH*((current+4)/5));
|
||||||
}
|
}
|
||||||
#else // PCBTARANIS
|
#else // PCBTARANIS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue