1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-16 21:05:32 +03:00

remove redundant function + update

This commit is contained in:
breadoven 2022-12-19 00:16:16 +00:00
parent 1015e19c81
commit e7f9f6e135
2 changed files with 7 additions and 11 deletions

View file

@ -266,6 +266,10 @@ static int8_t loiterDirection(void) {
static void calculateVirtualPositionTarget_FW(float trackingPeriod)
{
if (FLIGHT_MODE(NAV_COURSE_HOLD_MODE)) {
return;
}
float posErrorX = posControl.desiredState.pos.x - navGetCurrentActualPositionAndVelocity()->pos.x;
float posErrorY = posControl.desiredState.pos.y - navGetCurrentActualPositionAndVelocity()->pos.y;
@ -391,11 +395,11 @@ static void updatePositionHeadingController_FW(timeUs_t currentTimeUs, timeDelta
static bool errorIsDecreasing;
static bool forceTurnDirection = false;
// We have virtual position target, calculate heading error
int32_t virtualTargetBearing = calculateBearingToDestination(&virtualDesiredPosition);
if (FLIGHT_MODE(NAV_COURSE_HOLD_MODE)) {
virtualTargetBearing = posControl.desiredState.yaw;
} else {
// We have virtual position target, calculate heading error
int32_t virtualTargetBearing = calculateBearingToDestination(&virtualDesiredPosition);
}
/* If waypoint tracking enabled quickly force craft toward waypoint course line and closely track along it */