AP_DDS: Change the comparison of float value zero to IS_XXXX

This commit is contained in:
muramura 2024-10-25 08:00:05 +09:00 committed by Peter Barker
parent b353765db1
commit 10b2f17594
1 changed files with 2 additions and 2 deletions

View File

@ -348,9 +348,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