Fixes #1968 - I ported the last changes from Damjan in the same time.
Please review (I push it anyway as there was a freeze before on startup when radio in Slave mode)
This commit is contained in:
@@ -55,6 +55,7 @@ void setupPulsesPPM(unsigned int port) // Don't enable interru
|
||||
uint32_t lastCh = min<unsigned int>(NUM_CHNOUT, firstCh + 8 + g_model.moduleData[port].channelsCount);
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
// TODO move register stuff to driver
|
||||
register Pwm *pwmptr = PWM;
|
||||
uint32_t pwmCh = (port == EXTERNAL_MODULE ? 3 : 1);
|
||||
pwmptr->PWM_CH_NUM[pwmCh].PWM_CDTYUPD = (g_model.moduleData[port].ppmDelay * 50 + 300) * 2; //Stoplen *2
|
||||
@@ -78,25 +79,19 @@ void setupPulsesPPM(unsigned int port) // Don't enable interru
|
||||
*(ptr + 1) = 0;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
rest -= 1000;
|
||||
uint32_t ppmDelay = (g_model.moduleData[port].ppmDelay * 50 + 300) * 2;
|
||||
// set idle time, ppm delay and ppm polarity
|
||||
if (port == TRAINER_MODULE) {
|
||||
TIM3->CCR2 = rest - 1000 ; // Update time
|
||||
TIM3->CCR4 = (g_model.moduleData[port].ppmDelay*50+300)*2;
|
||||
if (!g_model.moduleData[TRAINER_MODULE].ppmPulsePol)
|
||||
TIM3->CCER |= TIM_CCER_CC4P;
|
||||
else
|
||||
TIM3->CCER &= ~TIM_CCER_CC4P;
|
||||
set_trainer_ppm_parameters(rest, ppmDelay, !g_model.moduleData[TRAINER_MODULE].ppmPulsePol); // ppmPulsePol: 0 - positive, 1 - negative
|
||||
}
|
||||
else if (port == EXTERNAL_MODULE) {
|
||||
TIM8->CCR2 = rest - 1000; // Update time
|
||||
TIM8->CCR1 = (g_model.moduleData[port].ppmDelay*50+300)*2;
|
||||
if(!g_model.moduleData[EXTERNAL_MODULE].ppmPulsePol)
|
||||
TIM8->CCER |= TIM_CCER_CC1NP;
|
||||
else
|
||||
TIM8->CCER &= ~TIM_CCER_CC1NP;
|
||||
set_external_ppm_parameters(rest, ppmDelay, !g_model.moduleData[EXTERNAL_MODULE].ppmPulsePol);
|
||||
}
|
||||
else {
|
||||
TIM1->CCR2 = rest - 1000; // Update time
|
||||
TIM1->CCR3 = (g_model.moduleData[port].ppmDelay*50+300)*2;
|
||||
#if defined(TARANIS_INTERNAL_PPM)
|
||||
else if (port == INTERNAL_MODULE) {
|
||||
set_internal_ppm_parameters(rest, ppmDelay, !g_model.moduleData[INTERNAL_MODULE].ppmPulsePol);
|
||||
}
|
||||
#endif // #if defined(TARANIS_INTERNAL_PPM)
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user