Skip to content

Commit

Permalink
multiple: Fix abs(int) usage on float values
Browse files Browse the repository at this point in the history
  • Loading branch information
sverrevr authored and bresch committed Aug 15, 2023
1 parent 5f9443a commit b21ad6a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/drivers/heater/heater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void Heater::Run()

_controller_time_on_usec = math::constrain(_controller_time_on_usec, 0, _controller_period_usec);

if (abs(temperature_delta) < TEMPERATURE_TARGET_THRESHOLD) {
if (fabsf(temperature_delta) < TEMPERATURE_TARGET_THRESHOLD) {
_temperature_target_met = true;

} else {
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/telemetry/hott/messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ build_gps_response(uint8_t *buffer, size_t *size)

if (lat < 0) {
msg.latitude_ns = 1;
lat = abs(lat);
lat = fabs(lat);
}

int deg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ GeofenceBreachAvoidance::generateLoiterPointForMultirotor(geofence_violation_typ
Vector2d test_point;

// binary search for the distance from the drone to the geofence in the given direction
while (abs(current_max - current_min) > 0.5f) {
while (fabsf(current_max - current_min) > 0.5f) {
test_point = waypointFromBearingAndDistance(_current_pos_lat_lon, _test_point_bearing, current_distance);

if (!geofence->isInsidePolygonOrCircle(test_point(0), test_point(1), _current_alt_amsl)) {
Expand Down

0 comments on commit b21ad6a

Please sign in to comment.