1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-17 13:25:20 +03:00

PXX2 continued + simu segfault fix

This commit is contained in:
Bertrand Songis 2019-02-05 13:03:02 +01:00
parent 9aa75b1056
commit 807bc8bc2e
8 changed files with 107 additions and 78 deletions

View file

@ -179,8 +179,19 @@ TASK_FUNCTION(mixerTask)
void scheduleNextMixerCalculation(uint8_t module, uint16_t period_ms)
{
// Schedule next mixer calculation time,
// for now assume mixer calculation takes 2 ms.
nextMixerTime[module] = (uint32_t)RTOS_GET_TIME() + (period_ms / RTOS_MS_PER_TICK) - 1 /* 1 tick in advance*/;
if (isProtocolSynchronous(s_current_protocol[module])) {
nextMixerTime[module] += period_ms / RTOS_MS_PER_TICK;
if (nextMixerTime[module] < RTOS_GET_TIME()) {
// we are late ... let's add some small delay
nextMixerTime[module] = (uint32_t) RTOS_GET_TIME() + (period_ms / RTOS_MS_PER_TICK);
}
}
else {
// for now assume mixer calculation takes 2 ms.
nextMixerTime[module] = (uint32_t) RTOS_GET_TIME() + (period_ms / RTOS_MS_PER_TICK) - 1 /* 1 tick in advance*/;
}
DEBUG_TIMER_STOP(debugTimerMixerCalcToUsage);
}