summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-03-03 08:58:22 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-03-03 08:58:22 +0100
commit568f462aff32a23f1f9db9c1192da44cf8380858 (patch)
tree3c4abae8496b084f74cbe766a7ce70a27b408b2e /src
parenteedb09b596ca0934d3d4a5f8603429182cb669e2 (diff)
parent0bdb1ce8e7753f6617074fb859419a6185d91ad1 (diff)
downloaddabmod-568f462aff32a23f1f9db9c1192da44cf8380858.tar.gz
dabmod-568f462aff32a23f1f9db9c1192da44cf8380858.tar.bz2
dabmod-568f462aff32a23f1f9db9c1192da44cf8380858.zip
Merge branch 'next' into restructureEDIvsETI
Diffstat (limited to 'src')
-rw-r--r--src/ConfigParser.cpp1
-rw-r--r--src/DabMod.cpp4
-rw-r--r--src/OutputUHD.cpp31
-rw-r--r--src/OutputUHD.h1
4 files changed, 33 insertions, 4 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp
index c6eb329..a1e6e34 100644
--- a/src/ConfigParser.cpp
+++ b/src/ConfigParser.cpp
@@ -226,6 +226,7 @@ static void parse_configfile(
throw std::runtime_error("Configuration error");
}
+ outputuhd_conf.lo_offset = pt.get<double>("uhdoutput.lo_offset", 0);
outputuhd_conf.refclk_src = pt.get("uhdoutput.refclk_source", "internal");
outputuhd_conf.pps_src = pt.get("uhdoutput.pps_source", "none");
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index 3554e4c..7fc395e 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -559,6 +559,10 @@ run_modulator_state_t run_modulator(modulator_data& m)
int main(int argc, char* argv[])
{
+ // Set timezone to UTC
+ setenv("TZ", "", 1);
+ tzset();
+
try {
return launch_modulator(argc, argv);
}
diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp
index b4344f5..3a4511a 100644
--- a/src/OutputUHD.cpp
+++ b/src/OutputUHD.cpp
@@ -221,11 +221,31 @@ OutputUHD::OutputUHD(
throw std::runtime_error("Cannot set USRP sample rate. Aborted.");
}
- //set the centre frequency
- MDEBUG("OutputUHD:Setting freq to %f...\n", myConf.frequency);
- myUsrp->set_tx_freq(myConf.frequency);
+ if (myConf.lo_offset != 0.0) {
+ etiLog.level(info) << std::fixed << std::setprecision(3) <<
+ "OutputUHD:Setting freq to " << myConf.frequency <<
+ " with LO offset " << myConf.lo_offset << "...";
+
+ const auto tr = uhd::tune_request_t(myConf.frequency, myConf.lo_offset);
+ uhd::tune_result_t result = myUsrp->set_tx_freq(tr);
+
+ etiLog.level(debug) << "OutputUHD:" <<
+ std::fixed << std::setprecision(0) <<
+ " Target RF: " << result.target_rf_freq <<
+ " Actual RF: " << result.actual_rf_freq <<
+ " Target DSP: " << result.target_dsp_freq <<
+ " Actual DSP: " << result.actual_dsp_freq;
+ }
+ else {
+ //set the centre frequency
+ etiLog.level(info) << std::fixed << std::setprecision(3) <<
+ "OutputUHD:Setting freq to " << myConf.frequency << "...";
+ myUsrp->set_tx_freq(myConf.frequency);
+ }
+
myConf.frequency = myUsrp->get_tx_freq();
- MDEBUG("OutputUHD:Actual frequency: %f\n", myConf.frequency);
+ etiLog.level(info) << std::fixed << std::setprecision(3) <<
+ "OutputUHD:Actual frequency: " << myConf.frequency;
myUsrp->set_tx_gain(myConf.txgain);
MDEBUG("OutputUHD:Actual TX Gain: %f ...\n", myUsrp->get_tx_gain());
@@ -430,6 +450,7 @@ void OutputUHD::set_usrp_time()
else {
myUsrp->set_time_now(uhd::time_spec_t(now.tv_sec));
etiLog.level(info) << "OutputUHD: Setting USRP time to " <<
+ std::fixed <<
uhd::time_spec_t(now.tv_sec).get_real_secs();
}
}
@@ -462,6 +483,7 @@ void OutputUHD::set_usrp_time()
usleep(200000); // 200ms, we want the PPS to be later
myUsrp->set_time_unknown_pps(uhd::time_spec_t(seconds + 2));
etiLog.level(info) << "OutputUHD: Setting USRP time next pps to " <<
+ std::fixed <<
uhd::time_spec_t(seconds + 2).get_real_secs();
}
@@ -733,6 +755,7 @@ void UHDWorker::handle_frame(const struct UHDWorkerFrameData *frame)
if (md.time_spec.get_real_secs() > usrp_time + TIMESTAMP_ABORT_FUTURE) {
etiLog.level(error) <<
"OutputUHD: Timestamp way too far in the future! offset: " <<
+ std::fixed <<
md.time_spec.get_real_secs() - usrp_time;
throw std::runtime_error("Timestamp error. Aborted.");
}
diff --git a/src/OutputUHD.h b/src/OutputUHD.h
index e477e47..cbf159f 100644
--- a/src/OutputUHD.h
+++ b/src/OutputUHD.h
@@ -182,6 +182,7 @@ struct OutputUHDConfig {
long masterClockRate = 32768000;
unsigned sampleRate = 2048000;
double frequency = 0.0;
+ double lo_offset = 0.0;
double txgain = 0.0;
bool enableSync = false;
bool muteNoTimestamps = false;