From f7de2f03b42bdde242c89dee597a2477bccded28 Mon Sep 17 00:00:00 2001
From: Lorenz Meier <lm@inf.ethz.ch>
Date: Mon, 16 Mar 2015 10:08:43 +0100
Subject: [PATCH] Line chart widget: Auto-force ground time if offset is more
 than 3 seconds (30% of default view width)

---
 src/ui/linechart/LinechartWidget.cc | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/ui/linechart/LinechartWidget.cc b/src/ui/linechart/LinechartWidget.cc
index 6992f1cc20..ab6291f3b8 100644
--- a/src/ui/linechart/LinechartWidget.cc
+++ b/src/ui/linechart/LinechartWidget.cc
@@ -351,11 +351,15 @@ void LinechartWidget::appendData(int uasId, const QString& curve, const QString&
     {
         lastTimestamp = usec;
     } else if (usec != 0) {
-        // Difference larger than 5 secs, enforce ground time
-        if (((qint64)usec - (qint64)lastTimestamp) > 5000)
+        // Difference larger than 3 secs, enforce ground time
+        if (((qint64)usec - (qint64)lastTimestamp) > 3000)
         {
             autoGroundTimeSet = true;
-            if (activePlot) activePlot->groundTime();
+            // Tick ground time checkbox, but avoid state switching
+            timeButton->blockSignals(true);
+            timeButton->setChecked(true);
+            timeButton->blockSignals(false);
+            if (activePlot) activePlot->enforceGroundTime(true);
         }
     }
 
-- 
GitLab