This commit is contained in:
Michael Oborne 2011-10-11 08:05:14 +08:00
commit ec7fa70fd6
3 changed files with 17 additions and 11 deletions

View File

@ -287,15 +287,19 @@ static void set_servos(void)
g.channel_rudder.radio_out = g.channel_rudder.radio_in; g.channel_rudder.radio_out = g.channel_rudder.radio_in;
// FIXME To me it does not make sense to control the aileron using radio_in in manual mode // FIXME To me it does not make sense to control the aileron using radio_in in manual mode
// Doug could you please take a look at this ? // Doug could you please take a look at this ?
if (g_rc_function[RC_Channel_aux::k_aileron] != rc_array[g.flight_mode_channel-1]) { if (g_rc_function[RC_Channel_aux::k_aileron]) {
G_RC_AUX(k_aileron)->radio_out = g_rc_function[RC_Channel_aux::k_aileron]->radio_in; if (g_rc_function[RC_Channel_aux::k_aileron] != rc_array[g.flight_mode_channel-1]) {
} g_rc_function[RC_Channel_aux::k_aileron]->radio_out = g_rc_function[RC_Channel_aux::k_aileron]->radio_in;
}
}
// only use radio_in if the channel is not used as flight_mode_channel // only use radio_in if the channel is not used as flight_mode_channel
if (g_rc_function[RC_Channel_aux::k_flap_auto] != rc_array[g.flight_mode_channel-1]) { if (g_rc_function[RC_Channel_aux::k_flap_auto]) {
G_RC_AUX(k_flap_auto)->radio_out = g_rc_function[RC_Channel_aux::k_flap_auto]->radio_in; if (g_rc_function[RC_Channel_aux::k_flap_auto] != rc_array[g.flight_mode_channel-1]) {
} else { g_rc_function[RC_Channel_aux::k_flap_auto]->radio_out = g_rc_function[RC_Channel_aux::k_flap_auto]->radio_in;
G_RC_AUX(k_flap_auto)->radio_out = g_rc_function[RC_Channel_aux::k_flap_auto]->radio_trim; } else {
} g_rc_function[RC_Channel_aux::k_flap_auto]->radio_out = g_rc_function[RC_Channel_aux::k_flap_auto]->radio_trim;
}
}
} else { } else {
if (g.mix_mode == 0) { if (g.mix_mode == 0) {
g.channel_roll.calc_pwm(); g.channel_roll.calc_pwm();

View File

@ -23,6 +23,7 @@ void setup() {
AP_Guide * guide = NULL; AP_Guide * guide = NULL;
AP_Controller * controller = NULL; AP_Controller * controller = NULL;
AP_HardwareAbstractionLayer * hal = NULL; AP_HardwareAbstractionLayer * hal = NULL;
/* /*
* Communications * Communications
*/ */
@ -50,6 +51,7 @@ void setup() {
hal->debug->println_P(PSTR("initializing gps")); hal->debug->println_P(PSTR("initializing gps"));
AP_GPS_Auto gpsDriver(&Serial1, &(hal->gps)); AP_GPS_Auto gpsDriver(&Serial1, &(hal->gps));
hal->gps = &gpsDriver; hal->gps = &gpsDriver;
hal->gps->callback = delay;
hal->gps->init(); hal->gps->init();
} }
@ -123,7 +125,7 @@ void setup() {
hal->rangeFinders.push_back(rangeFinder); hal->rangeFinders.push_back(rangeFinder);
} }
} else }
/* /*
* Select guidance, navigation, control algorithms * Select guidance, navigation, control algorithms
@ -155,7 +157,6 @@ void setup() {
hal->hil = new COMMLINK_CLASS(&Serial1, navigator, guide, controller, hal); hal->hil = new COMMLINK_CLASS(&Serial1, navigator, guide, controller, hal);
} }
/* /*
* Start the autopilot * Start the autopilot
*/ */

View File

@ -45,6 +45,7 @@ AP_Autopilot::AP_Autopilot(AP_Navigator * navigator, AP_Guide * guide,
if (hal->gps->fix) { if (hal->gps->fix) {
break; break;
} else { } else {
hal->gps->update();
hal->gcs->sendText(SEVERITY_LOW, hal->gcs->sendText(SEVERITY_LOW,
PSTR("waiting for gps lock\n")); PSTR("waiting for gps lock\n"));
hal->debug->printf_P(PSTR("waiting for gps lock\n")); hal->debug->printf_P(PSTR("waiting for gps lock\n"));
@ -67,8 +68,8 @@ AP_Autopilot::AP_Autopilot(AP_Navigator * navigator, AP_Guide * guide,
break; break;
} }
hal->debug->println_P(PSTR("waiting for hil packet")); hal->debug->println_P(PSTR("waiting for hil packet"));
delay(1000);
} }
delay(1000);
} }
AP_MavlinkCommand::home.setAlt(_navigator->getAlt()); AP_MavlinkCommand::home.setAlt(_navigator->getAlt());