From 48224892e1d2e4bf2a909c5e2876bdc916ba38b2 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sat, 1 Jul 2023 13:33:29 +1000 Subject: [PATCH] autotest: add a get_cached_message method saves looking up where to get these from all the time --- Tools/autotest/common.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index 66f15a25f1..6d7f804ce2 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -7247,6 +7247,10 @@ class AutoTest(ABC): raise WaitWaypointTimeout("Timed out waiting for waypoint %u of %u" % (wpnum_end, wpnum_end)) + def get_cached_message(self, message_type): + '''returns the most-recently received instance of message_type''' + return self.mav.messages[message_type] + def mode_is(self, mode, cached=False, drain_mav=True): if not cached: self.wait_heartbeat(drain_mav=drain_mav)