[gruvin9x] DSM2-PPM better timings
This commit is contained in:
+5
-8
@@ -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<p; i++) {
|
||||
@@ -891,7 +884,7 @@ void setupPulses()
|
||||
#ifdef DSM2
|
||||
case PROTO_DSM2:
|
||||
#if defined(PCBGRUVIN9X)
|
||||
OCR5A = (uint16_t)0x7d * (40-g_timeMainLast-2/*1ms*/);
|
||||
OCR5A = (uint16_t)0x7d * (44-lastMixerDuration-2/*1ms*/);
|
||||
TCNT5 = 0;
|
||||
#endif
|
||||
sei();
|
||||
@@ -913,6 +906,10 @@ void setupPulses()
|
||||
#endif
|
||||
|
||||
default:
|
||||
#if defined(PCBGRUVIN9X)
|
||||
OCR5A = (uint16_t)0x7d * (45+g_model.ppmFrameLength-lastMixerDuration-2/*1ms*/);
|
||||
TCNT5 = 0;
|
||||
#endif
|
||||
// no sei here
|
||||
setupPulsesPPM(PROTO_PPM);
|
||||
// if PPM16, PPM16 pulses are set up automatically within the interrupts
|
||||
|
||||
Reference in New Issue
Block a user