From 23f5fabbcff97cb96691d87ec9a17c6c8fe11c48 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 6 Jun 2019 09:33:28 +1000 Subject: [PATCH] Tools: autotest: add tests for aux-switch options for mission reset and clear --- Tools/autotest/arducopter.py | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index 91d211356f..a40e382f7c 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -3323,6 +3323,39 @@ class AutoTestCopter(AutoTest): if ex is not None: raise ex + def get_mission_count(self): + return self.get_parameter("MIS_TOTAL") + + def assert_mission_count(self, expected): + count = self.get_mission_count() + if count != expected: + raise NotAchievedException("Unexpected count got=%u want=%u" % + (count, expected)) + + def test_aux_switch_options(self): + self.set_parameter("RC7_OPTION", 58) # clear waypoints + self.load_mission("copter_loiter_to_alt.txt") + self.set_rc(7, 1000) + self.assert_mission_count(5) + self.progress("Clear mission") + self.set_rc(7, 2000) + self.assert_mission_count(0) + self.set_rc(7, 1000) + self.set_parameter("RC7_OPTION", 24) # reset mission + self.delay_sim_time(2) + self.load_mission("copter_loiter_to_alt.txt") + set_wp = 4 + self.mavproxy.send("wp set %u\n" % set_wp) + self.delay_sim_time(1) + self.drain_mav() + self.wait_current_waypoint(set_wp, timeout=10) + self.progress("Reset mission") + self.set_rc(7, 2000) + self.delay_sim_time(1) + self.drain_mav() + self.wait_current_waypoint(0, timeout=10) + self.set_rc(7, 1000) + def tests(self): '''return list of all tests''' ret = super(AutoTestCopter, self).tests() @@ -3368,6 +3401,10 @@ class AutoTestCopter(AutoTest): "Set modes via auxswitch", self.test_setting_modes_via_auxswitch), + ("AuxSwitchOptions", + "Test random aux mode options", + self.test_aux_switch_options), + ("AutoTune", "Fly AUTOTUNE mode", self.fly_autotune), ("ThrowMode", "Fly Throw Mode", self.fly_throw_mode),