Skip to content

Commit

Permalink
fix(bw): use small switch layout when more than 6 switches (#4997)
Browse files Browse the repository at this point in the history
  • Loading branch information
philmoz authored May 15, 2024
1 parent 220d1b2 commit 7361302
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions radio/src/gui/128x64/view_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,24 +588,18 @@ void menuMainView(event_t event)
}
}

if (configured_switches < 9) {
if (configured_switches < 7) {
for (int i = 0; i < switches; ++i) {
if (SWITCH_EXISTS(i) && !switchIsFlex(i)) {
auto switch_display = switchGetDisplayPosition(i);
if (switch_display.row >= 3) {
drawSmallSwitch(switch_display.col == 0 ? 28 : 16 * FW + 1,
5 * FH + 1, 4, i);
}
else {
coord_t x = switch_display.col == 0 ? 3 * FW + 3 : 18 * FW + 1;
coord_t y = 33 + switch_display.row * FH;
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
if (val == 0) x -= 1;
getvalue_t sw =
((val < 0) ? 3 * i + 1
: ((val == 0) ? 3 * i + 2 : 3 * i + 3));
drawSwitch(x, y, sw, CENTERED, false);
}
coord_t x = switch_display.col == 0 ? 3 * FW + 3 : 18 * FW + 1;
coord_t y = 33 + switch_display.row * FH;
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
if (val == 0) x -= 1;
getvalue_t sw =
((val < 0) ? 3 * i + 1
: ((val == 0) ? 3 * i + 2 : 3 * i + 3));
drawSwitch(x, y, sw, CENTERED, false);
}
}
}
Expand All @@ -614,6 +608,7 @@ void menuMainView(event_t event)
if (SWITCH_EXISTS(i) && !switchIsFlex(i)) {
auto switch_display = switchGetDisplayPosition(i);
coord_t x = (switch_display.col == 0 ? 8 : 96) + switch_display.row * 5;
if (configured_switches < 9) x += 3;
drawSmallSwitch(x, 5 * FH + 1, 4, i);
}
}
Expand Down

0 comments on commit 7361302

Please sign in to comment.