[Simulator] Fix trims issue with AVR simulators (build failure since 57dc015); Fix possible array bounds issue if data is corrupt.

This commit is contained in:
Max Paperno
2017-04-07 03:50:40 -04:00
parent 3a8f9adb4d
commit 629d82fe27
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -211,6 +211,7 @@ void OpenTxSimulator::setTrim(unsigned int idx, int value)
i = modn12x3[4 * getStickMode() + idx];
uint8_t phase = getTrimFlightMode(getFlightMode(), i);
#ifdef CPUARM
if (!setTrimValue(phase, i, value)) {
QTimer *timer = new QTimer(this);
timer->setSingleShot(true);
@@ -221,6 +222,9 @@ void OpenTxSimulator::setTrim(unsigned int idx, int value)
});
timer->start(350);
}
#else
setTrimValue(phase, i, value);
#endif
}
void OpenTxSimulator::setTrainerInput(unsigned int inputNumber, int16_t value)
@@ -405,7 +409,7 @@ void OpenTxSimulator::removeTracebackDevice(QIODevice * device)
}
/*** Protected classes ***/
/*** Protected functions ***/
void OpenTxSimulator::run()
{