Changed alignSensors to have common src/dest
This commit is contained in:
parent
1c3838320b
commit
dc56f143f3
|
@ -219,7 +219,7 @@ void updateAccelerationReadings(rollAndPitchTrims_t *rollAndPitchTrims)
|
|||
}
|
||||
}
|
||||
|
||||
alignSensors(accSmooth, accSmooth, accAlign);
|
||||
alignSensors(accSmooth, accAlign);
|
||||
|
||||
if (!isAccelerationCalibrationComplete()) {
|
||||
performAcclerationCalibration(rollAndPitchTrims);
|
||||
|
|
|
@ -62,13 +62,12 @@ static void alignBoard(int32_t *vec)
|
|||
vec[Z] = lrintf(boardRotation[0][Z] * x + boardRotation[1][Z] * y + boardRotation[2][Z] * z);
|
||||
}
|
||||
|
||||
void alignSensors(const int32_t *src, int32_t *dest, uint8_t rotation)
|
||||
void alignSensors(int32_t *dest, uint8_t rotation)
|
||||
{
|
||||
const int32_t x = src[X];
|
||||
const int32_t y = src[Y];
|
||||
const int32_t z = src[Z];
|
||||
const int32_t x = dest[X];
|
||||
const int32_t y = dest[Y];
|
||||
const int32_t z = dest[Z];
|
||||
|
||||
// note src and dest may point to the same address
|
||||
switch (rotation) {
|
||||
default:
|
||||
case CW0_DEG:
|
||||
|
|
|
@ -23,5 +23,5 @@ typedef struct boardAlignment_s {
|
|||
int32_t yawDegrees;
|
||||
} boardAlignment_t;
|
||||
|
||||
void alignSensors(const int32_t *src, int32_t *dest, uint8_t rotation);
|
||||
void alignSensors(int32_t *dest, uint8_t rotation);
|
||||
void initBoardAlignment(const boardAlignment_t *boardAlignment);
|
||||
|
|
|
@ -62,7 +62,7 @@ void compassUpdate(uint32_t currentTime, flightDynamicsTrims_t *magZero)
|
|||
|
||||
mag.read(magADCRaw);
|
||||
for (axis = 0; axis < XYZ_AXIS_COUNT; axis++) magADC[axis] = magADCRaw[axis]; // int32_t copy to work with
|
||||
alignSensors(magADC, magADC, magAlign);
|
||||
alignSensors(magADC, magAlign);
|
||||
|
||||
if (STATE(CALIBRATE_MAG)) {
|
||||
tCal = currentTime;
|
||||
|
|
|
@ -170,7 +170,7 @@ void gyroUpdate(void)
|
|||
gyroADC[Y] = gyroADCRaw[Y];
|
||||
gyroADC[Z] = gyroADCRaw[Z];
|
||||
|
||||
alignSensors(gyroADC, gyroADC, gyroAlign);
|
||||
alignSensors(gyroADC, gyroAlign);
|
||||
|
||||
if (!isGyroCalibrationComplete()) {
|
||||
performGyroCalibration(gyroConfig->gyroMovementCalibrationThreshold);
|
||||
|
|
Loading…
Reference in New Issue