From 86da761cf8ad8f6a08551a330864728994c1bd20 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 16 Dec 2023 11:52:43 +1100 Subject: [PATCH 1/2] fixed mavplayback --- tools/mavplayback.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/mavplayback.py b/tools/mavplayback.py index ed896d507..0082ca142 100755 --- a/tools/mavplayback.py +++ b/tools/mavplayback.py @@ -122,7 +122,7 @@ def pause(self): def rewind(self): '''rewind 10%''' - pos = int(self.mlog.filehandle.tell() - 0.1*self.filesize) + pos = int(self.mlog.f.tell() - 0.1*self.filesize) if pos < 0: pos = 0 self.mlog.filehandle.seek(pos) @@ -130,7 +130,7 @@ def rewind(self): def forward(self): '''forward 10%''' - pos = int(self.mlog.filehandle.tell() + 0.1*self.filesize) + pos = int(self.mlog.f.tell() + 0.1*self.filesize) if pos > self.filesize: pos = self.filesize - 2048 self.mlog.filehandle.seek(pos) @@ -149,7 +149,7 @@ def find_message(self): self.msg = self.mlog.recv_match(condition=args.condition) if self.msg is not None and self.msg.get_type() != 'BAD_DATA': break - if self.mlog.filehandle.tell() > self.filesize - 10: + if self.mlog.f.tell() > self.filesize - 10: self.paused = True break self.last_timestamp = getattr(self.msg, '_timestamp') @@ -190,13 +190,13 @@ def next_message(self): while True: self.msg = self.mlog.recv_match(condition=args.condition) - if self.msg is None and self.mlog.filehandle.tell() > self.filesize - 10: + if self.msg is None and self.mlog.f.tell() > self.filesize - 10: self.paused = True return if self.msg is not None and self.msg.get_type() != "BAD_DATA": break - pos = float(self.mlog.filehandle.tell()) / self.filesize + pos = float(self.mlog.f.tell()) / self.filesize self.slider.set(pos) self.filepos = self.slider.get() From 0a605e161899ba6c60a306d3afb0b656ef6b7a42 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 16 Dec 2023 11:52:58 +1100 Subject: [PATCH 2/2] fixed mavsplit_sysid --- tools/mavsplit_sysid.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/mavsplit_sysid.py b/tools/mavsplit_sysid.py index b905da35a..6f9324fad 100755 --- a/tools/mavsplit_sysid.py +++ b/tools/mavsplit_sysid.py @@ -50,13 +50,16 @@ def process(filename): if args.condition and not mavutil.evaluate_condition(args.condition, mlog.messages): continue + if m.get_type() == 'BAD_DATA': + continue + sysid = m.get_srcSystem() if not sysid in output: fname = "%s-%u.%s" % (base, sysid, extension) print("Creating %s" % fname) output[sysid] = open(fname, mode='wb') - if output[sysid] and m.get_type() != 'BAD_DATA': + if output[sysid]: timestamp = getattr(m, '_timestamp', None) output[sysid].write(struct.pack('>Q', int(timestamp*1.0e6))) output[sysid].write(m.get_msgbuf())