melexis / mlx90640-library

MLX90640 library functions
Apache License 2.0
241 stars 192 forks source link

Interleaved vs Chess Mode, or why engineering protoype gives better image then the new part #10

Closed mkostrun closed 4 years ago

mkostrun commented 6 years ago

in API in function void MLX90640_CalculateTo(uint16_t frameData, const paramsMLX90640 params, float emissivity, float tr, float *result){..}

shouldn't mode be determined instead l.308: mode = (frameData[832] & 0x1000) >> 5;

as l.308: mode = (frameData[832] & 0x1000) >> 12;

mkostrun commented 6 years ago

Add to that a creative way of finding the calibrationModeEE in

void ExtractCILCParameters(uint16_t eeData, paramsMLX90640 mlx90640) { float ilChessC[3]; uint8_t calibrationModeEE;

// calibrationModeEE = (eeData[10] & 0x0800) >> 4; // calibrationModeEE = calibrationModeEE ^ 0x80; calibrationModeEE = ((eeData[12] & 0x1000) >> 12);

... ... }

which should be 0 for interleaved or 1for chess mode.

This then means that in

void MLX90640::CalculateTo(uint16_t frameData, float emissivity, float tr, float result) { ... mode = (frameData[832] & 0x1000) >> 12; ... } as 832 carries the copy of the control Register 1.

slavysis commented 6 years ago

Well, this is a matter of implementation. Both codes would return the same result. Note that mode is either checked for being 0 or compared to calibrationModeEE and both are aligned in the same way (0x80). So, it does not matter whether you align the relevant bit to bit 0 or bit 7 as long as you have it in the same place in both variables - mode and calibrationModeEE. The only thing is that the correct place to look for the calibrationModeEE would be eeData[10] and not eeData[12].

Best regards