mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +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:
commit
7580b25d80
1 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue