int MLX90614_SetEmissivity(uint8_t slaveAddr, float value)
{
int error = 0;
uint16_t data;
uint16_t curE;
uint16_t newE = 0;
float temp = 0;
if(value > 1.0 || value < 0.05)
{
return -6;
}
temp = value * 65535 + 0.5;
newE = temp;
error = MLX90614_SMBusRead(slaveAddr, 0x24, &curE);
if(error == 0)
{
error = MLX90614_SMBusRead(slaveAddr, 0x2F, &data);
if(error == 0)
{
temp = curE*data;
temp = temp/newE + 0.5;
data = temp;
if(data > 0x7FFF)
{
return -6;
}
error = MLX90614_SendCommand(slaveAddr, 0x60);
if(error == 0)
{
error = MLX90614_SMBusWrite(slaveAddr, 0x24, 0x0000);
if(error == 0)
{
error = MLX90614_SMBusWrite(slaveAddr, 0x24, newE);
if(error == 0)
{
error = MLX90614_SMBusWrite(slaveAddr, 0x2F, 0x0000);
if(error == 0)
{
error = MLX90614_SMBusWrite(slaveAddr, 0x2F, data);
if(error == 0)
{
error = MLX90614_SendCommand(slaveAddr, 0x61);
}
}
}
}
}
}
}
return error;
}
In the application note it says to enter EEPROM address 0x0F unlock key and then to change both
0x0Fand0x04registers forMLX90614xCxtype models, which is one used on your evaluation board.It seems this is not being followed in your
setEmissivityCorrectionCoefficientmethod:DFRobot_MLX90614/DFRobot_MLX90614.cpp
Line 39 in 3d196b3
A snippet from Melexis' oficial repo: