1
0
Fork 0
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:
digitalentity 2015-07-07 19:30:02 +10:00
parent 8a06849657
commit a3b57386c2
6 changed files with 85 additions and 35 deletions

View file

@ -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;