From 8bc1c2f5d74cd5fd760d3aac131a88a7fd785c1b Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Mon, 27 Sep 2021 10:04:49 +0200
Subject: [PATCH] L2SS-340: Ignore packets without timestamp, log reason why we
 stopped processing.

---
 devices/statistics_writer/hdf5_writer.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/devices/statistics_writer/hdf5_writer.py b/devices/statistics_writer/hdf5_writer.py
index 456d36c08..3a5956621 100644
--- a/devices/statistics_writer/hdf5_writer.py
+++ b/devices/statistics_writer/hdf5_writer.py
@@ -65,6 +65,12 @@ class hdf5_writer:
         # grab the timestamp
         statistics_timestamp = statistics_packet.timestamp()
 
+        # ignore packets with no timestamp, as they indicate FPGA processing was disabled
+        # and are useless anyway.
+        if statistics_packet.block_serial_number == 0:
+            logger.warning(f"Received statistics with no timestamp. Packet dropped.")
+            return
+
         # check if te statistics timestamp is unexpectedly older than the current one
         if statistics_timestamp < self.current_timestamp:
             logger.warning(f"Received statistics with earlier timestamp than is currently being processed ({statistics_timestamp}). Packet dropped.")
-- 
GitLab