mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-11 18:38:28 -04:00
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
This commit is contained in:
parent
e66e21cf20
commit
6a279138e9
@ -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,14 +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 {
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user