mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 17:25:18 +03:00
de-duplicate degrees to radians code.
Note, this also makes the operator precedence clearer.
This commit is contained in:
parent
41b5a01958
commit
d7eb416aa9
5 changed files with 14 additions and 5 deletions
2
src/mw.c
2
src/mw.c
|
@ -142,7 +142,7 @@ void annexCode(void)
|
|||
rcCommand[THROTTLE] = lookupThrottleRC[tmp2] + (tmp - tmp2 * 100) * (lookupThrottleRC[tmp2 + 1] - lookupThrottleRC[tmp2]) / 100; // [0;1000] -> expo -> [MINTHROTTLE;MAXTHROTTLE]
|
||||
|
||||
if (f.HEADFREE_MODE) {
|
||||
float radDiff = (heading - headFreeModeHold) * M_PI / 180.0f;
|
||||
float radDiff = degreesToRadians(heading - headFreeModeHold);
|
||||
float cosDiff = cosf(radDiff);
|
||||
float sinDiff = sinf(radDiff);
|
||||
int16_t rcCommand_PITCH = rcCommand[PITCH] * cosDiff + rcCommand[ROLL] * sinDiff;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue