Changed alignSensors to have common src/dest

This commit is contained in:
Martin Budden 2016-11-20 07:46:58 +00:00
parent 1c3838320b
commit dc56f143f3
5 changed files with 8 additions and 9 deletions

View File

@ -219,7 +219,7 @@ void updateAccelerationReadings(rollAndPitchTrims_t *rollAndPitchTrims)
}
}
alignSensors(accSmooth, accSmooth, accAlign);
alignSensors(accSmooth, accAlign);
if (!isAccelerationCalibrationComplete()) {
performAcclerationCalibration(rollAndPitchTrims);

View File

@ -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:

View File

@ -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);

View File

@ -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;

View File

@ -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);