1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-26 17:55:28 +03:00

Update navigation.c

This commit is contained in:
breadoven 2024-04-16 09:48:31 +01:00
parent eb8843bc9c
commit 79e974d735

View file

@ -2859,21 +2859,21 @@ static bool isWaypointReached(const fpVector3_t * waypointPos, const int32_t * w
{ {
posControl.wpDistance = calculateDistanceToDestination(waypointPos); posControl.wpDistance = calculateDistanceToDestination(waypointPos);
// Check if waypoint was missed based on bearing to WP exceeding given angular limit relative to initial waypoint bearing. // Check if waypoint was missed based on bearing to waypoint exceeding given angular limit relative to initial waypoint bearing.
// Default angular limit = 100 degs with a reduced limit of 60 degs used if fixed wing waypoint turn smoothing option active // Default angular limit = 100 degs with a reduced limit of 60 degs used if fixed wing waypoint turn smoothing option active
uint16_t relativeBearingErrorLimit = 10000; uint16_t relativeBearingTargetAngle = 10000;
if (STATE(AIRPLANE) && posControl.flags.wpTurnSmoothingActive) { if (STATE(AIRPLANE) && posControl.flags.wpTurnSmoothingActive) {
// If WP turn smoothing CUT option used WP is reached when start of turn is initiated // If WP mode turn smoothing CUT option used waypoint is reached when start of turn is initiated
if (navConfig()->fw.wp_turn_smoothing == WP_TURN_SMOOTHING_CUT) { if (navConfig()->fw.wp_turn_smoothing == WP_TURN_SMOOTHING_CUT) {
posControl.flags.wpTurnSmoothingActive = false; posControl.flags.wpTurnSmoothingActive = false;
return true; return true;
} }
relativeBearingErrorLimit = 6000; relativeBearingTargetAngle = 6000;
} }
if (ABS(wrap_18000(calculateBearingToDestination(waypointPos) - *waypointBearing)) > relativeBearingErrorLimit) { if (ABS(wrap_18000(calculateBearingToDestination(waypointPos) - *waypointBearing)) > relativeBearingTargetAngle) {
return true; return true;
} }