mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
Vector library expansion (#12968)
This commit is contained in:
parent
fc4b7a0008
commit
f71170db1b
37 changed files with 630 additions and 587 deletions
|
@ -407,7 +407,7 @@ bool accInit(uint16_t accSampleRateHz)
|
|||
}
|
||||
#endif
|
||||
acc.dev.accAlign = alignment;
|
||||
buildRotationMatrixFromAlignment(customAlignment, &acc.dev.rotationMatrix);
|
||||
buildRotationMatrixFromAngles(&acc.dev.rotationMatrix, customAlignment);
|
||||
|
||||
if (!accDetect(&acc.dev, accelerometerConfig()->acc_hardware)) {
|
||||
return false;
|
||||
|
@ -453,10 +453,10 @@ void performAcclerationCalibration(rollAndPitchTrims_t *rollAndPitchTrims)
|
|||
}
|
||||
|
||||
// Sum up CALIBRATING_ACC_CYCLES readings
|
||||
a[axis] += acc.accADC[axis];
|
||||
a[axis] += acc.accADC.v[axis];
|
||||
|
||||
// Reset global variables to prevent other code from using un-calibrated data
|
||||
acc.accADC[axis] = 0;
|
||||
acc.accADC.v[axis] = 0;
|
||||
accelerationRuntime.accelerationTrims->raw[axis] = 0;
|
||||
}
|
||||
|
||||
|
@ -495,9 +495,9 @@ void performInflightAccelerationCalibration(rollAndPitchTrims_t *rollAndPitchTri
|
|||
if (InflightcalibratingA == 50)
|
||||
b[axis] = 0;
|
||||
// Sum up 50 readings
|
||||
b[axis] += acc.accADC[axis];
|
||||
b[axis] += acc.accADC.v[axis];
|
||||
// Clear global variables for next reading
|
||||
acc.accADC[axis] = 0;
|
||||
acc.accADC.v[axis] = 0;
|
||||
accelerationRuntime.accelerationTrims->raw[axis] = 0;
|
||||
}
|
||||
// all values are measured
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue