Skip to content

Commit c261579

Browse files
committed
Changed output from to 'binary milli-g' (scaled to 1024 rather than 1000) - this means that the values for the default range of +/-2 g are unchanged, and all ranges give something very close to milli-g - see discussion fof pull request #1950 for information.
#1950
1 parent 2eee782 commit c261579

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/drivers/Bma421.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,13 @@ Bma421::Values Bma421::Process() {
116116
struct bma4_accel data;
117117
bma4_read_accel_xyz(&rawData, &bma);
118118

119-
data.x = 1000 * rawData.x / accelScaleFactors[accel_conf.range];
120-
data.y = 1000 * rawData.y / accelScaleFactors[accel_conf.range];
121-
data.z = 1000 * rawData.z / accelScaleFactors[accel_conf.range];
119+
// Scale the measured ADC counts to units of 'binary milli-g'
120+
// where 1g = 1024 'binary milli-g' units.
121+
// See https://github.com/InfiniTimeOrg/InfiniTime/pull/1950 for
122+
// discussion of why we opted for scaling to 1024 rather than 1000.
123+
data.x = 1024 * rawData.x / accelScaleFactors[accel_conf.range];
124+
data.y = 1024 * rawData.y / accelScaleFactors[accel_conf.range];
125+
data.z = 1024 * rawData.z / accelScaleFactors[accel_conf.range];
122126

123127
uint32_t steps = 0;
124128
bma423_step_counter_output(&steps, &bma);

0 commit comments

Comments
 (0)