From: Joel Holdsworth Date: Sat, 2 Mar 2013 09:26:39 +0000 (+0000) Subject: Show samplerate as 1Hz when its value is unknown X-Git-Tag: pulseview-0.1.0~119 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9d4e5cd8c46b33faa44f99d0dc3bdd347758b3d8;p=pulseview.git Show samplerate as 1Hz when its value is unknown --- diff --git a/pv/view/logicsignal.cpp b/pv/view/logicsignal.cpp index 568d10b3..78ba59bc 100644 --- a/pv/view/logicsignal.cpp +++ b/pv/view/logicsignal.cpp @@ -89,8 +89,13 @@ void LogicSignal::paint(QPainter &p, int y, int left, int right, const shared_ptr &snapshot = snapshots.front(); + double samplerate = _data->get_samplerate(); + + // Show sample rate as 1Hz when it is unknown + if(samplerate == 0.0) + samplerate = 1.0; + const double pixels_offset = offset / scale; - const double samplerate = _data->get_samplerate(); const double start_time = _data->get_start_time(); const int64_t last_sample = snapshot->get_sample_count() - 1; const double samples_per_pixel = samplerate * scale;