From 4711ca4c914094eaa6e1314c0f2bd6e4a9042028 Mon Sep 17 00:00:00 2001 From: bsongis Date: Fri, 1 Jun 2012 19:46:00 +0000 Subject: [PATCH] PPM frame should now go up to 42ms --- src/model_menus.cpp | 2 +- src/pulses_arm.cpp | 4 ++-- src/pulses_avr.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/model_menus.cpp b/src/model_menus.cpp index 977060a28..e7d62ba19 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -769,7 +769,7 @@ void menuProcModel(uint8_t event) if(attr && (s_editMode>0 || p1valdiff)) { switch (m_posHorz) { case 0: - CHECK_INCDEC_MODELVAR(event, g_model.ppmFrameLength, -20, 20); + CHECK_INCDEC_MODELVAR(event, g_model.ppmFrameLength, -20, 39); break; case 1: CHECK_INCDEC_MODELVAR(event, g_model.ppmDelay, -4, 10); diff --git a/src/pulses_arm.cpp b/src/pulses_arm.cpp index 6e7164b41..1a92d819c 100644 --- a/src/pulses_arm.cpp +++ b/src/pulses_arm.cpp @@ -159,8 +159,8 @@ void setupPulsesPPM() // Don't enable interrupts through here else pwmptr->PWM_CH_NUM[3].PWM_CMR &= ~0x00000200 ; // CPOL - uint16_t rest = 22500u * 2; //Minimum Framelen=22.5 ms - rest += (int16_t(g_model.ppmFrameLength)) * 1000; + uint32_t rest = 22500u * 2; //Minimum Framelen=22.5 ms + rest += (int32_t(g_model.ppmFrameLength)) * 1000; for (uint32_t i = 0; i < p; i++) { //NUM_CHNOUT int16_t v = limit((int16_t)-PPM_range, g_chans512[i], (int16_t)PPM_range) + 2*PPM_CENTER; rest -= (v); diff --git a/src/pulses_avr.cpp b/src/pulses_avr.cpp index 24f39c73a..cd661522d 100644 --- a/src/pulses_avr.cpp +++ b/src/pulses_avr.cpp @@ -206,8 +206,8 @@ FORCEINLINE void setupPulsesPPM() uint16_t *ptr = (uint16_t *)pulses2MHz; uint8_t p = 8+(g_model.ppmNCH*2); // channels count uint16_t q = (g_model.ppmDelay*50+300)*2; //Stoplen *2 - uint16_t rest = 22500u*2-q; //Minimum Framelen=22.5 ms - rest += (int16_t(g_model.ppmFrameLength))*1000; + uint32_t rest = 22500u*2-q; // Minimum Framelen=22.5 ms + 10000 to avoid int32_t in the next line + rest += (int32_t(g_model.ppmFrameLength))*1000; for (uint8_t i=0; i