Skip to content

Commit

Permalink
Autotest: Reconfig Rover tests for new relay params
Browse files Browse the repository at this point in the history
  • Loading branch information
MattKear committed Dec 6, 2023
1 parent ad69ba7 commit c9d9450
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions Tools/autotest/rover.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,15 @@ def ServoRelayEvents(self):
'''Test ServoRelayEvents'''
for method in self.run_cmd, self.run_cmd_int:
self.context_push()

self.set_parameters({
"RELAY1_FUNCTION": 1, # Enable relay 1 as a standard relay pin
"RELAY1_PIN": 1, # Set pin number, 1 in SIM_MASK_PIN
"RELAY2_FUNCTION": 1, # Enable relay 2 as a standard relay pin
"RELAY2_PIN": 2 # Set pin number, 2 in SIM_MASK_PIN
})
self.reboot_sitl() # Needed for relay functions to take effect

method(mavutil.mavlink.MAV_CMD_DO_SET_RELAY, p1=0, p2=0)
off = self.get_parameter("SIM_PIN_MASK")
method(mavutil.mavlink.MAV_CMD_DO_SET_RELAY, p1=0, p2=1)
Expand Down Expand Up @@ -602,8 +611,14 @@ def ServoRelayEvents(self):
"on": 0,
})

# add another servo:
self.set_parameter("RELAY6_PIN", 14)
# add another relay and ensure that it changes the "present field"
self.set_parameters({
"RELAY6_FUNCTION": 1, # Enable relay 6 as a standard relay pin
"RELAY6_PIN": 6, # Set pin number, 32 in SIM_MASK_PIN
})
self.reboot_sitl() # Needed for relay function to take effect
self.set_message_rate_hz("RELAY_STATUS", 10) # Need to re-request the message since reboot

self.assert_received_message_field_values('RELAY_STATUS', {
"present": 35,
"on": 0,
Expand Down Expand Up @@ -5369,14 +5384,16 @@ def test_scripting_auxfunc(self):
self.context_collect("STATUSTEXT")
self.set_parameters({
"SCR_ENABLE": 1,
"RELAY1_PIN": 1,
"RELAY1_FUNCTION": 1
})
self.install_example_script_context("RCIN_test.lua")
self.reboot_sitl()

self.wait_parameter_value("SIM_PIN_MASK", 121)
self.wait_parameter_value("SIM_PIN_MASK", 123)
self.wait_parameter_value("SIM_PIN_MASK", 121)
self.set_parameter("RELAY1_PIN", 1)

self.wait_parameter_value("SIM_PIN_MASK", 127)
self.wait_parameter_value("SIM_PIN_MASK", 125)
self.wait_parameter_value("SIM_PIN_MASK", 127)

self.context_pop()
self.reboot_sitl()
Expand Down

0 comments on commit c9d9450

Please sign in to comment.