From 4cabd742e33e6d96872dfc43478c9167af6be3ac Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 25 Sep 2024 09:24:55 +1000 Subject: [PATCH] param_help.py: pretty-print Bitmask in eg. 'param help GUID_OPTIONS' output --- MAVProxy/modules/lib/param_help.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/MAVProxy/modules/lib/param_help.py b/MAVProxy/modules/lib/param_help.py index a9aaa429f3..c89d856dd5 100644 --- a/MAVProxy/modules/lib/param_help.py +++ b/MAVProxy/modules/lib/param_help.py @@ -165,6 +165,9 @@ def param_help(self, args): try: print("\n") for f in help.field: + if f.get('name') == 'Bitmask': + # handled specially below + continue print("%s : %s" % (f.get('name'), str(f))) except Exception as e: pass @@ -177,6 +180,16 @@ def param_help(self, args): except Exception as e: print("Caught exception %s" % repr(e)) pass + try: + # note this is a dictionary: + values = self.get_bitmask_from_help(help) + if values is not None and len(values): + print("\nBitmask: ") + for (n, v) in values.items(): + print(f"\t{int(n):3d} : {v}") + except Exception as e: + print("Caught exception %s" % repr(e)) + pass else: print("Parameter '%s' not found in documentation" % h)