From c91759166a9853f9bdd798186e4d6a7e39dc8c64 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sat, 1 Feb 2014 21:59:46 +0100 Subject: [PATCH] [all] Issue #626 fixed --- radio/src/opentx.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index ff3729fae..6103305d1 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -3802,15 +3802,6 @@ void doMixerCalculations() s_last_phase = phase; } - if (tick10ms) { -#if defined(CPUARM) - requiredSpeakerVolume = g_eeGeneral.speakerVolume + VOLUME_LEVEL_DEF; -#endif - - // the reason this needs to be done before limits is the applyLimit function; it checks for safety switches which would be not initialized otherwise - evalFunctions(); - } - int32_t weight = 0; if (s_fade_flight_phases) { memclear(sum_chans512, sizeof(sum_chans512)); @@ -3818,7 +3809,7 @@ void doMixerCalculations() s_last_switch_used = 0; if (s_fade_flight_phases & ((ACTIVE_PHASES_TYPE)1 << p)) { s_perout_flight_phase = p; - perOut(p==phase?e_perout_mode_normal:e_perout_mode_inactive_phase, p==phase?tick10ms:0); + perOut(p==phase ? e_perout_mode_normal : e_perout_mode_inactive_phase, p==phase ? tick10ms : 0); for (uint8_t i=0; i> 4) * fp_act[p]; weight += fp_act[p]; @@ -3832,7 +3823,17 @@ void doMixerCalculations() s_perout_flight_phase = phase; perOut(e_perout_mode_normal, tick10ms); } - + + //========== FUNCTIONS =============== + // must be done after mixing because some functions use the inputs/channels values + // must be done before limits because of the applyLimit function: it checks for safety switches which would be not initialized otherwise + if (tick10ms) { +#if defined(CPUARM) + requiredSpeakerVolume = g_eeGeneral.speakerVolume + VOLUME_LEVEL_DEF; +#endif + evalFunctions(); + } + //========== LIMITS =============== for (uint8_t i=0; i 1024*256 @@ -4983,7 +4984,9 @@ inline void opentxInit(OPENTX_INIT_ARGS) init_trainer_capture(); #endif +#if !defined(CPUARM) doMixerCalculations(); +#endif startPulses();