]> jspc29.x-matter.uni-frankfurt.de Git - mvdsensorcontrol.git/commitdiff
Textual representation of unpacked data improved
authorPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Wed, 15 Oct 2014 15:40:35 +0000 (17:40 +0200)
committerPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Wed, 15 Oct 2014 15:40:35 +0000 (17:40 +0200)
tools/python_hld_unpacker/hld_unpacker/unpacker.py
tools/python_hld_unpacker/hld_unpacker/utils.py

index 0314ed9d44527c9ebc2a4ebf3f8740b210730cfc..b28e205dd0043ccef8a8dd416f150fc5fac97831 100644 (file)
@@ -88,7 +88,7 @@ class SubEvent(object):
 
 class SubSubEvent(object):
 
-    # The SubSubEvent header consists of a single words
+    # The SubSubEvent header consists of a single word
     HEADERSIZE = WORDSIZE * 1
     HEADER_FMT = '>HH'
 
@@ -106,7 +106,10 @@ class SubSubEvent(object):
         fmt = "     |-> size:  0x{:04x}  address: 0x{:04x}\n"
         out = fmt.format(self.size, self.address)
         out += "\n"
-        out += str_32bit_chunks(self.payload_bytes)
+        if len(self.payload_bytes):
+            out += "       "
+            out += str_32bit_chunks(self.payload_bytes).replace('\n','\n       ')
+            out += "\n\n"
         return out
 
 #### ------ Generator Functions to read the HLD into the (sub)event classes ------ ####
index 93057fbaabec2fcf66b281c3d03fbe7a10aea547..099c0cb570f42723e2dcee9dd1301527c31b7318 100644 (file)
@@ -26,5 +26,5 @@ def str_32bit_chunks(data):
     for line_words in split_by_n(words, words_per_line):
         out += "{:04x}:  {}\n".format(i, "  ".join(line_words))
         i += int(wordlength/2) * words_per_line
-    return out
+    return out.strip()