moved sync pulse sending to *before* periodic mixer processing
This should enable a more stable pulse sending to the module.
This commit is contained in:
@@ -1426,6 +1426,19 @@ void doMixerCalculations()
|
|||||||
DEBUG_TIMER_START(debugTimerEvalMixes);
|
DEBUG_TIMER_START(debugTimerEvalMixes);
|
||||||
evalMixes(tick10ms);
|
evalMixes(tick10ms);
|
||||||
DEBUG_TIMER_STOP(debugTimerEvalMixes);
|
DEBUG_TIMER_STOP(debugTimerEvalMixes);
|
||||||
|
}
|
||||||
|
|
||||||
|
void doMixerPeriodicUpdates()
|
||||||
|
{
|
||||||
|
static tmr10ms_t lastTMR = 0;
|
||||||
|
|
||||||
|
tmr10ms_t tmr10ms = get_tmr10ms();
|
||||||
|
|
||||||
|
uint8_t tick10ms = (tmr10ms >= lastTMR ? tmr10ms - lastTMR : 1);
|
||||||
|
// handle tick10ms overrun
|
||||||
|
// correct overflow handling costs a lot of code; happens only each 11 min;
|
||||||
|
// therefore forget the exact calculation and use only 1 instead; good compromise
|
||||||
|
lastTMR = tmr10ms;
|
||||||
|
|
||||||
DEBUG_TIMER_START(debugTimerMixes10ms);
|
DEBUG_TIMER_START(debugTimerMixes10ms);
|
||||||
if (tick10ms) {
|
if (tick10ms) {
|
||||||
|
|||||||
@@ -483,6 +483,7 @@ extern uint32_t nextMixerTime[NUM_MODULES];
|
|||||||
void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms);
|
void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms);
|
||||||
void evalMixes(uint8_t tick10ms);
|
void evalMixes(uint8_t tick10ms);
|
||||||
void doMixerCalculations();
|
void doMixerCalculations();
|
||||||
|
void doMixerPeriodicUpdates();
|
||||||
|
|
||||||
void checkTrims();
|
void checkTrims();
|
||||||
extern uint8_t currentBacklightBright;
|
extern uint8_t currentBacklightBright;
|
||||||
|
|||||||
+8
-3
@@ -168,12 +168,20 @@ TASK_FUNCTION(mixerTask)
|
|||||||
|
|
||||||
DEBUG_TIMER_START(debugTimerMixer);
|
DEBUG_TIMER_START(debugTimerMixer);
|
||||||
RTOS_LOCK_MUTEX(mixerMutex);
|
RTOS_LOCK_MUTEX(mixerMutex);
|
||||||
|
|
||||||
doMixerCalculations();
|
doMixerCalculations();
|
||||||
|
|
||||||
|
// TODO: fix runMask
|
||||||
|
sendSynchronousPulses((1 << INTERNAL_MODULE) | (1 << EXTERNAL_MODULE));
|
||||||
|
|
||||||
|
doMixerPeriodicUpdates();
|
||||||
|
|
||||||
DEBUG_TIMER_START(debugTimerMixerCalcToUsage);
|
DEBUG_TIMER_START(debugTimerMixerCalcToUsage);
|
||||||
DEBUG_TIMER_SAMPLE(debugTimerMixerIterval);
|
DEBUG_TIMER_SAMPLE(debugTimerMixerIterval);
|
||||||
RTOS_UNLOCK_MUTEX(mixerMutex);
|
RTOS_UNLOCK_MUTEX(mixerMutex);
|
||||||
DEBUG_TIMER_STOP(debugTimerMixer);
|
DEBUG_TIMER_STOP(debugTimerMixer);
|
||||||
|
|
||||||
|
|
||||||
#if defined(STM32) && !defined(SIMU)
|
#if defined(STM32) && !defined(SIMU)
|
||||||
if (getSelectedUsbMode() == USB_JOYSTICK_MODE) {
|
if (getSelectedUsbMode() == USB_JOYSTICK_MODE) {
|
||||||
usbJoystickUpdate();
|
usbJoystickUpdate();
|
||||||
@@ -202,9 +210,6 @@ TASK_FUNCTION(mixerTask)
|
|||||||
// between protocols with multi-proto RF
|
// between protocols with multi-proto RF
|
||||||
if (timeout)
|
if (timeout)
|
||||||
serialPrint("mix sched timeout!");
|
serialPrint("mix sched timeout!");
|
||||||
|
|
||||||
// TODO: fix runMask
|
|
||||||
sendSynchronousPulses((1 << INTERNAL_MODULE) | (1 << EXTERNAL_MODULE));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user