Commit 057ee44
committed
drivers: sensor: adi: adxl345: take selected range into account in conversion
When running the samples/sensor/accel_trig sample with a adxl345 sensor
the logged output values were doubled compared to the expected values.
The sensor_channel_get() path calls adxl345_accel_convert which did not
handle the configured g-range, resulting in invalid sample values except
for the +/-16g range. To fix this issue the configured range is taken
into account and different conversion factors are applied.
adxl345_accel_convert is also made static as it is not used by another file.
Signed-off-by: Stefan Schmidt <[email protected]>1 parent 923ece1 commit 057ee44
2 files changed
+23
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
315 | | - | |
| 315 | + | |
| 316 | + | |
316 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
317 | 325 | | |
318 | 326 | | |
319 | 327 | | |
320 | 328 | | |
321 | | - | |
322 | | - | |
| 329 | + | |
| 330 | + | |
323 | 331 | | |
324 | 332 | | |
325 | 333 | | |
| |||
349 | 357 | | |
350 | 358 | | |
351 | 359 | | |
352 | | - | |
| 360 | + | |
| 361 | + | |
353 | 362 | | |
354 | 363 | | |
355 | | - | |
| 364 | + | |
| 365 | + | |
356 | 366 | | |
357 | 367 | | |
358 | | - | |
| 368 | + | |
| 369 | + | |
359 | 370 | | |
360 | 371 | | |
361 | | - | |
362 | | - | |
363 | | - | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
364 | 378 | | |
365 | 379 | | |
366 | 380 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | | - | |
295 | 294 | | |
296 | 295 | | |
297 | 296 | | |
| |||
0 commit comments