1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 06:15:10 +03:00

Issue #592 - AND switch bug on 9x stock

This commit is contained in:
Bertrand Songis 2014-02-06 16:23:48 +01:00
parent 38129abd43
commit 01242e2b78
2 changed files with 16 additions and 1 deletions

View file

@ -4550,8 +4550,16 @@ void menuModelCustomSwitches(uint8_t event)
#endif
}
// CSW and switch
// CSW AND switch
#if defined(CPUARM)
putsSwitches(CSW_4TH_COLUMN, y, cs->andsw, horz==3 ? attr : 0);
#else
uint8_t andsw = cs->andsw;
if (andsw > SWSRC_LAST_SWITCH) {
andsw += SWSRC_SW1-SWSRC_LAST_SWITCH-1;
}
putsSwitches(CSW_4TH_COLUMN, y, andsw, horz==3 ? attr : 0);
#endif
#if defined(CPUARM)
// CSW duration

View file

@ -1414,7 +1414,14 @@ bool getSwitch(int8_t swtch)
s_last_switch_used |= mask;
CustomSwData * cs = cswAddress(cs_idx);
#if defined(CPUARM)
int8_t s = cs->andsw;
#else
uint8_t s = cs->andsw;
if (s > SWSRC_LAST_SWITCH) {
s += SWSRC_SW1-SWSRC_LAST_SWITCH-1;
}
#endif
if (cs->func == CS_OFF || (s && !getSwitch(s))) {
csLastValue[cs_idx] = CS_LAST_VALUE_INIT;
result = false;