1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 17:25:13 +03:00
This commit is contained in:
3djc 2021-05-11 17:52:50 +02:00
parent ef90933f66
commit 5ad3f95cdc
3 changed files with 24 additions and 4 deletions

View file

@ -140,21 +140,33 @@ TASK_FUNCTION(mixerTask)
mixerSchedulerStart();
#endif
// clear the flag before first loop
mixerSchedulerClearTrigger();
while (true) {
for (int timeout = 0; timeout < MIXER_MAX_PERIOD; timeout += MIXER_FREQUENT_ACTIONS_PERIOD) {
bool interruptedByTimeout = mixerSchedulerWaitForTrigger(MIXER_FREQUENT_ACTIONS_PERIOD);
int timeout = 0;
for (; timeout < MIXER_MAX_PERIOD; timeout += MIXER_FREQUENT_ACTIONS_PERIOD) {
// run periodicals before waiting for the trigger
// to keep the delay short
execMixerFrequentActions();
if (!interruptedByTimeout) {
// mixer flag triggered?
if (!mixerSchedulerWaitForTrigger(MIXER_FREQUENT_ACTIONS_PERIOD)) {
break;
}
}
#if defined(DEBUG_MIXER_SCHEDULER)
GPIO_SetBits(EXTMODULE_TX_GPIO, EXTMODULE_TX_GPIO_PIN);
GPIO_ResetBits(EXTMODULE_TX_GPIO, EXTMODULE_TX_GPIO_PIN);
#endif
#if !defined(PCBSKY9X)
// clear the flag ASAP to avoid missing a tick
mixerSchedulerClearTrigger();
// re-enable trigger
mixerSchedulerEnableTrigger();
#endif