From 51917e59c35b212bfdc1fb3cb699d24ca277bcd9 Mon Sep 17 00:00:00 2001 From: muramura Date: Fri, 25 Oct 2024 08:00:05 +0900 Subject: [PATCH] AP_DDS: Change the comparison of float value zero to IS_XXXX --- libraries/AP_DDS/AP_DDS_Client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_DDS/AP_DDS_Client.cpp b/libraries/AP_DDS/AP_DDS_Client.cpp index fca7d2f614687..81eee764c686c 100644 --- a/libraries/AP_DDS/AP_DDS_Client.cpp +++ b/libraries/AP_DDS/AP_DDS_Client.cpp @@ -347,9 +347,9 @@ void AP_DDS_Client::update_topic(sensor_msgs_msg_BatteryState& msg, const uint8_ if (battery.current_amps(current, instance)) { if (percentage == 100) { msg.power_supply_status = 4; //POWER_SUPPLY_STATUS_FULL - } else if (current < 0.0) { + } else if (is_negative(current)) { msg.power_supply_status = 1; //POWER_SUPPLY_STATUS_CHARGING - } else if (current > 0.0) { + } else if (is_positive(current)) { msg.power_supply_status = 2; //POWER_SUPPLY_STATUS_DISCHARGING } else { msg.power_supply_status = 3; //POWER_SUPPLY_STATUS_NOT_CHARGING