1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 05:15:25 +03:00
Commit graph

11 commits

Author SHA1 Message Date
Mathias Rasmussen
90e792e243 Use ARRAYLEN macro where applicable 2022-10-12 13:14:51 +02:00
Mathias Rasmussen
78df1374f1 Use angle brackets with standard library headers 2021-12-29 22:44:41 +01:00
Dominic Clifton
980df1536f Refactored arbitrary gyro and mag alignment.
The original implementation:

* removed the old 'alignment' variable
* did not require 'ALIGN_CUSTOM'
* always used rotation matrix
* had no additional per-pid-loop conditional logic.

Extract currently unused code into tests.
In preparation for either deleting or re-using in validateAndFixConfig.

Fix code style of some old boardalignment code.

De-duplicate vector rotation code.

Now that rotation code is exacted from `alignBoard` and now  doesn't use
`boardRotation` some if it was similar to the code in `rotateV` in
maths.c

Use DECIDEGREES for mag and gyro/acc custom alignments.

Use unnamed structure instead of `values`.

Redefine what 'custom' orientation means.

Move alignment test-only code into the tests.

Ensure gyro/mag custom alignment settings follow the enum variations.

This can't be applied to ALIGN_DEFAULT because, in the case of the MAG,
the default isn't actually known until the gyro is detected, see
`compassDetect`.

OMNIBUSF4/F7 - Don't use ALIGN_DEFAULT in target.h,
common_defaults_post.h does this now.

Comment cleanup.

Delete unused alignment code left from various tests/refactoring
efforts.

* Please do not squash this commit.

Fix SITL build by avoiding structure assignment with anonymous inner
struct.

The error from the build server was as follows:

```./src/main/common/sensor_alignment.c:49:5: error: missing initializer
for field ‘yaw’ of ‘struct <anonymous>’
[-Werror=missing-field-initializers]
     *sensorAlignment = CUSTOM_ALIGN_CW0_DEG;
     ^
In file included from ./src/main/common/sensor_alignment.c:27:0:
./src/main/common/sensor_alignment.h:80:17: note: ‘yaw’ declared here
         int16_t yaw;
                 ^
```

Cleanup sensor_alignment API.
2019-07-13 11:51:20 +12:00
Adrian Miriuta
b21d681153 Introduced cli parameter <gyro_offset_yaw>
It allows to manually compensate gyro drift over time.
rebased squashed.
2018-01-25 12:45:38 +01:00
Steffen Windoffer
03aa31acdd remove not needed whitespaces 2017-08-24 11:33:39 +02:00
Martin Budden
dc076c17bd Fixed up tests 2016-12-05 07:12:45 +00:00
Martin Budden
5cd5eb96e5 Fixed up tests 2016-11-20 09:36:14 +00:00
Anders Hoglund
15d9eaffd4 Added junittest XML test results. 2016-10-16 17:48:31 +02:00
Martin Budden
f6bcbff239 Got alignsensor unit test working 2016-10-16 12:51:30 +01:00
Martin Budden
2e71ac3b84 Got unit tests working by removing non-working tests 2016-10-16 10:12:41 +01:00
Phillip Jones
f239eb3f35 This addresses issue #8 by adding unit tests for sensorsAlign().
The test file includes a simple independent implementation of
vector rotation. Each of the following sensor_align_e types are
tested:
 * CW0_DEG
 * CW90_DEG
 * CW180_DEG
 * CW270_DEG
 * CW0_DEG_FLIP
 * CW90_DEG_FLIP
 * CW180_DEG_FLIP
 * CW270_DEG_FLIP

For each test, three unit vectors and a random vector are tested.
 * {1, 0, 0}
 * {0, 1, 0}
 * {0, 0, 1}
 * {R, R, R} (where R is a random number)

The vector under test is rotated using the functions defined in the
test file. The output of the test function is compared to the
output of the sensorsAlign() function. The outputs match for all
test conditions.
2015-08-18 14:00:37 -06:00