From bbef876335d0603a86393ef8dcceaca24094e599 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 19 Nov 2020 11:31:01 +0100 Subject: DataProcessor: Handle broken LA measurements --- lib/lennart/DataProcessor.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- cgit v1.2.3