mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +03:00
Decouple sensor alignment from all acc/gyro/mag drivers.
This resulted in the removal of duplicate logic, duplicate code and the removal of a temporary buffer per-driver. The NAZE specific sensor alignment is now contained within the core code instead of in the drivers. The sensor alignment is determines by the sensor initialisation code. The alignment of sensor readings is now performed once and only by the appropriate sensor code, see usages of alignSensors(). The acc/gyro/compass driver code is now more reusable since it has no dependencies on the main code.
This commit is contained in:
parent
0f3e4add48
commit
297609d4c3
18 changed files with 124 additions and 185 deletions
|
@ -9,6 +9,7 @@
|
|||
uint16_t calibratingG = 0;
|
||||
uint16_t acc_1G = 256; // this is the 1G measured acceleration.
|
||||
gyro_t gyro; // gyro access functions
|
||||
sensor_align_e gyroAlign = 0;
|
||||
|
||||
void GYRO_Common(void)
|
||||
{
|
||||
|
@ -54,5 +55,6 @@ void Gyro_getADC(void)
|
|||
{
|
||||
// range: +/- 8192; +/- 2000 deg/sec
|
||||
gyro.read(gyroADC);
|
||||
alignSensors(gyroADC, gyroADC, gyroAlign);
|
||||
GYRO_Common();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue