Rev 2090 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2090 | Rev 2146 | ||
---|---|---|---|
Line 187... | Line 187... | ||
187 | cli(); |
187 | cli(); |
Line 188... | Line 188... | ||
188 | 188 | ||
Line 189... | Line 189... | ||
189 | PORTD &= ~(1<<PORTD7); // set PD7 to low |
189 | PORTD &= ~(1<<PORTD7); // set PD7 to low |
190 | 190 | ||
191 | DDRC |= (1<<DDC6); // set PC6 as output (Reset for HEF4017) |
191 | DDRC |= (1<<DDC6); // set PC6 as output (Reset for HEF4017) |
Line 192... | Line 192... | ||
192 | HEF4017R_ON; |
192 | HEF4017Reset_ON; |
193 | // Timer/Counter 2 Control Register A |
193 | // Timer/Counter 2 Control Register A |
194 | 194 | ||
Line 369... | Line 369... | ||
369 | 369 | ||
370 | if(ServoIndex == 0) // if we are at the sync gap |
370 | if(ServoIndex == 0) // if we are at the sync gap |
371 | { |
371 | { |
372 | RemainingPulse = PPM_FRAMELEN - ServoFrameTime; // generate sync gap by filling time to full frame time |
372 | RemainingPulse = PPM_FRAMELEN - ServoFrameTime; // generate sync gap by filling time to full frame time |
373 | ServoFrameTime = 0; // reset servo frame time |
373 | ServoFrameTime = 0; // reset servo frame time |
374 | HEF4017R_ON; // enable HEF4017 reset |
374 | HEF4017Reset_ON; // enable HEF4017 reset |
375 | } |
375 | } |
376 | else // servo channels |
376 | else // servo channels |
377 | { |
377 | { |
378 | RemainingPulse = MINSERVOPULSE + SERVORANGE/2; // center position ~ 1.5ms |
378 | RemainingPulse = MINSERVOPULSE + SERVORANGE/2; // center position ~ 1.5ms |
Line 411... | Line 411... | ||
411 | TCCR2A |= (1<<COM2A0); // make a low pulse |
411 | TCCR2A |= (1<<COM2A0); // make a low pulse |
412 | // set pulsewidth to stop pulse width |
412 | // set pulsewidth to stop pulse width |
413 | RemainingPulse = PPM_STOPPULSE; |
413 | RemainingPulse = PPM_STOPPULSE; |
414 | // accumulate time for correct sync gap |
414 | // accumulate time for correct sync gap |
415 | ServoFrameTime += RemainingPulse; |
415 | ServoFrameTime += RemainingPulse; |
416 | if((ServoActive && SenderOkay) || ServoActive == 2) HEF4017R_OFF; // disable HEF4017 reset |
416 | if((ServoActive && SenderOkay) || ServoActive == 2) HEF4017Reset_OFF; // disable HEF4017 reset |
417 | else HEF4017R_ON; |
417 | else HEF4017Reset_ON; |
418 | ServoIndex++; // change to next servo channel |
418 | ServoIndex++; // change to next servo channel |
419 | if(ServoIndex > EE_Parameter.ServoNickRefresh) |
419 | if(ServoIndex > EE_Parameter.ServoNickRefresh) |
420 | { |
420 | { |
421 | CalculateServoSignals = 1; |
421 | CalculateServoSignals = 1; |
422 | ServoIndex = 0; // reset to the sync gap |
422 | ServoIndex = 0; // reset to the sync gap |