From b7e25c6ca7746e86ef201b9be7ecec57bf5b2d2a Mon Sep 17 00:00:00 2001
From: Daniel Friesel <daniel.friesel@uos.de>
Date: Thu, 22 Oct 2020 15:05:09 +0200
Subject: Improve sync=la timing restoration. There's still something fishy
 though...

---
 lib/lennart/DataProcessor.py   |  5 +++--
 lib/lennart/SigrokInterface.py | 43 +-----------------------------------------
 2 files changed, 4 insertions(+), 44 deletions(-)

(limited to 'lib/lennart')

diff --git a/lib/lennart/DataProcessor.py b/lib/lennart/DataProcessor.py
index 8d762e7..90cc54d 100644
--- a/lib/lennart/DataProcessor.py
+++ b/lib/lennart/DataProcessor.py
@@ -228,9 +228,10 @@ class DataProcessor:
 
         def getDataText(x):
             # print(x)
+            dl = len(annotateData)
             for i, xt in enumerate(self.modified_timestamps):
-                if xt > x:
-                    return "Value: %s" % annotateData[i - 5]
+                if xt > x and i >= 4 and i - 5 < dl:
+                    return f"SoT: {annotateData[i - 5]}"
 
         def update_annot(x, y, name):
             annot.xy = (x, y)
diff --git a/lib/lennart/SigrokInterface.py b/lib/lennart/SigrokInterface.py
index 1733b68..32e8fe2 100644
--- a/lib/lennart/SigrokInterface.py
+++ b/lib/lennart/SigrokInterface.py
@@ -1,4 +1,5 @@
 import json
+import numpy as np
 
 from dfatool.lennart.DataInterface import DataInterface
 import logging
@@ -62,48 +63,6 @@ class SigrokResult:
         return SigrokResult(data["timestamps"], data["onBeforeFirstChange"])
         pass
 
-    @classmethod
-    def fromTraces(cls, traces):
-        """
-        Generates SigrokResult from ptalog.json traces
-
-        :param traces: traces from dfatool ptalog.json
-        :return: SigrokResult object
-        """
-        timestamps = [0]
-        for tr in traces:
-            for t in tr["trace"]:
-                # print(t['online_aggregates']['duration'][0])
-                timestamps.append(
-                    timestamps[-1] + (t["online_aggregates"]["duration"][0] * 10 ** -6)
-                )
-
-        # print(timestamps)
-        # prepend FAKE Sync point
-        t_neu = [0.0, 0.0000001, 1.0, 1.00000001]
-        for i, x in enumerate(timestamps):
-            t_neu.append(
-                round(float(x) + t_neu[3] + 0.20, 6)
-            )  # list(map(float, t_ist.split(",")[:i+1]))
-
-        # append FAKE Sync point / eine überschneidung
-        # [30.403632, 30.403639, 31.407265, 31.407271]
-        # appendData = [29.144855,30.148495,30.148502,30.403632,30.403639,31.407265,31.407271,]
-        appendData = [0, 1.000001, 1.000002, 1.25, 1.2500001]
-
-        # TODO future work here, why does the sync not work completely
-        t_neu[-1] = (
-            t_neu[-2] + (t_neu[-1] - t_neu[-2]) * 0.9
-        )  # Weird offset failure with UART stuff
-
-        offset = t_neu[-1] - appendData[0]
-        for x in appendData:
-            t_neu.append(x + offset)
-
-        # print(t_neu)
-        print(len(t_neu))
-        return SigrokResult(t_neu, False)
-
 
 class SigrokInterface(DataInterface):
     def __init__(self, sample_rate, driver="fx2lafw", filename="temp/sigrok.log"):
-- 
cgit v1.2.3