1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 17:25:13 +03:00

[X9] Allow LSs 33-64 in main view & fix X9E view of channels 17-32 (#5486)

* [212x64] Main view toggle LS groups 1-32 and 33-64 with +/-/encoder. Closes #5476

* [212x64] Also allow encoder events in channels view for switching channels range (fix for X9E).

* Pad LS range numerals to 2 digits.
This commit is contained in:
Max Paperno 2017-12-09 02:20:07 -07:00 committed by Bertrand Songis
parent 2a0984408f
commit dec630efa0
2 changed files with 26 additions and 5 deletions

View file

@ -40,6 +40,10 @@ void menuChannelsView(event_t event)
break;
case EVT_KEY_FIRST(KEY_RIGHT):
case EVT_KEY_FIRST(KEY_LEFT):
#if defined(ROTARY_ENCODER_NAVIGATION)
case EVT_ROTARY_LEFT:
case EVT_ROTARY_RIGHT:
#endif
secondPage = !secondPage;
break;
case EVT_KEY_FIRST(KEY_ENTER):

View file

@ -433,6 +433,8 @@ int getSwitchCount()
void menuMainView(event_t event)
{
static bool secondPage = false;
STICK_SCROLL_DISABLE();
switch(event) {
@ -491,6 +493,15 @@ void menuMainView(event_t event)
}
#endif
break;
case EVT_KEY_FIRST(KEY_RIGHT):
case EVT_KEY_FIRST(KEY_LEFT):
#if defined(ROTARY_ENCODER_NAVIGATION)
case EVT_ROTARY_LEFT:
case EVT_ROTARY_RIGHT:
#endif
secondPage = !secondPage;
break;
}
// Flight Mode Name
@ -548,11 +559,17 @@ void menuMainView(event_t event)
}
else {
// Logical Switches
lcdDrawText(TRIM_RH_X - TRIM_LEN/2 + 5, 6*FH-1, "LS 1-32");
for (int sw=0; sw<32; ++sw) {
div_t qr = div(sw, 10);
uint8_t y = 13 + 11 * qr.quot;
uint8_t x = TRIM_RH_X - TRIM_LEN + qr.rem*5 + (qr.rem >= 5 ? 3 : 0);
int sw = (secondPage && MAX_LOGICAL_SWITCHES > 32 ? 32 : 0);
const int end = sw + 32;
uint8_t y = 6*FH-1;
lcdDrawText(TRIM_RH_X - TRIM_LEN/2 + 1, y, "LS");
lcdDrawNumber(lcdLastRightPos + 1, y, sw + 1, LEFT|LEADING0, 2);
lcdDrawText(lcdLastRightPos, y, "-");
lcdDrawNumber(lcdLastRightPos, y, end, LEFT);
for ( ; sw < end; ++sw) {
const div_t qr = div(sw + 32 - end, 10);
const uint8_t x = TRIM_RH_X - TRIM_LEN + qr.rem*5 + (qr.rem >= 5 ? 3 : 0);
y = 13 + 11 * qr.quot;
LogicalSwitchData * cs = lswAddress(sw);
if (cs->func == LS_FUNC_NONE) {
lcdDrawSolidHorizontalLine(x, y+6, 4);