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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user