diff --git a/libraries/AC_Avoidance/AP_OADijkstra.cpp b/libraries/AC_Avoidance/AP_OADijkstra.cpp index b78a50cc86..cf1fbc9a48 100644 --- a/libraries/AC_Avoidance/AP_OADijkstra.cpp +++ b/libraries/AC_Avoidance/AP_OADijkstra.cpp @@ -88,6 +88,7 @@ AP_OADijkstra::AP_OADijkstra_State AP_OADijkstra::update(const Location ¤t if (!_shortest_path_ok) { _shortest_path_ok = calc_shortest_path(current_loc, destination); if (!_shortest_path_ok) { + AP::logger().Write_OADijkstra(DIJKSTRA_STATE_ERROR, 0, 0, destination, destination); return DIJKSTRA_STATE_ERROR; } // start from 2nd point on path (first is the original origin) @@ -126,9 +127,9 @@ AP_OADijkstra::AP_OADijkstra_State AP_OADijkstra::update(const Location ¤t return DIJKSTRA_STATE_SUCCESS; } - // log failure - AP::logger().Write_OADijkstra(DIJKSTRA_STATE_ERROR, 0, 0, destination, destination); - return DIJKSTRA_STATE_ERROR; + // we have reached the destination so avoidance is no longer required + AP::logger().Write_OADijkstra(DIJKSTRA_STATE_NOT_REQUIRED, 0, 0, destination, destination); + return DIJKSTRA_STATE_NOT_REQUIRED; } // returns true if polygon fence is enabled