Skip to content

Commit

Permalink
mavproxy_battery.py: avoid exception if no battery_status messages
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Sep 7, 2024
1 parent eb7f22b commit b344a7a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions MAVProxy/modules/mavproxy_battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def numcells(self, id):

def cmd_bat(self, args):
'''show battery levels'''
if 0 not in self.battery_level:
print("No battery information")
return
print("Flight battery: %u%%" % self.battery_level[0])
for id in range(9):
if self.numcells(id) != 0 and id in self.voltage_level:
Expand Down

0 comments on commit b344a7a

Please sign in to comment.