1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

OP-1683 - Put again in place safe limits on pulse width

This commit is contained in:
Alessio Morale 2015-01-31 15:04:02 +01:00
parent 1d08083375
commit a5f601593d

View File

@ -231,11 +231,11 @@ void PIOS_Servo_Set(uint8_t servo, uint16_t position)
/* Update the position */
const struct pios_tim_channel *chan = &servo_cfg->channels[servo];
uint16_t val = position;
/*uint16_t margin = chan->timer->ARR / 20; // Leave 5% of period as margin to prevent overlaps
if (val > (chan->timer->ARR - margin)) {
uint16_t val = position;
uint16_t margin = chan->timer->ARR / 50; // Leave 2% of period as margin to prevent overlaps
if (val > (chan->timer->ARR - margin)) {
val = chan->timer->ARR - margin;
}*/
}
switch (chan->timer_chan) {
case TIM_Channel_1:
TIM_SetCompare1(chan->timer, val);