1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 09:45:21 +03:00

Allow PCBSKY9X compilation

This commit is contained in:
3djc 2021-04-04 19:00:01 +02:00
parent ba887720bf
commit 78dd516069
4 changed files with 73 additions and 2 deletions

View file

@ -118,7 +118,9 @@ TASK_FUNCTION(mixerTask)
s_pulses_paused = true;
mixerSchedulerInit();
#if !defined(PCBSKY9X)
mixerSchedulerStart();
#endif
while (true) {
#if defined(SBUS_TRAINER)
@ -142,8 +144,10 @@ TASK_FUNCTION(mixerTask)
GPIO_ResetBits(EXTMODULE_TX_GPIO, EXTMODULE_TX_GPIO_PIN);
#endif
#if !defined(PCBSKY9X)
// re-enable trigger
mixerSchedulerEnableTrigger();
#endif
#if defined(SIMU)
if (pwrCheck() == e_power_off) {
@ -164,7 +168,11 @@ TASK_FUNCTION(mixerTask)
doMixerCalculations();
// TODO: fix runMask
#if defined(PCBSKY9X)
sendSynchronousPulses(1 << EXTERNAL_MODULE);
#else
sendSynchronousPulses((1 << INTERNAL_MODULE) | (1 << EXTERNAL_MODULE));
#endif
doMixerPeriodicUpdates();
@ -200,12 +208,32 @@ TASK_FUNCTION(mixerTask)
// TODO:
// - check the cause of timeouts when switching
// between protocols with multi-proto RF
#if defined(DEBUG)
if (timeout)
serialPrint("mix sched timeout!");
#endif
}
}
}
void scheduleNextMixerCalculation(uint8_t module, uint32_t period_ms)
{
// Schedule next mixer calculation time,
if (isModuleSynchronous(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);
}
DEBUG_TIMER_STOP(debugTimerMixerCalcToUsage);
}
#define MENU_TASK_PERIOD_TICKS (50 / RTOS_MS_PER_TICK) // 50ms