melexis / mlx90632-library

MLX90632 library for the Melexis 90632 Infra Red temperature sensor.
Apache License 2.0
42 stars 15 forks source link

Object Pre-Calculation seems to be incorrect in driver #42

Closed JoeyFreeland-DojoFive closed 1 year ago

JoeyFreeland-DojoFive commented 1 year ago

In the MLX90632 Datasheet, section 11.1.1.2, the pre-calculations indicate that S is either the average of RAM_4 and RAM_5 (called the channel 1 pair), or the average of RAM_7, and RAM_8 (channel 2 pair). However, the function mlx90632_read_temp_object_raw returns two values: object_new_raw, which is the average of a channel pair, and object_old_raw, which is the average of the other channel pair. These two values are eventually fed into mlx90632_preprocess_temp_object which is performing the calculation of S from section 11.1.1.2:

return ((((object_new_raw + object_old_raw) / 2) / (MLX90632_REF_12)) / VR_IR) * 524288.0;

In this function, those two values, which are averages themselves, are averaged again. So the calculation of S, in the code, actually involves averaging all four RAM values together, instead of just two.

mlx-kva commented 1 year ago

Duplicate of #29