From b49b9b7b27564665800fa572678c8403bbdab489 Mon Sep 17 00:00:00 2001 From: Simon Hancock Date: Sun, 25 Feb 2024 18:20:30 +0000 Subject: [PATCH] MAVExplorer: Add message descriptions to stats command --- MAVProxy/modules/lib/msgstats.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/MAVProxy/modules/lib/msgstats.py b/MAVProxy/modules/lib/msgstats.py index c9cb3d0c83..31b9bf39c4 100644 --- a/MAVProxy/modules/lib/msgstats.py +++ b/MAVProxy/modules/lib/msgstats.py @@ -87,7 +87,15 @@ def show_stats(mlog): pairs = sorted(pairs, key = lambda p : p[1]) for (name,size) in pairs: if size > 0: - print("%-*s %.2f%%" % (maxnamelen, name, 100.0 * size / total_size)) + descstr = '' + if hasattr(mlog, 'metadata'): + desc = mlog.metadata.get_description(name) + if desc: + if len(desc) > (68 - maxnamelen): + descstr = " [%s...]" % desc[:(65 - maxnamelen)] + else: + descstr = " [%s]" % desc + print("%-*s %5.2f%%%s" % (maxnamelen, name, 100.0 * size / total_size, descstr)) print("") category_total = 0