Hello,
FYI, this library has a systematic buffer overflow when you read a register with readReg. Indeed, the variable buf should have a length of 3 bytes and not only 2 bytes. Third byte is used for CRC8 in readReg function. For example
float DFRobot_MLX90614::getAmbientTempCelsius(void) {
uint8_t buf[3]; //3 and not 2 !
readReg(MLX90614_TA, buf);
...
Here is the corrected code with the following improvements:
- Fixed bug related to buffer overflows when reading registers.
- Write a new value to a register only if that value is not already set (read before write).
- New read (and/or write) functions for Emissivity, FIR, IIR, Gain and Raw Temperatures!
Best regards,
Hello,
FYI, this library has a systematic buffer overflow when you read a register with
readReg. Indeed, the variablebufshould have a length of 3 bytes and not only 2 bytes. Third byte is used for CRC8 inreadRegfunction. For exampleHere is the corrected code with the following improvements:
Best regards,