aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-02-14 10:34:54 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-02-14 10:34:54 +0100
commit21b9b097329453bb3c3666d9429a1d1c7257efae (patch)
tree55ffad80c7b8e42b1c1ce6a9f065cc052a18c4ad /src
parentaa55134b32e8026ad0e052717f488a7e0837bda5 (diff)
downloaddabmod-21b9b097329453bb3c3666d9429a1d1c7257efae.tar.gz
dabmod-21b9b097329453bb3c3666d9429a1d1c7257efae.tar.bz2
dabmod-21b9b097329453bb3c3666d9429a1d1c7257efae.zip
Fix handling of GPS sensors
Diffstat (limited to 'src')
-rw-r--r--src/output/USRPTime.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/output/USRPTime.cpp b/src/output/USRPTime.cpp
index 8de86fb..56bdf50 100644
--- a/src/output/USRPTime.cpp
+++ b/src/output/USRPTime.cpp
@@ -48,14 +48,29 @@ static bool check_gps_timelock(uhd::usrp::multi_usrp::sptr& usrp)
usrp->get_mboard_sensor("gps_timelock", 0).to_pp_string();
if (sensor_value.find("TIME LOCKED") == string::npos) {
- etiLog.level(warn) << "OutputUHD: gps_timelock " << sensor_value;
+
+ const string gngga =
+ usrp->get_mboard_sensor("gps_gngga", 0).to_pp_string();
+
+ std::stringstream ss(gngga);
+ std::string item;
+ std::vector<std::string> elems;
+ while (std::getline(ss, item, ',')) {
+ elems.push_back(item);
+ }
+
+ const auto num_svs = (elems.size() >= 7) ? elems[7] : "?";
+
+ etiLog.level(info) << "OutputUHD: " << num_svs << " SVs,"
+ " gps_timelock " << sensor_value;
return false;
}
return true;
}
- catch (const uhd::lookup_error &e) {
- etiLog.level(warn) << "OutputUHD: no gps_timelock sensor";
+ catch (const uhd::exception &e) {
+ etiLog.level(warn) << "OutputUHD: no gps_timelock sensor: " <<
+ e.what();
return false;
}
}
@@ -74,8 +89,9 @@ static bool check_gps_locked(uhd::usrp::multi_usrp::sptr& usrp)
return true;
}
- catch (const uhd::lookup_error &e) {
- etiLog.level(warn) << "OutputUHD: no gps_locked sensor";
+ catch (const uhd::exception &e) {
+ etiLog.level(warn) << "OutputUHD: no gps_locked sensor" <<
+ e.what();
return false;
}
}
@@ -100,7 +116,7 @@ USRPTime::USRPTime(
}
now = system_clock::now();
- this_thread::sleep_for(seconds(1));
+ this_thread::sleep_for(seconds(2));
}
if (not checkfunc(m_usrp)) {