Browse Source

AP_Motors: ensure OneShot125 is within 125 to 250usec

master
Andrew Tridgell 9 years ago
parent
commit
6df4d11d3f
  1. 10
      libraries/AP_Motors/AP_Motors_Class.cpp

10
libraries/AP_Motors/AP_Motors_Class.cpp

@ -82,6 +82,16 @@ void AP_Motors::rc_write(uint8_t chan, uint16_t pwm) @@ -82,6 +82,16 @@ void AP_Motors::rc_write(uint8_t chan, uint16_t pwm)
if (_pwm_type == PWM_TYPE_ONESHOT125) {
// OneShot125 uses a PWM range from 125 to 250 usec
pwm /= 8;
/*
OneShot125 ESCs can be confused by pulses below 125 or above
250, making them fail the pulse type auto-detection. This
happens at least with BLHeli
*/
if (pwm < 125) {
pwm = 125;
} else if (pwm > 250) {
pwm = 250;
}
}
hal.rcout->write(chan, pwm);
}

Loading…
Cancel
Save