1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-24 00:35:34 +03:00

Store current position as desired after braking has been finished

This commit is contained in:
Pawel Spychalski (DzikuVx) 2018-05-04 14:55:03 +02:00
parent 4400c0af0f
commit a13f749eb2
2 changed files with 8 additions and 1 deletions

View file

@ -103,7 +103,8 @@ typedef enum {
NAV_CRUISE_ACCELERATING = (1 << 12),
NAV_CRUISE_BRAKING = (1 << 13),
NAV_HIGHSPEED_CRUISE = (1 << 14),
NAV_CRUISE_STOPPED = (1 << 15)
NAV_CRUISE_STOPPED = (1 << 15),
NAV_CRUISE_STORE_POSITION = (1 << 16)
} stateFlags_t;
#define DISABLE_STATE(mask) (stateFlags &= ~(mask))

View file

@ -1991,6 +1991,12 @@ static bool adjustPositionFromRCInput(void)
rcRollAdjustment
)) {
DISABLE_STATE(NAV_CRUISE_BRAKING);
/*
* When braking is done, store current position as desired one
* We do not want to go back to the place where braking has started
*/
setDesiredPosition(&posControl.actualState.pos, 0, NAV_POS_UPDATE_XY);
}
}