mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-20 14:55:18 +03:00
Rename yawRotation to fakeToRealYawOffset
Also, add a small comment explaining the logic behind the home yaw adjustment.
This commit is contained in:
parent
200a85a2ca
commit
d624f65b20
1 changed files with 6 additions and 2 deletions
|
@ -1505,8 +1505,12 @@ void updateActualHeading(bool headingValid, int32_t newHeading)
|
|||
(posControl.homeFlags & (NAV_HOME_VALID_XY | NAV_HOME_VALID_Z)) &&
|
||||
(posControl.homeFlags & NAV_HOME_VALID_HEADING) == 0) {
|
||||
|
||||
int32_t yawRotation = newHeading - posControl.actualState.yaw;
|
||||
posControl.homePosition.yaw += yawRotation;
|
||||
// Home was stored using the fake heading (assuming boot as 0deg). Calculate
|
||||
// the offset from the fake to the actual yaw and apply the same rotation
|
||||
// to the home point.
|
||||
int32_t fakeToRealYawOffset = newHeading - posControl.actualState.yaw;
|
||||
|
||||
posControl.homePosition.yaw += fakeToRealYawOffset;
|
||||
if (posControl.homePosition.yaw < 0) {
|
||||
posControl.homePosition.yaw += DEGREES_TO_CENTIDEGREES(360);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue