mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 07:13:56 -04:00
AP_Scripting: Account for nil battery in Rockblock and MAVLink_HL scripts
This commit is contained in:
parent
8499a6bd78
commit
50dc591b55
@ -784,7 +784,7 @@ function HLSatcom()
|
||||
|
||||
hl2.temperature_air = math.floor(baro:get_external_temperature())
|
||||
|
||||
if battery:num_instances() > 0 then
|
||||
if battery:num_instances() > 0 and battery:capacity_remaining_pct(0) ~= nil then
|
||||
hl2.battery = battery:capacity_remaining_pct(0)
|
||||
else
|
||||
hl2.battery = 0
|
||||
|
@ -440,7 +440,7 @@ function HLSatcom()
|
||||
|
||||
hl2.temperature_air = math.floor(baro:get_external_temperature())
|
||||
|
||||
if battery:num_instances() > 0 then
|
||||
if battery:num_instances() > 0 and battery:capacity_remaining_pct(0) ~= nil then
|
||||
hl2.battery = battery:capacity_remaining_pct(0)
|
||||
else
|
||||
hl2.battery = 0
|
||||
|
Loading…
Reference in New Issue
Block a user