diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2022-08-24 16:14:15 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2022-08-24 16:14:15 +0200 |
commit | 7441d427947aaa79b88e1eae157981c95d7ca5fa (patch) | |
tree | a45e955da7a7946264d215a30758e531b92322b4 /src | |
parent | 1383ded72f3796a00eeb25551160f66eb89f378e (diff) | |
download | dabmod-7441d427947aaa79b88e1eae157981c95d7ca5fa.tar.gz dabmod-7441d427947aaa79b88e1eae157981c95d7ca5fa.tar.bz2 dabmod-7441d427947aaa79b88e1eae157981c95d7ca5fa.zip |
Add TS debugging output
Diffstat (limited to 'src')
-rw-r--r-- | src/TimestampDecoder.cpp | 11 | ||||
-rw-r--r-- | src/TimestampDecoder.h | 4 | ||||
-rw-r--r-- | src/output/Dexter.cpp | 2 | ||||
-rw-r--r-- | src/output/SDR.cpp | 6 |
4 files changed, 22 insertions, 1 deletions
diff --git a/src/TimestampDecoder.cpp b/src/TimestampDecoder.cpp index 54a5817..c701186 100644 --- a/src/TimestampDecoder.cpp +++ b/src/TimestampDecoder.cpp @@ -50,6 +50,17 @@ double frame_timestamp::offset_to_system_time() const return get_real_secs() - (double)t.tv_sec - (t.tv_nsec / 1000000000.0); } +std::string frame_timestamp::to_string() const +{ + time_t s = timestamp_sec; + std::stringstream ss; + char timestr[100]; + if (std::strftime(timestr, sizeof(timestr), "%Y-%m-%dZ%H:%M:%S", std::gmtime(&s))) { + ss << timestr << " + " << ((double)timestamp_pps / 16384000.0); + } + return ss.str(); +} + frame_timestamp& frame_timestamp::operator+=(const double& diff) { double offset_pps, offset_secs; diff --git a/src/TimestampDecoder.h b/src/TimestampDecoder.h index 3616bab..4e94d4c 100644 --- a/src/TimestampDecoder.h +++ b/src/TimestampDecoder.h @@ -39,7 +39,7 @@ struct frame_timestamp int32_t fct; uint8_t fp; // Frame Phase - uint32_t timestamp_sec; + uint32_t timestamp_sec; // seconds in unix epoch uint32_t timestamp_pps; // In units of 1/16384000 s bool timestamp_valid = false; bool timestamp_refresh; @@ -76,6 +76,8 @@ struct frame_timestamp timestamp_pps = lrint(subsecond * 16384000.0); } + std::string to_string() const; + void print(const char* t) const { etiLog.log(debug, "%s <frame_timestamp(%s, %d, %.9f, %d)>\n", diff --git a/src/output/Dexter.cpp b/src/output/Dexter.cpp index e4f672b..b389b31 100644 --- a/src/output/Dexter.cpp +++ b/src/output/Dexter.cpp @@ -370,6 +370,7 @@ void Dexter::transmit_frame(const struct FrameData& frame) etiLog.level(error) << "Failed to get dexter_dsp_tx.pps_clks: " << get_iio_error(r); } + /* etiLog.level(debug) << "Dexter: TS CLK " << ((int64_t)frame.ts.timestamp_sec - (int64_t)m_utc_seconds_at_startup) * DSP_CLOCK << " + " << m_clock_count_at_startup << " + " << @@ -377,6 +378,7 @@ void Dexter::transmit_frame(const struct FrameData& frame) frame_ts_clocks << " DELTA " << frame_ts_clocks << " - " << pps_clks << " = " << (double)((int64_t)frame_ts_clocks - pps_clks) / DSP_CLOCK; + */ // Ensure we hand the frame over to HW at least 0.1s before timestamp if (((int64_t)frame_ts_clocks - pps_clks) < (int64_t)DSP_CLOCK / 10) { diff --git a/src/output/SDR.cpp b/src/output/SDR.cpp index f1ed2b0..bd02cab 100644 --- a/src/output/SDR.cpp +++ b/src/output/SDR.cpp @@ -370,6 +370,12 @@ void SDR::handle_frame(struct FrameData& frame) return; } + if (frame.ts.fct == 0) { + etiLog.level(debug) << + "OutputSDR: TX FCT=" << frame.ts.fct << + " TS " << frame.ts.to_string(); + } + m_device->transmit_frame(frame); } |