PPM frame should now go up to 42ms

This commit is contained in:
bsongis
2012-06-01 19:46:00 +00:00
parent ef5441df09
commit 4711ca4c91
3 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -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<p; i++) {
#ifdef PPM_CENTER_ADJUSTABLE
int16_t v = limit((int16_t)-PPM_range, g_chans512[i], (int16_t)PPM_range) + 2*(PPM_CENTER+g_model.servoCenter[i]);
@@ -1032,8 +1032,8 @@ void setupPulsesPPM16(uint8_t proto)
ptr = (uint16_t *) &pulses2MHz[PULSES_SIZE/2] ;
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
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
rest += (int32_t(g_model.ppmFrameLength))*1000;
for (uint8_t i=(proto==PROTO_PPM16) ? p-8 : 0; i<p; i++) {
#ifdef PPM_CENTER_ADJUSTABLE
int16_t v = limit((int16_t)-PPM_range, g_chans512[i], (int16_t)PPM_range) + 2*(PPM_CENTER+g_model.servoCenter[i]);