diff options
Diffstat (limited to 'src/output/Lime.cpp')
-rw-r--r-- | src/output/Lime.cpp | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/src/output/Lime.cpp b/src/output/Lime.cpp index 6f7eed5..3ef981e 100644 --- a/src/output/Lime.cpp +++ b/src/output/Lime.cpp @@ -226,14 +226,9 @@ Lime::Lime(SDRDeviceConfig &config) : SDRDevice(), m_conf(config) throw runtime_error("Unsupported interpolate: " + to_string(m_interpolate)); } - if (m_conf.sampleRate != 2048000) - { - throw runtime_error("Lime output only supports native samplerate = 2048000"); - /* The buffer_size calculation below does not take into account resampling */ - } - // Frame duration is 96ms - size_t buffer_size = FRAME_LENGTH * m_interpolate * 10; // We take 10 Frame buffer size Fifo + const size_t samplerate_ratio = m_conf.sampleRate / 2048000; + const size_t buffer_size = FRAME_LENGTH * m_interpolate * samplerate_ratio * 10; // We take 10 Frame buffer size Fifo // Fifo seems to be round to multiple of SampleRate m_tx_stream.channel = m_channel; m_tx_stream.fifoSize = buffer_size; @@ -323,13 +318,14 @@ double Lime::get_bandwidth(void) const return bw; } -SDRDevice::RunStatistics Lime::get_run_statistics(void) const +SDRDevice::run_statistics_t Lime::get_run_statistics(void) const { - RunStatistics rs; - rs.num_underruns = underflows; - rs.num_overruns = overflows; - rs.num_late_packets = late_packets; - rs.num_frames_modulated = num_frames_modulated; + run_statistics_t rs; + rs["underruns"].v = underflows; + rs["overruns"].v = overflows; + rs["dropped_packets"].v = dropped_packets; + rs["frames"].v = num_frames_modulated; + rs["fifo_fill"].v = m_last_fifo_fill_percent * 100; return rs; } @@ -353,14 +349,14 @@ double Lime::get_rxgain(void) const size_t Lime::receive_frame( complexf *buf, size_t num_samples, - struct frame_timestamp &ts, + frame_timestamp &ts, double timeout_secs) { // TODO return 0; } -bool Lime::is_clk_source_ok() const +bool Lime::is_clk_source_ok() { // TODO return true; @@ -371,25 +367,23 @@ const char *Lime::device_name(void) const return "Lime"; } -double Lime::get_temperature(void) const +std::optional<double> Lime::get_temperature(void) const { if (not m_device) throw runtime_error("Lime device not set up"); - float_type temp = numeric_limits<float_type>::quiet_NaN(); - if (LMS_GetChipTemperature(m_device, 0, &temp) < 0) - { + float_type temp = 0; + if (LMS_GetChipTemperature(m_device, 0, &temp) >= 0) { + return temp; + } + else { etiLog.level(error) << "Error getting LimeSDR temperature: %s " << LMS_GetLastErrorMessage(); + return std::nullopt; } - return temp; } -float Lime::get_fifo_fill_percent(void) const -{ - return m_last_fifo_fill_percent * 100; -} -void Lime::transmit_frame(const struct FrameData &frame) +void Lime::transmit_frame(struct FrameData&& frame) { if (not m_device) throw runtime_error("Lime device not set up"); @@ -411,7 +405,7 @@ void Lime::transmit_frame(const struct FrameData &frame) LMS_GetStreamStatus(&m_tx_stream, &LimeStatus); overflows += LimeStatus.overrun; underflows += LimeStatus.underrun; - late_packets += LimeStatus.droppedPackets; + dropped_packets += LimeStatus.droppedPackets; #ifdef LIMEDEBUG etiLog.level(info) << LimeStatus.fifoFilledCount << "/" << LimeStatus.fifoSize << ":" << numSamples << "Rate" << LimeStatus.linkRate / (2 * 2.0); |