From f9fde66966e6f9ee6895484e70e52736c262015c Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 7 Aug 2024 16:25:21 +1000 Subject: [PATCH] autotest: add test for Battery InternalUseOnly --- Tools/autotest/arducopter.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index dd0522c59c3c4..638fe6ffdf683 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -11704,6 +11704,31 @@ def MissionRTLYawBehaviour(self): if abs(new_heading - original_heading) > 5: raise NotAchievedException(f"Should return to original heading want={original_heading} got={new_heading}") + def BatteryInternalUseOnly(self): + '''batteries marked as internal use only should not appear over mavlink''' + self.set_parameters({ + "BATT_MONITOR": 4, # 4 is analog volt+curr + "BATT2_MONITOR": 4, + }) + self.reboot_sitl() + self.wait_message_field_values('BATTERY_STATUS', { + "id": 0, + }) + self.wait_message_field_values('BATTERY_STATUS', { + "id": 1, + }) + self.progress("Making battery private") + self.set_parameters({ + "BATT_OPTIONS": 256, + }) + self.wait_message_field_values('BATTERY_STATUS', { + "id": 1, + }) + for i in range(10): + self.assert_received_message_field_values('BATTERY_STATUS', { + "id": 1 + }) + def tests2b(self): # this block currently around 9.5mins here '''return list of all tests''' ret = ([ @@ -11802,6 +11827,7 @@ def tests2b(self): # this block currently around 9.5mins here self.REQUIRE_POSITION_FOR_ARMING, self.LoggingFormat, self.MissionRTLYawBehaviour, + self.BatteryInternalUseOnly, ]) return ret