This commit is contained in:
Chris Anderson 2011-12-30 22:53:23 -08:00
commit 13ca48f744
2 changed files with 6 additions and 4 deletions

View File

@ -88,6 +88,8 @@ static void zero_airspeed(void)
} }
#endif // HIL_MODE != HIL_MODE_ATTITUDE
static void init_compass() static void init_compass()
{ {
compass.set_orientation(MAG_ORIENTATION); // set compass's orientation on aircraft compass.set_orientation(MAG_ORIENTATION); // set compass's orientation on aircraft
@ -110,8 +112,6 @@ static void init_optflow()
#endif #endif
} }
#endif // HIL_MODE != HIL_MODE_ATTITUDE
static void read_battery(void) static void read_battery(void)
{ {
battery_voltage1 = BATTERY_VOLTAGE(analogRead(BATTERY_PIN1)) * .1 + battery_voltage1 * .9; battery_voltage1 = BATTERY_VOLTAGE(analogRead(BATTERY_PIN1)) * .1 + battery_voltage1 * .9;

View File

@ -99,6 +99,7 @@ AP_GPS_Auto::_detect(void)
unsigned long then; unsigned long then;
int fingerprint[4]; int fingerprint[4];
int tries; int tries;
int charcount;
GPS *gps; GPS *gps;
// //
@ -114,15 +115,16 @@ AP_GPS_Auto::_detect(void)
// XXX We can detect babble by counting incoming characters, but // XXX We can detect babble by counting incoming characters, but
// what would we do about it? // what would we do about it?
// //
charcount = 0;
_port->flush(); _port->flush();
then = millis(); then = millis();
do { do {
callback(1);
if (_port->available()) { if (_port->available()) {
then = millis(); then = millis();
_port->read(); _port->read();
charcount++;
} }
} while ((millis() - then) < 50); } while ((millis() - then) < 50 && charcount < 5000);
// //
// Collect four characters to fingerprint a device // Collect four characters to fingerprint a device