summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-11-19 11:31:01 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2020-11-19 11:31:01 +0100
commitbbef876335d0603a86393ef8dcceaca24094e599 (patch)
tree1fe8644449eadb6fc14a2287b86e295e2247c656
parent89d564fa6a6ed7f97d8b0f0201b1424340f21c27 (diff)
DataProcessor: Handle broken LA measurements
-rw-r--r--lib/lennart/DataProcessor.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/lennart/DataProcessor.py b/lib/lennart/DataProcessor.py
index 1e30f36..67c6fb6 100644
--- a/lib/lennart/DataProcessor.py
+++ b/lib/lennart/DataProcessor.py
@@ -39,6 +39,15 @@ class DataProcessor:
time_stamp_data = self.sync_data.timestamps[use_data_after_index:]
+ # Each synchronization pulse consists of two LogicAnalyzer pulses, so four
+ # entries in time_stamp_data (rising edge, falling edge, rising edge, falling edge).
+ # If we have less then twelve entries, we observed no transitions and don't even have
+ # valid synchronization data. In this case, we bail out.
+ if len(time_stamp_data) < 12:
+ raise RuntimeError(
+ f"LogicAnalyzer sync data has length {len(time_stamp_data)}, expected >= 12"
+ )
+
last_data = [0, 0, 0, 0]
# clean timestamp data, if at the end strange ts got added somehow