Skip to content

Commit

Permalink
Remove back-and-forth float to int to float conversion in acceleratio…
Browse files Browse the repository at this point in the history
…n calculation (betaflight#13158)

Remove float to int to float conversion in acceleration calculation
  • Loading branch information
tbolin authored Nov 13, 2023
1 parent 6d7bfb9 commit 4891a55
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/sensors/acceleration.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void accUpdate(timeUs_t currentTimeUs)
applyAccelerationTrims(accelerationRuntime.accelerationTrims);

for (int axis = 0; axis < XYZ_AXIS_COUNT; axis++) {
const int16_t val = acc.accADC[axis];
const float val = acc.accADC[axis];
acc.accADC[axis] = accelerationRuntime.accLpfCutHz ? pt2FilterApply(&accelerationRuntime.accFilter[axis], val) : val;
}
}
Expand Down

0 comments on commit 4891a55

Please sign in to comment.