[Taranis] 6Pos switch support is now ok. Calibration is automatic. More

tests needed
This commit is contained in:
Bertrand Songis
2014-01-12 12:57:14 +01:00
parent 1dff05dc02
commit a292fabb02
6 changed files with 94 additions and 46 deletions
+8 -2
View File
@@ -1265,8 +1265,14 @@ bool isSwitchAvailable(int16_t swtch)
#if defined(PCBTARANIS)
if (swtch >= SWSRC_P11 && swtch <= SWSRC_P26) {
int index = (swtch - SWSRC_P11) / 6;
return (g_eeGeneral.potsType & (1<<index));
int index = (swtch - SWSRC_P11) / POTS_POS_COUNT;
if (g_eeGeneral.potsType & (1<<index)) {
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[POT1+index];
return (calib->count >= ((swtch - SWSRC_P11) % POTS_POS_COUNT));
}
else {
return false;
}
}
#endif