From 2adb811a9c8c09762ccb1801ee23d5737cc41279 Mon Sep 17 00:00:00 2001 From: muramura Date: Mon, 30 Sep 2024 11:42:02 +0900 Subject: [PATCH] AP_SmartRTL: Share the same wording --- libraries/AP_SmartRTL/AP_SmartRTL.cpp | 8 ++++---- libraries/AP_SmartRTL/AP_SmartRTL.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/AP_SmartRTL/AP_SmartRTL.cpp b/libraries/AP_SmartRTL/AP_SmartRTL.cpp index ed25eee43b4c30..c9ea094212a4e9 100644 --- a/libraries/AP_SmartRTL/AP_SmartRTL.cpp +++ b/libraries/AP_SmartRTL/AP_SmartRTL.cpp @@ -118,7 +118,7 @@ void AP_SmartRTL::init() // check if memory allocation failed if (_path == nullptr || _prune.loops == nullptr || _simplify.stack == nullptr) { log_action(Action::DEACTIVATED_INIT_FAILED); - GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "SmartRTL deactivated: init failed"); + GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "%s deactivated: init failed", flightMode); free(_path); free(_prune.loops); free(_simplify.stack); @@ -390,7 +390,7 @@ void AP_SmartRTL::run_background_cleanup() // warn if buffer is about to be filled uint32_t now_ms = AP_HAL::millis(); if ((path_points_count >0) && (path_points_count >= _path_points_max - 9) && (now_ms - _last_low_space_notify_ms > 10000)) { - GCS_SEND_TEXT(MAV_SEVERITY_INFO, "SmartRTL Low on space!"); + GCS_SEND_TEXT(MAV_SEVERITY_INFO, "%s Low on space!", flightMode); _last_low_space_notify_ms = now_ms; } @@ -857,7 +857,7 @@ AP_SmartRTL::dist_point AP_SmartRTL::segment_segment_dist(const Vector3f &p1, co // difference between two closest points const Vector3f dP = line_start_diff+line1*t1-line2*t2; - const Vector3f midpoint = (p1+line1*t1 + p3+line2*t2)/2.0f; + const Vector3f midpoint = (p1+line1*t1 + p3+line2*t2) * 0.5f; return {dP.length(), midpoint}; } @@ -866,7 +866,7 @@ void AP_SmartRTL::deactivate(Action action, const char *reason) { _active = false; log_action(action); - GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "SmartRTL deactivated: %s", reason); + GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "%s deactivated: %s", flightMode, reason); } #if HAL_LOGGING_ENABLED diff --git a/libraries/AP_SmartRTL/AP_SmartRTL.h b/libraries/AP_SmartRTL/AP_SmartRTL.h index d2c5b439e04c97..bdca0f7280df47 100644 --- a/libraries/AP_SmartRTL/AP_SmartRTL.h +++ b/libraries/AP_SmartRTL/AP_SmartRTL.h @@ -240,4 +240,6 @@ class AP_SmartRTL { // returns true if the two loops overlap (used within add_loop to determine which loops to keep or throw away) bool loops_overlap(const prune_loop_t& loop1, const prune_loop_t& loop2) const; + + const char *flightMode = "SmartRTL"; };