1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 14:25:11 +03:00

Bug on ID2 fixed

This commit is contained in:
Bertrand Songis 2014-02-10 10:22:12 +01:00
parent dc660d4ade
commit 12997bd169
3 changed files with 16 additions and 25 deletions

View file

@ -1293,7 +1293,7 @@ class SwitchesWarningField: public TransformedField {
virtual void beforeExport() virtual void beforeExport()
{ {
bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version); bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version);
if (release21March2013) { if (release21March2013 && version < 216) {
_sw = (sw & 0xC1) + ((sw & 0x30) >> 3) + ((sw & 0x0E) << 2); _sw = (sw & 0xC1) + ((sw & 0x30) >> 3) + ((sw & 0x0E) << 2);
} }
else { else {
@ -1304,7 +1304,7 @@ class SwitchesWarningField: public TransformedField {
virtual void afterImport() virtual void afterImport()
{ {
bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version); bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version);
if (release21March2013) { if (release21March2013 && version < 216) {
sw = (_sw & 0xC1) + ((_sw & 0x38) >> 2) + ((_sw & 0x06) << 3); sw = (_sw & 0xC1) + ((_sw & 0x38) >> 2) + ((_sw & 0x06) << 3);
} }
else { else {
@ -1941,10 +1941,6 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
internalField.Append(new MavlinkField(modelData.mavlink, board, version)); internalField.Append(new MavlinkField(modelData.mavlink, board, version));
} }
if (!IS_ARM(board) && (version >= 216)) {
internalField.Append(new UnsignedField<8>(modelData.nSwToWarn));
}
if (IS_TARANIS(board) && version < 215) { if (IS_TARANIS(board) && version < 215) {
internalField.Append(new CharField<10>(modelData.bitmap)); internalField.Append(new CharField<10>(modelData.bitmap));
} }

View file

@ -588,12 +588,11 @@ void Setup::updateStartupSwitches()
lock = true; lock = true;
unsigned int switchStates = model.switchWarningStates; unsigned int switchStates = model.switchWarningStates;
bool enabled;
for (int i=0; i<GetEepromInterface()->getCapability(Switches)-1; i++) { for (int i=0; i<GetEepromInterface()->getCapability(Switches)-1; i++) {
QSlider * slider = startupSwitchesSliders[i]; QSlider * slider = startupSwitchesSliders[i];
QCheckBox * cb = startupSwitchesCheckboxes[i]; QCheckBox * cb = startupSwitchesCheckboxes[i];
enabled = !(model.nSwToWarn & (1 << i)); bool enabled = !(model.nSwToWarn & (1 << i));
slider->setEnabled(enabled); slider->setEnabled(enabled);
cb->setChecked(enabled); cb->setChecked(enabled);
if (IS_TARANIS(GetEepromInterface()->getBoard())) { if (IS_TARANIS(GetEepromInterface()->getBoard())) {
@ -640,13 +639,8 @@ void Setup::startupSwitchEdited(int value)
model.switchWarningStates &= ~mask; model.switchWarningStates &= ~mask;
if (value) { if (value) {
if (shift == 0) {
model.switchWarningStates |= value;
}
else {
model.switchWarningStates |= (value << shift); model.switchWarningStates |= (value << shift);
} }
}
updateStartupSwitches(); updateStartupSwitches();
emit modified(); emit modified();

View file

@ -1174,6 +1174,7 @@ void menuModelSetup(uint8_t event)
} }
#endif #endif
break; break;
case EVT_KEY_LONG(KEY_ENTER): case EVT_KEY_LONG(KEY_ENTER):
#if defined(CPUM64) #if defined(CPUM64)
getMovedSwitch(); getMovedSwitch();
@ -1211,7 +1212,7 @@ void menuModelSetup(uint8_t event)
states >>= 2; states >>= 2;
} }
else { else {
if (states & 0x01 && swactive) if ((states & 0x01) && swactive)
attr = INVERS; attr = INVERS;
c = pgm_read_byte(STR_VSWITCHES - 2 + 9 + (3*i)); c = pgm_read_byte(STR_VSWITCHES - 2 + 9 + (3*i));
states >>= 1; states >>= 1;