From f94a25b22e2edac5aadab9f41dab9f64b5fd1f1e Mon Sep 17 00:00:00 2001 From: bsongis Date: Tue, 22 May 2012 14:07:47 +0000 Subject: [PATCH] No PPM was sent on protocol change (PPMSIM => any other) --- src/pulses_avr.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/pulses_avr.cpp b/src/pulses_avr.cpp index eaa109599..1e2002b17 100644 --- a/src/pulses_avr.cpp +++ b/src/pulses_avr.cpp @@ -693,11 +693,13 @@ static void setupPulsesPiccoZ(uint8_t chn) void setupPulses() { - if (s_current_protocol != g_model.protocol) { + uint8_t required_protocol = g_model.protocol; - s_current_protocol = g_model.protocol; + if (s_current_protocol != required_protocol) { - switch (g_model.protocol) { + s_current_protocol = required_protocol; + + switch (required_protocol) { #if defined(DSM2_PPM) case PROTO_DSM2: @@ -810,7 +812,7 @@ void setupPulses() } } - switch(g_model.protocol) { + switch(required_protocol) { #ifdef PXX case PROTO_PXX: @@ -996,8 +998,15 @@ ISR(TIMER3_COMPA_vect) //2MHz pulse generation ISR(TIMER3_COMPB_vect) //2MHz pulse generation { - sei() ; + sei() ; + if (s_current_protocol != g_model.protocol) { + if (s_current_protocol == PROTO_PPMSIM) { + setupPulses(); + } + } + else { setupPulsesPPM16(g_model.protocol) ; + } } #endif // SIMU