From 3e1ae9b21583f8ce167db795efd94bd33a078ebe Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sun, 9 Oct 2011 15:57:29 -0400 Subject: [PATCH] APO GPS bug fix. --- libraries/APO/APO_DefaultSetup.h | 3 ++- libraries/APO/AP_Autopilot.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/APO/APO_DefaultSetup.h b/libraries/APO/APO_DefaultSetup.h index 94424e0253..b378d5ded2 100644 --- a/libraries/APO/APO_DefaultSetup.h +++ b/libraries/APO/APO_DefaultSetup.h @@ -23,6 +23,7 @@ void setup() { AP_Guide * guide = NULL; AP_Controller * controller = NULL; AP_HardwareAbstractionLayer * hal = NULL; + /* * Communications */ @@ -50,6 +51,7 @@ void setup() { hal->debug->println_P(PSTR("initializing gps")); AP_GPS_Auto gpsDriver(&Serial1, &(hal->gps)); hal->gps = &gpsDriver; + hal->gps->callback = delay; hal->gps->init(); } @@ -155,7 +157,6 @@ void setup() { hal->hil = new COMMLINK_CLASS(&Serial1, navigator, guide, controller, hal); } - /* * Start the autopilot */ diff --git a/libraries/APO/AP_Autopilot.cpp b/libraries/APO/AP_Autopilot.cpp index 55251c720d..fa796d0626 100644 --- a/libraries/APO/AP_Autopilot.cpp +++ b/libraries/APO/AP_Autopilot.cpp @@ -45,6 +45,7 @@ AP_Autopilot::AP_Autopilot(AP_Navigator * navigator, AP_Guide * guide, if (hal->gps->fix) { break; } else { + hal->gps->update(); hal->gcs->sendText(SEVERITY_LOW, 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; } hal->debug->println_P(PSTR("waiting for hil packet")); - delay(1000); } + delay(1000); } AP_MavlinkCommand::home.setAlt(_navigator->getAlt());