diff options
author | Moritz Fischer <moritz.fischer@ettus.com> | 2015-05-01 12:15:36 -0700 |
---|---|---|
committer | Moritz Fischer <moritz.fischer@ettus.com> | 2015-05-01 12:44:25 -0700 |
commit | 06fbb47dae3530c20202414d5c9e77626419079e (patch) | |
tree | 5a2fdc9963f3d025cd8212445c74a8f7388d3a50 | |
parent | 7af2e970379fb8f58c8afbc99b1498e42698c0a5 (diff) | |
download | uhd-06fbb47dae3530c20202414d5c9e77626419079e.tar.gz uhd-06fbb47dae3530c20202414d5c9e77626419079e.tar.bz2 uhd-06fbb47dae3530c20202414d5c9e77626419079e.zip |
e300: gps: If gps is detected, set device time to gps time on init.
Before the device time wasn't set for E310 on initialization.
This will allow 'query_gpsdo_sensors' to pass if gps has lock.
Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
-rw-r--r-- | host/lib/usrp/e300/e300_impl.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index 2e8f50e05..8a41d44cd 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -574,6 +574,17 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) } _tree->access<subdev_spec_t>(mb_path / "rx_subdev_spec").set(rx_spec); _tree->access<subdev_spec_t>(mb_path / "tx_subdev_spec").set(tx_spec); + + // GPS installed: use external ref, time, and init time spec + if (_sensor_manager->get_gps_found()) { + _tree->access<std::string>(mb_path / "time_source" / "value").set("gpsdo"); + UHD_MSG(status) << "Initializing time to the internal GPSDO" << std::endl; + const time_t tp = time_t(_sensor_manager->get_sensor("gps_time").to_int()+1); + _tree->access<time_spec_t>(mb_path / "time" / "pps").set(time_spec_t(tp)); + } else { + //init to internal clock and time source + _tree->access<std::string>(mb_path / "time_source/value").set("internal"); + } } boost::uint8_t e300_impl::_get_internal_gpio( |