From ede65ec7e78c5da43c62276aab549c28fbdaf4c9 Mon Sep 17 00:00:00 2001
From: Marko Mecina <marko.mecina@univie.ac.at>
Date: Fri, 21 Jul 2023 15:38:40 +0200
Subject: [PATCH] bugfix in data decoding

---
 Ccs/ccs_function_lib.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Ccs/ccs_function_lib.py b/Ccs/ccs_function_lib.py
index e61f800..4f98da2 100644
--- a/Ccs/ccs_function_lib.py
+++ b/Ccs/ccs_function_lib.py
@@ -708,8 +708,13 @@ def Tmformatted(tm, separator='\n', sort_by_name=False, textmode=True, udef=Fals
     tmtcname = " / ".join(tmtcnames)
 
     if nocal:
-        def _get_val_func(x):
-            return [str(x[2]), str(x[4][0]), '']
+        # check if packet size is variable (because of different returned data structure)
+        if not isinstance(sourcedata[0][-1], tuple):
+            def _get_val_func(x):
+                return [str(x[2]), str(x[4]), '']
+        else:
+            def _get_val_func(x):
+                return [str(x[2]), str(x[4][0]), '']
     else:
         def _get_val_func(x):
             return [str(x[2]), str(x[0]), none_to_empty(x[1])]
-- 
GitLab