From 98d897e790927cbc11aeeb83cd27ca688c6e1163 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Mon, 15 Jul 2019 11:22:31 +0200 Subject: [PATCH] Tools: common: implement do_set_relay and do_set_relay_mavproxy --- Tools/autotest/common.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index fdf6e4ab81..7fce105cbf 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -1457,6 +1457,25 @@ class AutoTest(ABC): if m.heading == int(heading): return + def do_set_relay(self, relay_num, on_off, timeout=10): + """Set relay with a command long message.""" + self.progress("Set relay %d to %d" % (relay_num, on_off)) + self.run_cmd(mavutil.mavlink.MAV_CMD_DO_SET_RELAY, + relay_num, + on_off, + 0, + 0, + 0, + 0, + 0, + timeout=timeout) + + def do_set_relay_mavproxy(self, relay_num, on_off): + """Set relay with mavproxy.""" + self.progress("Set relay %d to %d" % (relay_num, on_off)) + self.mavproxy.send('module load relay\n') + self.mavproxy.expect("Loaded module relay") + self.mavproxy.send("relay set %d %d\n" % (relay_num, on_off)) ################################################# # WAIT UTILITIES #################################################