1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 22:35:23 +03:00

Merge pull request #3741 from elektronisk/patch-1

OSD, adjust the heading angles where "compass bar" and "numerical heading" arrows change
This commit is contained in:
Martin Budden 2017-08-12 07:39:47 +01:00 committed by GitHub
commit 7580b25d80

View file

@ -223,8 +223,10 @@ static void osdFormatPID(char * buff, const char * label, const pid8_t * pid)
static uint8_t osdGetHeadingIntoDiscreteDirections(int heading, int directions)
{
heading = (heading + 360) % 360;
heading = heading * 2 / (360 * 2 / directions);
// Split input heading 0..359 into sectors 0..(directions-1), but offset
// by half a sector so that sector 0 gets centered around heading 0.
heading = (heading * 2 + 360 / directions) % 720;
heading = heading / (360 * 2 / directions);
return heading;
}