mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 08:15:30 +03:00
Ported fast trigonometry functions over from @Crashpilot1000 Harakiri code
Fixed maths_unittest.cc to correctly handle float-point numbers
This commit is contained in:
parent
8a06849657
commit
a3b57386c2
6 changed files with 85 additions and 35 deletions
|
@ -240,8 +240,8 @@ void annexCode(void)
|
|||
|
||||
if (FLIGHT_MODE(HEADFREE_MODE)) {
|
||||
float radDiff = degreesToRadians(heading - headFreeModeHold);
|
||||
float cosDiff = cosf(radDiff);
|
||||
float sinDiff = sinf(radDiff);
|
||||
float cosDiff = cos_approx(radDiff);
|
||||
float sinDiff = sin_approx(radDiff);
|
||||
int16_t rcCommand_PITCH = rcCommand[PITCH] * cosDiff + rcCommand[ROLL] * sinDiff;
|
||||
rcCommand[ROLL] = rcCommand[ROLL] * cosDiff - rcCommand[PITCH] * sinDiff;
|
||||
rcCommand[PITCH] = rcCommand_PITCH;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue