fix(bw): use small switch layout when more than 6 switches (#4997)

This commit is contained in:
philmoz
2024-05-15 10:44:23 +10:00
committed by GitHub
parent 220d1b22f1
commit 7361302601
+10 -15
View File
@@ -588,24 +588,18 @@ void menuMainView(event_t event)
} }
} }
if (configured_switches < 9) { if (configured_switches < 7) {
for (int i = 0; i < switches; ++i) { for (int i = 0; i < switches; ++i) {
if (SWITCH_EXISTS(i) && !switchIsFlex(i)) { if (SWITCH_EXISTS(i) && !switchIsFlex(i)) {
auto switch_display = switchGetDisplayPosition(i); auto switch_display = switchGetDisplayPosition(i);
if (switch_display.row >= 3) { coord_t x = switch_display.col == 0 ? 3 * FW + 3 : 18 * FW + 1;
drawSmallSwitch(switch_display.col == 0 ? 28 : 16 * FW + 1, coord_t y = 33 + switch_display.row * FH;
5 * FH + 1, 4, i); getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
} if (val == 0) x -= 1;
else { getvalue_t sw =
coord_t x = switch_display.col == 0 ? 3 * FW + 3 : 18 * FW + 1; ((val < 0) ? 3 * i + 1
coord_t y = 33 + switch_display.row * FH; : ((val == 0) ? 3 * i + 2 : 3 * i + 3));
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i); drawSwitch(x, y, sw, CENTERED, false);
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);
}
} }
} }
} }
@@ -614,6 +608,7 @@ void menuMainView(event_t event)
if (SWITCH_EXISTS(i) && !switchIsFlex(i)) { if (SWITCH_EXISTS(i) && !switchIsFlex(i)) {
auto switch_display = switchGetDisplayPosition(i); auto switch_display = switchGetDisplayPosition(i);
coord_t x = (switch_display.col == 0 ? 8 : 96) + switch_display.row * 5; 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); drawSmallSwitch(x, 5 * FH + 1, 4, i);
} }
} }