Skip to content

Commit

Permalink
autotest: add test for battery reset
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker authored and tridge committed Nov 8, 2023
1 parent d2a3fed commit b69879f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Tools/autotest/rover.py
Original file line number Diff line number Diff line change
Expand Up @@ -6614,6 +6614,20 @@ def MAV_CMD_DO_FENCE_ENABLE(self):
self.run_cmd_int(mavutil.mavlink.MAV_CMD_DO_FENCE_ENABLE, p1=0)
self.assert_fence_disabled()

def MAV_CMD_BATTERY_RESET(self):
'''manipulate battery levels with MAV_CMD_BATTERY_RESET'''
for (run_cmd, value) in (self.run_cmd, 56), (self.run_cmd_int, 97):
run_cmd(
mavutil.mavlink.MAV_CMD_BATTERY_RESET,
p1=65535, # battery mask
p2=value,
)
self.assert_received_message_field_values('BATTERY_STATUS', {
"battery_remaining": value,
}, {
"poll": True,
})

def tests(self):
'''return list of all tests'''
ret = super(AutoTestRover, self).tests()
Expand Down Expand Up @@ -6697,6 +6711,7 @@ def tests(self):
self.MAV_CMD_DO_SET_REVERSE,
self.MAV_CMD_GET_HOME_POSITION,
self.MAV_CMD_DO_FENCE_ENABLE,
self.MAV_CMD_BATTERY_RESET,
])
return ret

Expand Down

0 comments on commit b69879f

Please sign in to comment.