fix(simu): rotencDt must be updated as well (#2676)

The acceleration calculation is relying on it to compute dx/dt.
This commit is contained in:
Raphael Coeffic
2022-11-05 19:39:45 +10:00
committed by GitHub
parent 062564cc41
commit 4071eacc92
2 changed files with 22 additions and 3 deletions
+10
View File
@@ -466,6 +466,8 @@ void OpenTxSim::updateKeysAndSwitches(bool start)
#endif
}
extern volatile uint32_t rotencDt;
long OpenTxSim::onTimeout(FXObject*, FXSelector, void*)
{
if (hasFocus()) {
@@ -485,6 +487,14 @@ long OpenTxSim::onTimeout(FXObject*, FXSelector, void*)
else {
rotencAction = false;
}
static uint32_t last_tick = 0;
if (rotencAction) {
uint32_t now = RTOS_GET_MS();
uint32_t dt = now - last_tick;
rotencDt += dt;
last_tick = now;
}
#endif
}