Skip to content

Commit

Permalink
[nav] fix glide computation with a cast uint->int
Browse files Browse the repository at this point in the history
fix #2906
  • Loading branch information
gautierhattenberger committed Sep 28, 2022
1 parent 3440ff3 commit 4197663
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sw/airborne/firmwares/rotorcraft/navigation.h
Expand Up @@ -305,7 +305,7 @@ static inline void NavGlide(uint8_t start_wp, uint8_t wp)
{
int32_t start_alt = waypoints[start_wp].enu_i.z;
int32_t diff_alt = waypoints[wp].enu_i.z - start_alt;
int32_t alt = start_alt + ((diff_alt * nav_leg_progress) / nav_leg_length);
int32_t alt = start_alt + ((diff_alt * nav_leg_progress) / (int32_t)nav_leg_length);
NavVerticalAltitudeMode(POS_FLOAT_OF_BFP(alt), 0);
}

Expand Down

0 comments on commit 4197663

Please sign in to comment.