From a08d57149edc181f8914e56a4453a2f73eaeec4f Mon Sep 17 00:00:00 2001 From: Jason Martens Date: Thu, 9 Jul 2015 11:38:33 -0700 Subject: [PATCH] LogAnalyser: Add double support to DataflashLog.py Doubles were added to dataflash in commit 3991e0c4767bb52fc29700045a3e0be5e00abde5. --- Tools/LogAnalyzer/DataflashLog.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tools/LogAnalyzer/DataflashLog.py b/Tools/LogAnalyzer/DataflashLog.py index 2bc7991346..8c30dc81df 100644 --- a/Tools/LogAnalyzer/DataflashLog.py +++ b/Tools/LogAnalyzer/DataflashLog.py @@ -110,6 +110,7 @@ class BinaryFormat(ctypes.LittleEndianStructure): 'i': ctypes.c_int32, 'I': ctypes.c_uint32, 'f': ctypes.c_float, + 'd': ctypes.c_double, 'n': ctypes.c_char * 4, 'N': ctypes.c_char * 16, 'Z': ctypes.c_char * 64, @@ -168,7 +169,11 @@ class BinaryFormat(ctypes.LittleEndianStructure): if scale is not None: p = property(lambda x:getattr(x, attributename) / scale) members[propertyname] = p - fields.append((attributename, BinaryFormat.FIELD_FORMAT[format])) + try: + fields.append((attributename, BinaryFormat.FIELD_FORMAT[format])) + except KeyError: + print('ERROR: Failed to add FMT type: {}, with format: {}'.format(attributename, format)) + raise createproperty(label, _type) members['_fields_'] = fields