diff --git a/DSView/pv/data/dsosnapshot.cpp b/DSView/pv/data/dsosnapshot.cpp index 71120de5..3186d4fa 100644 --- a/DSView/pv/data/dsosnapshot.cpp +++ b/DSView/pv/data/dsosnapshot.cpp @@ -51,6 +51,7 @@ DsoSnapshot::DsoSnapshot() : _threshold = 0; _measure_voltage_factor1 = 0; _measure_voltage_factor2 = 0; + _is_file = false; memset(_envelope_levels, 0, sizeof(_envelope_levels)); } @@ -83,7 +84,8 @@ void DsoSnapshot::init_all() _ring_sample_count = 0; _memory_failed = false; _last_ended = true; - _envelope_done = false; + _envelope_done = false; + _is_file = false; for (unsigned int i = 0; i < _channel_num; i++) { for (unsigned int level = 0; level < ScaleStepCount; level++) { @@ -122,6 +124,7 @@ void DsoSnapshot::first_payload(const sr_datafeed_dso &dso, uint64_t total_sampl bool channel_changed = false; uint16_t channel_num = 0; + _is_file = isFile; for (const GSList *l = channels; l; l = l->next) { sr_channel *const probe = (sr_channel*)l->data; diff --git a/DSView/pv/data/dsosnapshot.h b/DSView/pv/data/dsosnapshot.h index 724f023a..01955321 100644 --- a/DSView/pv/data/dsosnapshot.h +++ b/DSView/pv/data/dsosnapshot.h @@ -127,6 +127,10 @@ public: return index == 0 ? _data_scale1 : _data_scale2; } + inline bool is_file(){ + return _is_file; + } + private: void append_data(void *data, uint64_t samples, bool instant); void free_envelop(); @@ -146,6 +150,7 @@ private: uint64_t _measure_voltage_factor2; float _data_scale1 = 0; float _data_scale2 = 0; + bool _is_file; friend class DsoSnapshotTest::Basic; }; diff --git a/DSView/pv/view/dsosignal.cpp b/DSView/pv/view/dsosignal.cpp index b67004ef..1ac02efc 100644 --- a/DSView/pv/view/dsosignal.cpp +++ b/DSView/pv/view/dsosignal.cpp @@ -830,9 +830,14 @@ void DsoSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColor const uint32_t count = (index == 0) ? status.ch0_cyc_cnt : status.ch1_cyc_cnt; const bool plevel = (index == 0) ? status.ch0_plevel : status.ch1_plevel; const bool startXORend = (index == 0) ? (status.ch0_cyc_llen == 0) : (status.ch1_cyc_llen == 0); - const uint16_t total_channels = g_slist_length(session->get_device()->get_channels()); + uint16_t total_channels = g_slist_length(session->get_device()->get_channels()); + + if (total_channels == 1 && _data->is_file()){ + total_channels++; + } + const double tfactor = (total_channels / enabled_channels) * SR_GHZ(1) * 1.0 / samplerate; - + double samples = (index == 0) ? status.ch0_cyc_tlen : status.ch1_cyc_tlen; _period = ((count == 0) ? 0 : samples / count) * tfactor;