@@ -371,33 +371,34 @@ void RTL::setRtlTypeAndDestination()
371371 } else if (_param_rtl_type.get () == 6 ) {
372372 // estimate time to fly home using the same infrastructure as the battery failsafe
373373 const float rtl_alt_home = computeReturnAltitude (destination, DestinationType::DESTINATION_TYPE_HOME,
374- (float )_param_rtl_cone_ang.get ());
374+ (float )_param_rtl_cone_ang.get ());
375375 _rtl_direct.setRtlAlt (rtl_alt_home);
376376 _rtl_direct.setRtlPosition (destination, landing_loiter);
377377
378378 const rtl_time_estimate_s time_to_home = _rtl_direct.calc_rtl_time_estimate ();
379379 const float battery_remaining_s = _battery_status_sub.get ().time_remaining_s ;
380380
381381 const bool home_within_reach = time_to_home.valid
382- && PX4_ISFINITE (battery_remaining_s)
383- && (time_to_home.safe_time_estimate < battery_remaining_s);
382+ && PX4_ISFINITE (battery_remaining_s)
383+ && (time_to_home.safe_time_estimate < battery_remaining_s);
384384
385385 if (!home_within_reach) {
386386 // If battery data is valid, home is out of range: pick the closest rally point unconditionally
387387 // If battery data is unavailable (NaN), we cannot assess reachability: pick the closest home or rally point
388388 const float min_dist = PX4_ISFINITE (battery_remaining_s)
389- ? FLT_MAX
390- : get_distance_to_next_waypoint (_global_pos_sub.get ().lat ,
391- _global_pos_sub.get ().lon ,
392- _home_pos_sub.get ().lat ,
393- _home_pos_sub.get ().lon );
389+ ? FLT_MAX
390+ : get_distance_to_next_waypoint (_global_pos_sub.get ().lat ,
391+ _global_pos_sub.get ().lon ,
392+ _home_pos_sub.get ().lat ,
393+ _home_pos_sub.get ().lon );
394394
395395 PositionYawSetpoint safe_point = findClosestSafePoint (min_dist, safe_point_index);
396396
397397 if (safe_point_index != UINT8_MAX) {
398398 destination = safe_point;
399399 destination_type = DestinationType::DESTINATION_TYPE_SAFE_POINT;
400400 }
401+
401402 // If no rally points are closer (or none are defined), fall back to home (already set as the destination)
402403 }
403404
@@ -409,9 +410,9 @@ void RTL::setRtlTypeAndDestination()
409410 landing_loiter.height_m = NAN;
410411
411412 if (_vehicle_status_sub.get ().is_vtol
412- && (_vehicle_status_sub.get ().vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING)
413- && rtl_land_approaches.isAnyApproachValid ()) {
414- landing_loiter = chooseBestLandingApproach (rtl_land_approaches);
413+ && (_vehicle_status_sub.get ().vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING)
414+ && rtl_land_approaches.isAnyApproachValid ()) {
415+ landing_loiter = chooseBestLandingApproach (rtl_land_approaches);
415416 }
416417
417418 } else {
0 commit comments