Open yagui opened 11 months ago
After doing some test, when the data stored at the lower byte in EE[0x2433] is above 128, the value should be considered positive in the line 770. Otherwise the calculation will result in incorrect vdd values. So I assume that vdd_25 has to be considered always as positive, and maybe the datasheet should be fixed.
Indeed this value is always negative. Thus the driver always substracts 256 (two's complement). The driver works properly and the datasheet needs some modification in order to make this clear and avoid confusion.
The datasheet says vdd_25 is a 8 bit integer with sign. This means that it could go from -128 to 127. But in this code, when it is masked with
0x00ff
, and then stored in aint16_t
it will always store a positive value https://github.com/melexis/mlx90640-library/blob/f6be7ca1d4a55146b705f3d347f84b773b29cc86/functions/MLX90640_API.c#L766 https://github.com/melexis/mlx90640-library/blob/f6be7ca1d4a55146b705f3d347f84b773b29cc86/functions/MLX90640_API.c#L770-L771This is easy to fix, but I'm not sure this is a bug or I'm not understanding the code correctly