1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

Set all the servo timers above ACTUATORSETTINGS_CHANNELUPDATEFREQ_NUMELEM with

the last ChannelUpdateFreq value to prevent their speed not being initialized correctly.
This commit is contained in:
a*morale 2012-09-11 00:34:14 +02:00
parent e7bf1db165
commit 69f9814c3b

View File

@ -100,7 +100,7 @@ void PIOS_Servo_SetHz(const uint16_t * speeds, uint8_t banks)
uint8_t set = 0;
for(uint8_t i = 0; (i < servo_cfg->num_channels) && (set < banks); i++) {
for(uint8_t i = 0; (i < servo_cfg->num_channels); i++) {
bool new = true;
const struct pios_tim_channel * chan = &servo_cfg->channels[i];
@ -119,7 +119,11 @@ void PIOS_Servo_SetHz(const uint16_t * speeds, uint8_t banks)
TIM_TimeBaseStructure.TIM_Period = ((1000000 / speeds[set]) - 1);
TIM_TimeBaseInit(chan->timer, &TIM_TimeBaseStructure);
set++;
// don't increment as this is the last speed value provided.
// set all the remaining timers with the last speed value.
if(set<banks-1)
set++;
}
}
}