Skip to content

Commit

Permalink
Move pilot.fly() back into control loop so the controller will run at
Browse files Browse the repository at this point in the history
166 Hz instead of 31 Hz. Having a big "wtf was I thinking" moment here.
  • Loading branch information
yoos committed May 15, 2012
1 parent c339933 commit c405438
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/flight_controller.cpp
Expand Up @@ -48,6 +48,7 @@ int main(void) {
// Control loop
// ================================================================
if (loopCount % CONTROL_LOOP_INTERVAL == 0) {
pilot.fly();
watchdog.watch(pilot.hasFood);

/* Don't run system unless armed!
Expand All @@ -64,7 +65,7 @@ int main(void) {
Timer3.pwm(PMT, TMIN);
Timer3.pwm(PMR, TMIN);
Timer3.pwm(PML, TMIN);
pwmDevice[SERVO_T].writeMicroseconds(SERVO_US_ZERO);
pwmDevice[SERVO_T].writeMicroseconds(SERVO_NEUTRAL);

// Check that motor values set by Pilot are within the
// arming threshold.
Expand All @@ -90,16 +91,14 @@ int main(void) {
Timer3.pwm(PMT, TMIN);
Timer3.pwm(PMR, TMIN);
Timer3.pwm(PML, TMIN);
pwmDevice[SERVO_T].writeMicroseconds(SERVO_US_ZERO);
pwmDevice[SERVO_T].writeMicroseconds(SERVO_NEUTRAL);
}
}

// ================================================================
// Communications loop
// ================================================================
if (loopCount % COMM_LOOP_INTERVAL == 0) {
pilot.fly();

#ifdef SEND_ARM_STATUS
sendArmStatus();
#endif
Expand Down

0 comments on commit c405438

Please sign in to comment.