From 3d85f995460ab5f9e0d5ab387830834cd6393ece Mon Sep 17 00:00:00 2001 From: Michael Oborne Date: Sat, 31 Dec 2011 09:35:40 +0800 Subject: [PATCH 1/3] remove gps callback in wait loop --- libraries/AP_GPS/AP_GPS_Auto.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/AP_GPS/AP_GPS_Auto.cpp b/libraries/AP_GPS/AP_GPS_Auto.cpp index b3a93b8a68..9c225ecc74 100644 --- a/libraries/AP_GPS/AP_GPS_Auto.cpp +++ b/libraries/AP_GPS/AP_GPS_Auto.cpp @@ -117,7 +117,6 @@ AP_GPS_Auto::_detect(void) _port->flush(); then = millis(); do { - callback(1); if (_port->available()) { then = millis(); _port->read(); From 3cb74cb459aa0da1c2f662214f2eaddc2e86806f Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Sat, 31 Dec 2011 12:29:54 +0900 Subject: [PATCH 2/3] ArduCopter - init_compass - fixed HIL build issue --- ArduCopter/sensors.pde | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArduCopter/sensors.pde b/ArduCopter/sensors.pde index a80f80aa9d..3aed001f79 100644 --- a/ArduCopter/sensors.pde +++ b/ArduCopter/sensors.pde @@ -88,6 +88,8 @@ static void zero_airspeed(void) } +#endif // HIL_MODE != HIL_MODE_ATTITUDE + static void init_compass() { compass.set_orientation(MAG_ORIENTATION); // set compass's orientation on aircraft @@ -110,8 +112,6 @@ static void init_optflow() #endif } -#endif // HIL_MODE != HIL_MODE_ATTITUDE - static void read_battery(void) { battery_voltage1 = BATTERY_VOLTAGE(analogRead(BATTERY_PIN1)) * .1 + battery_voltage1 * .9; From 306e2e3f7db04ed9a32f55361efa7dddce6ee25f Mon Sep 17 00:00:00 2001 From: Michael Oborne Date: Sat, 31 Dec 2011 13:05:33 +0800 Subject: [PATCH 3/3] add gps character count. this problem happens when the mtk ends up in nmea mode at 10hz. there is no 50ms window of no activity --- libraries/AP_GPS/AP_GPS_Auto.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/AP_GPS/AP_GPS_Auto.cpp b/libraries/AP_GPS/AP_GPS_Auto.cpp index 9c225ecc74..4eaa531a4b 100644 --- a/libraries/AP_GPS/AP_GPS_Auto.cpp +++ b/libraries/AP_GPS/AP_GPS_Auto.cpp @@ -99,6 +99,7 @@ AP_GPS_Auto::_detect(void) unsigned long then; int fingerprint[4]; int tries; + int charcount; GPS *gps; // @@ -114,14 +115,16 @@ AP_GPS_Auto::_detect(void) // XXX We can detect babble by counting incoming characters, but // what would we do about it? // + charcount = 0; _port->flush(); then = millis(); do { if (_port->available()) { then = millis(); _port->read(); + charcount++; } - } while ((millis() - then) < 50); + } while ((millis() - then) < 50 && charcount < 5000); // // Collect four characters to fingerprint a device