From 7d63dbf226c65e4dadf7586b6960249b27bd676c Mon Sep 17 00:00:00 2001 From: bsongis Date: Fri, 9 Nov 2012 10:00:28 +0000 Subject: [PATCH] [gruvin9x] DSM2-PPM better timings --- src/open9x.cpp | 4 ++-- src/open9x.h | 2 +- src/pulses_avr.cpp | 13 +++++-------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/open9x.cpp b/src/open9x.cpp index be65b10e2..d68e7fb98 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -97,7 +97,7 @@ uint8_t unexpectedShutdown = 0; uint16_t g_timeMainMax; #if defined(PCBGRUVIN9X) -uint8_t g_timeMainLast; +uint8_t lastMixerDuration; #endif #if defined(AUDIO) && !defined(PCBSKY9X) @@ -3040,7 +3040,7 @@ ISR(TIMER5_COMPA_vect, ISR_NOBLOCK) // mixer interrupt } t0 = getTmr16KHz() - t0; - g_timeMainLast = t0 / 8; + lastMixerDuration = t0 / 8; if (t0 > g_timeMainMax) g_timeMainMax = t0 ; cli(); diff --git a/src/open9x.h b/src/open9x.h index e6d0d168c..73b24365f 100644 --- a/src/open9x.h +++ b/src/open9x.h @@ -771,7 +771,7 @@ extern uint8_t g_tmr1Latency_max; extern uint8_t g_tmr1Latency_min; extern uint16_t g_timeMainMax; #if defined(PCBGRUVIN9X) -extern uint8_t g_timeMainLast; +extern uint8_t lastMixerDuration; #endif #if defined(THRTRACE) diff --git a/src/pulses_avr.cpp b/src/pulses_avr.cpp index 883b358cf..7e242fdb6 100644 --- a/src/pulses_avr.cpp +++ b/src/pulses_avr.cpp @@ -194,13 +194,6 @@ void setupPulsesPPM(uint8_t proto) uint8_t p = (proto == PROTO_PPM16 ? 16 : 8) + (g_model.ppmNCH * 2); //Channels *2 uint16_t q = (g_model.ppmDelay*50+300)*2; // Stoplen *2 uint32_t rest = 22500u*2 - q; // Minimum Framelen=22.5ms - -#if defined(PCBGRUVIN9X) - if (proto == PROTO_PPM) { - OCR5A = (uint16_t)0x7d * (45+g_model.ppmFrameLength-g_timeMainLast-2/*1ms*/); - TCNT5 = 0; - } -#endif rest += (int32_t(g_model.ppmFrameLength))*1000; for (uint8_t i=(proto==PROTO_PPM16) ? p-8 : 0; i