]> sigrok.org Git - pulseview.git/commitdiff
Show samplerate as 1Hz when its value is unknown
authorJoel Holdsworth <redacted>
Sat, 2 Mar 2013 09:26:39 +0000 (09:26 +0000)
committerUwe Hermann <redacted>
Sun, 3 Mar 2013 16:18:13 +0000 (17:18 +0100)
pv/view/logicsignal.cpp

index 568d10b383652a438ddb88c8be09b44a6ac81e27..78ba59bcd03c1fdedd825b380f71f00d0c2e6947 100644 (file)
@@ -89,8 +89,13 @@ void LogicSignal::paint(QPainter &p, int y, int left, int right,
        const shared_ptr<pv::data::LogicSnapshot> &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;