From 75ce4c2afa1ff580afd352440443987be0c3fe91 Mon Sep 17 00:00:00 2001 From: "bsongis@gmail.com" Date: Wed, 26 Jun 2013 15:52:01 +0000 Subject: [PATCH] [Taranis] DSM2 continued --- src/protocols/dsm2_arm.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/protocols/dsm2_arm.cpp b/src/protocols/dsm2_arm.cpp index 6550d8160..e8e24a3a1 100644 --- a/src/protocols/dsm2_arm.cpp +++ b/src/protocols/dsm2_arm.cpp @@ -56,10 +56,20 @@ uint8_t dsm2SerialBitCount; #define BITLEN_DSM2 (8*2) //125000 Baud => 8uS per bit #if defined(PCBTARANIS) +uint8_t dsm2Index = 0; void _send_1(uint8_t v) { dsm2Value += v; - *dsm2StreamPtr++ = dsm2Value; + + if (dsm2Index == 0) { + *(dsm2StreamPtr+1) = dsm2Value; + dsm2Index = 1; + } + else { + *dsm2StreamPtr = dsm2Value; + dsm2Index = 0; + dsm2StreamPtr += 2; + } } void sendByteDsm2(uint8_t b) //max 10changes 0 10 10 10 10 1 @@ -129,6 +139,7 @@ void setupPulsesDSM2(unsigned int port) dsm2SerialBitCount = 0 ; #else dsm2Value = 0; + dsm2Index = 0; #endif dsm2StreamPtr = dsm2Stream;