Skip to content

Commit

Permalink
AP_DDS: Change the comparison of float value zero to IS_XXXX
Browse files Browse the repository at this point in the history
  • Loading branch information
muramura authored and peterbarker committed Oct 28, 2024
1 parent 380e9aa commit 51917e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/AP_DDS/AP_DDS_Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 51917e5

Please sign in to comment.