Emile's Fixes

This commit is contained in:
Jason Short 2012-02-22 10:27:34 -08:00
parent ac5a4830a1
commit 128f19cdf7

View File

@ -5,8 +5,8 @@
static void init_motors_out() static void init_motors_out()
{ {
#if INSTANT_PWM == 0 #if INSTANT_PWM == 0
APM_RC.SetFastOutputChannels( _BV(MOT_1) | _BV(MOT_2) | _BV(MOT_3) | _BV(MOT_4) APM_RC.SetFastOutputChannels(_BV(MOT_1) | _BV(MOT_2) | _BV(MOT_3) | _BV(MOT_4)
| _BV(MOT_5) | _BV(MOT_6) ); | _BV(MOT_5) | _BV(MOT_6));
#endif #endif
} }
@ -77,10 +77,10 @@ static void output_motors_armed()
// Tridge's stability patch // Tridge's stability patch
for (int m = 0; m <= 6; m++) { for (int m = 0; m <= 6; m++){
int c = ch_of_mot(m); int c = ch_of_mot(m);
int c_opp = ch_of_mot(m^1); // m^1 is the opposite motor. c_opp is channel of opposite motor. int c_opp = ch_of_mot(m ^ 1); // m ^ 1 is the opposite motor. c_opp is channel of opposite motor.
if (motor_out[c] > out_max) { if(motor_out[c] > out_max){
motor_out[c_opp] -= motor_out[c] - out_max; motor_out[c_opp] -= motor_out[c] - out_max;
motor_out[c] = out_max; motor_out[c] = out_max;
} }
@ -108,7 +108,7 @@ static void output_motors_armed()
// this filter slows the acceleration of motors vs the deceleration // this filter slows the acceleration of motors vs the deceleration
// Idea by Denny Rowland to help with his Yaw issue // Idea by Denny Rowland to help with his Yaw issue
for(int8_t m = 0; m <= 6; m++ ) { for(int8_t m = 0; m <= 6; m++){
int c = ch_of_mot(m); int c = ch_of_mot(m);
if(motor_filtered[c] < motor_out[c]){ if(motor_filtered[c] < motor_out[c]){
motor_filtered[c] = (motor_out[c] + motor_filtered[c]) / 2; motor_filtered[c] = (motor_out[c] + motor_filtered[c]) / 2;
@ -143,7 +143,7 @@ static void output_motors_disarmed()
} }
// fill the motor_out[] array for HIL use // fill the motor_out[] array for HIL use
for (unsigned char i = 0; i < 8; i++) { for (unsigned char i = 0; i < 8; i++){
motor_out[i] = g.rc_3.radio_min; motor_out[i] = g.rc_3.radio_min;
} }
@ -168,7 +168,6 @@ static void output_motor_test()
motor_out[MOT_6] = g.rc_3.radio_min; motor_out[MOT_6] = g.rc_3.radio_min;
if(g.frame_orientation == X_FRAME){ if(g.frame_orientation == X_FRAME){
APM_RC.OutputCh(MOT_3, g.rc_3.radio_min); APM_RC.OutputCh(MOT_3, g.rc_3.radio_min);
delay(4000); delay(4000);
APM_RC.OutputCh(MOT_5, g.rc_3.radio_min + 100); APM_RC.OutputCh(MOT_5, g.rc_3.radio_min + 100);
@ -199,10 +198,7 @@ static void output_motor_test()
APM_RC.OutputCh(MOT_3, g.rc_3.radio_min + 100); APM_RC.OutputCh(MOT_3, g.rc_3.radio_min + 100);
delay(300); delay(300);
}
} else { /* PLUS_FRAME */ } else { /* PLUS_FRAME */
APM_RC.OutputCh(MOT_5, g.rc_3.radio_min); APM_RC.OutputCh(MOT_5, g.rc_3.radio_min);
delay(4000); delay(4000);
APM_RC.OutputCh(MOT_1, g.rc_3.radio_min + 100); APM_RC.OutputCh(MOT_1, g.rc_3.radio_min + 100);
@ -234,8 +230,6 @@ static void output_motor_test()
delay(300); delay(300);
} }
}
APM_RC.OutputCh(MOT_1, motor_out[MOT_1]); APM_RC.OutputCh(MOT_1, motor_out[MOT_1]);
APM_RC.OutputCh(MOT_2, motor_out[MOT_2]); APM_RC.OutputCh(MOT_2, motor_out[MOT_2]);
APM_RC.OutputCh(MOT_3, motor_out[MOT_3]); APM_RC.OutputCh(MOT_3, motor_out[MOT_3]);