[gruvin9x] DSM2-PPM better timings
This commit is contained in:
+2
-2
@@ -97,7 +97,7 @@ uint8_t unexpectedShutdown = 0;
|
|||||||
|
|
||||||
uint16_t g_timeMainMax;
|
uint16_t g_timeMainMax;
|
||||||
#if defined(PCBGRUVIN9X)
|
#if defined(PCBGRUVIN9X)
|
||||||
uint8_t g_timeMainLast;
|
uint8_t lastMixerDuration;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(AUDIO) && !defined(PCBSKY9X)
|
#if defined(AUDIO) && !defined(PCBSKY9X)
|
||||||
@@ -3040,7 +3040,7 @@ ISR(TIMER5_COMPA_vect, ISR_NOBLOCK) // mixer interrupt
|
|||||||
}
|
}
|
||||||
|
|
||||||
t0 = getTmr16KHz() - t0;
|
t0 = getTmr16KHz() - t0;
|
||||||
g_timeMainLast = t0 / 8;
|
lastMixerDuration = t0 / 8;
|
||||||
if (t0 > g_timeMainMax) g_timeMainMax = t0 ;
|
if (t0 > g_timeMainMax) g_timeMainMax = t0 ;
|
||||||
|
|
||||||
cli();
|
cli();
|
||||||
|
|||||||
+1
-1
@@ -771,7 +771,7 @@ extern uint8_t g_tmr1Latency_max;
|
|||||||
extern uint8_t g_tmr1Latency_min;
|
extern uint8_t g_tmr1Latency_min;
|
||||||
extern uint16_t g_timeMainMax;
|
extern uint16_t g_timeMainMax;
|
||||||
#if defined(PCBGRUVIN9X)
|
#if defined(PCBGRUVIN9X)
|
||||||
extern uint8_t g_timeMainLast;
|
extern uint8_t lastMixerDuration;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(THRTRACE)
|
#if defined(THRTRACE)
|
||||||
|
|||||||
+5
-8
@@ -195,13 +195,6 @@ void setupPulsesPPM(uint8_t proto)
|
|||||||
uint16_t q = (g_model.ppmDelay*50+300)*2; // Stoplen *2
|
uint16_t q = (g_model.ppmDelay*50+300)*2; // Stoplen *2
|
||||||
uint32_t rest = 22500u*2 - q; // Minimum Framelen=22.5ms
|
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;
|
rest += (int32_t(g_model.ppmFrameLength))*1000;
|
||||||
for (uint8_t i=(proto==PROTO_PPM16) ? p-8 : 0; i<p; i++) {
|
for (uint8_t i=(proto==PROTO_PPM16) ? p-8 : 0; i<p; i++) {
|
||||||
#ifdef PPM_CENTER_ADJUSTABLE
|
#ifdef PPM_CENTER_ADJUSTABLE
|
||||||
@@ -891,7 +884,7 @@ void setupPulses()
|
|||||||
#ifdef DSM2
|
#ifdef DSM2
|
||||||
case PROTO_DSM2:
|
case PROTO_DSM2:
|
||||||
#if defined(PCBGRUVIN9X)
|
#if defined(PCBGRUVIN9X)
|
||||||
OCR5A = (uint16_t)0x7d * (40-g_timeMainLast-2/*1ms*/);
|
OCR5A = (uint16_t)0x7d * (44-lastMixerDuration-2/*1ms*/);
|
||||||
TCNT5 = 0;
|
TCNT5 = 0;
|
||||||
#endif
|
#endif
|
||||||
sei();
|
sei();
|
||||||
@@ -913,6 +906,10 @@ void setupPulses()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
#if defined(PCBGRUVIN9X)
|
||||||
|
OCR5A = (uint16_t)0x7d * (45+g_model.ppmFrameLength-lastMixerDuration-2/*1ms*/);
|
||||||
|
TCNT5 = 0;
|
||||||
|
#endif
|
||||||
// no sei here
|
// no sei here
|
||||||
setupPulsesPPM(PROTO_PPM);
|
setupPulsesPPM(PROTO_PPM);
|
||||||
// if PPM16, PPM16 pulses are set up automatically within the interrupts
|
// if PPM16, PPM16 pulses are set up automatically within the interrupts
|
||||||
|
|||||||
Reference in New Issue
Block a user