diff options
author | Nick Foster <nick@ettus.com> | 2011-08-05 10:17:50 -0700 |
---|---|---|
committer | Nick Foster <nick@ettus.com> | 2011-08-05 10:17:50 -0700 |
commit | cbd7ff3ad330af66152dea04559910a013dd7a87 (patch) | |
tree | 0bbfaa5055860beed88fa444920ca1e53666a3ba | |
parent | 2b0e89eefc24ed5dfc3b2c5db70cf08446a5ddb7 (diff) | |
download | uhd-cbd7ff3ad330af66152dea04559910a013dd7a87.tar.gz uhd-cbd7ff3ad330af66152dea04559910a013dd7a87.tar.bz2 uhd-cbd7ff3ad330af66152dea04559910a013dd7a87.zip |
GPS ctrl fixes for uncooperative Firefly devices (Bastien Auneau)
-rw-r--r-- | host/lib/usrp/gps_ctrl.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp index 3cef1ef19..fb65549b5 100644 --- a/host/lib/usrp/gps_ctrl.cpp +++ b/host/lib/usrp/gps_ctrl.cpp @@ -51,6 +51,9 @@ public: _recv(); //get whatever junk is in the rx buffer right now, and throw it away _send("HAAAY GUYYYYS\n"); //to elicit a response from the Firefly + //wait for _send(...) to return + sleep(milliseconds(FIREFLY_STUPID_DELAY_MS)); + //then we loop until we either timeout, or until we get a response that indicates we're a JL device int timeout = GPS_TIMEOUT_TRIES; while(timeout--) { @@ -153,6 +156,10 @@ private: UHD_MSG(error) << "get_nmea(): unsupported GPS or no GPS detected"; return std::string(); } + //flush data to avoid reading outdated value (because NMEA string generated every second) + while (_recv() != ""){ + sleep(milliseconds(10)); + } int timeout = GPS_TIMEOUT_TRIES; while(timeout--) { reply = _recv(); |