From e193963c938c5a8266fc985029725ee63043327b Mon Sep 17 00:00:00 2001 From: "gruvin@gmail.com" Date: Fri, 24 Aug 2012 02:10:43 +0000 Subject: [PATCH] LPXDSM2, DSM2only, DSMX protocol differences taken from DSM2=PPM code and added to DSM2=SERIAL code. Hopefully also fixed DSMX mode bind omission from previous commit. IMPORTANT: I do not have a DSMX module for testing -- only DSM2. Can someone with DSM2=PPM mode and DSMX please test and confirm that both bind and range check mode are working. Thanks. --- src/pulses_avr.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/pulses_avr.cpp b/src/pulses_avr.cpp index 80a3b0dad..bdc98a0b8 100644 --- a/src/pulses_avr.cpp +++ b/src/pulses_avr.cpp @@ -421,21 +421,33 @@ normal: FORCEINLINE void setupPulsesDsm2() { uint16_t *ptr = (uint16_t *)pulses2MHz; + switch(g_model.ppmNCH) + { + case LPXDSM2: + *ptr = 0x00; + break; + case DSM2only: + *ptr = 0x10; + break; + default: + *ptr = 0x18; // DSMX bind mode + break; + } + if (s_bind_allowed) s_bind_allowed--; if (s_bind_allowed && keyState(SW_Trainer)) { s_bind_mode = true; - *ptr++ = BIND_BIT; + *ptr |= BIND_BIT; } else if (s_rangecheck_mode) { - *ptr++ = RANGECHECK_BIT; + *ptr |= RANGECHECK_BIT; } else - { s_bind_mode = false; - *ptr++ = 0x00; - } + ++*ptr; + *ptr++ = g_model.modelId; for (uint8_t i=0; i