summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-03-18 22:20:56 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-03-18 22:20:56 +0100
commitbdeafb42eef3a9d0a7886ef47003a2208bb489fe (patch)
treeced6369672f905d4b805427076cdd0e5cdcc7053
parent4c6b0def2da27635e593192ba1a2a604a824f6ab (diff)
add preliminary sense_minmax support
-rwxr-xr-xbin/dlog-viewer16
1 files changed, 10 insertions, 6 deletions
diff --git a/bin/dlog-viewer b/bin/dlog-viewer
index fd5b923..8d296d8 100755
--- a/bin/dlog-viewer
+++ b/bin/dlog-viewer
@@ -201,13 +201,13 @@ class DLog:
self.channels = list(map(DLogChannel, channels))
self.interval = float(dlog.find("frame").find("tint").text)
self.sense_minmax = int(dlog.find("frame").find("sense_minmax").text)
- self.planned_duration = int(dlog.find("frame").find("time").text)
- self.observed_duration = self.interval * int(len(raw_data) / (4 * num_channels))
if self.sense_minmax:
- raise RuntimeError(
- "DLog files with 'Log Min/Max' enabled are not supported yet"
- )
+ # there's a min, current, and max reading for each channel.
+ num_channels *= 3
+
+ self.planned_duration = int(dlog.find("frame").find("time").text)
+ self.observed_duration = self.interval * int(len(raw_data) / (4 * num_channels))
self.timestamps = np.linspace(
0, self.observed_duration, num=int(len(raw_data) / (4 * num_channels))
@@ -264,7 +264,11 @@ class DLog:
self.slots = [dict(), dict(), dict(), dict()]
for i, channel in enumerate(self.channels):
- channel.data = self.data[i]
+ if self.sense_minmax:
+ # [i*3] == current/avg(?), [i*3 + 1] == min, [i*3 + 2] == max
+ channel.data = self.data[i * 3]
+ else:
+ channel.data = self.data[i]
self.slots[channel.slot - 1][channel.unit] = channel
def slot_has_data(self, slot):