mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 22:35:23 +03:00
Convert gyroADC and accADC to int32_t
This commit is contained in:
parent
468cebcec2
commit
881a448255
8 changed files with 30 additions and 22 deletions
|
@ -35,11 +35,13 @@
|
|||
|
||||
#include "sensors/acceleration.h"
|
||||
|
||||
int16_t accADC[XYZ_AXIS_COUNT];
|
||||
int32_t accADC[XYZ_AXIS_COUNT];
|
||||
int16_t accADCRaw[XYZ_AXIS_COUNT];
|
||||
|
||||
acc_t acc; // acc access functions
|
||||
sensor_align_e accAlign = 0;
|
||||
uint16_t acc_1G = 256; // this is the 1G measured acceleration.
|
||||
int axis;
|
||||
|
||||
uint16_t calibratingA = 0; // the calibration is done is the main loop. Calibrating decreases at each cycle down to 0, then we enter in a normal mode.
|
||||
|
||||
|
@ -80,7 +82,6 @@ void resetRollAndPitchTrims(rollAndPitchTrims_t *rollAndPitchTrims)
|
|||
void performAcclerationCalibration(rollAndPitchTrims_t *rollAndPitchTrims)
|
||||
{
|
||||
static int32_t a[3];
|
||||
uint8_t axis;
|
||||
|
||||
for (axis = 0; axis < 3; axis++) {
|
||||
|
||||
|
@ -172,10 +173,12 @@ void applyAccelerationTrims(flightDynamicsTrims_t *accelerationTrims)
|
|||
|
||||
void updateAccelerationReadings(rollAndPitchTrims_t *rollAndPitchTrims)
|
||||
{
|
||||
if (!acc.read(accADC)) {
|
||||
if (!acc.read(accADCRaw)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (axis = 0; axis < XYZ_AXIS_COUNT; axis++) accADC[axis] = accADCRaw[axis];
|
||||
|
||||
alignSensors(accADC, accADC, accAlign);
|
||||
|
||||
if (!isAccelerationCalibrationComplete()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue