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

All X9E switches now working

This commit is contained in:
bsongis 2014-11-27 23:09:14 +01:00
parent 18a1006d4b
commit d64989baac
15 changed files with 520 additions and 295 deletions

View file

@ -808,28 +808,6 @@ void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
}
}
#if defined(PCBTARANIS)
div_t switchInfo(int switchPosition)
{
if (switchPosition <= SWSRC_SE2) {
return div(switchPosition-SWSRC_SA0, 3);
}
else if (switchPosition <= SWSRC_SF2) {
div_t qr = { 5, switchPosition == SWSRC_SF2 ? 2 : 0 };
return qr;
}
else if (switchPosition <= SWSRC_SG2) {
div_t qr = { 6, switchPosition-SWSRC_SG0 };
return qr;
}
else {
div_t qr = div(2*7+switchPosition-SWSRC_SH0, 2);
qr.rem *= 2;
return qr;
}
}
#endif
void putsSwitches(coord_t x, coord_t y, int8_t idx, LcdFlags att)
{
if (idx == SWSRC_OFF)
@ -844,7 +822,7 @@ void putsSwitches(coord_t x, coord_t y, int8_t idx, LcdFlags att)
}
#endif
#if defined(PCBTARANIS)
if (idx >= SWSRC_SA0 && idx <= SWSRC_SN2) {
if (idx >= SWSRC_FIRST_SWITCH && idx <= SWSRC_LAST_SWITCH) {
div_t swinfo = switchInfo(idx);
if (ZEXIST(g_eeGeneral.switchNames[swinfo.quot])) {
lcd_putsnAtt(x, y, g_eeGeneral.switchNames[swinfo.quot], LEN_SWITCH_NAME, ZCHAR|att);