From 8347a86d5952ea79b42a519d498fc77e4b979a6c Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sun, 20 Oct 2024 12:53:41 +1100 Subject: [PATCH] Tools: add --core to solution_status_change.py --- Tools/scripts/solution_status_change.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Tools/scripts/solution_status_change.py b/Tools/scripts/solution_status_change.py index 4a052aa0e4..4431b576eb 100755 --- a/Tools/scripts/solution_status_change.py +++ b/Tools/scripts/solution_status_change.py @@ -17,8 +17,11 @@ from pymavlink import mavutil class SolutionStatusChange(object): - def __init__(self, master): + def __init__(self, master, core=None): self.master = master + self.core = core + if self.core is not None: + self.core = set(self.core) def progress(self, text): '''emit text with possible timestamps etc''' @@ -53,13 +56,13 @@ class SolutionStatusChange(object): old_message_per_core = {} while True: m = self.conn.recv_match(type=desired_type) - if m.C != 0: - continue if m is None: break if m.C not in old_message_per_core: old_message_per_core[m.C] = m continue + if self.core is not None and m.C not in self.core: + continue current = old_message_per_core[m.C] if m.SS == current.SS: continue @@ -86,6 +89,9 @@ class SolutionStatusChange(object): if __name__ == '__main__': parser = optparse.OptionParser("solution-status-change.py [options]") + parser.add_option("", "--core", action="append", type="int", + default=[], help="core to show (default is all)") + (opts, args) = parser.parse_args() if len(args) < 1: @@ -94,5 +100,8 @@ if __name__ == '__main__': master = args[0] - tester = SolutionStatusChange(master) + if len(opts.core) == 0: + opts.core = None + + tester = SolutionStatusChange(master, core=opts.core) tester.run()