drivers: sensor: max31865: fix compilation warning -Wdouble-promotion
Fixes type mix-match for rtd temperature calculation. Also changes coefficient array name for clarity. Signed-off-by: Maxmillion McLaughlin <max@sorcerer.earth>
This commit is contained in:
parent
303c674b41
commit
7497b8bbbe
2 changed files with 4 additions and 4 deletions
|
@ -99,9 +99,9 @@ static double calculate_temperature(double resistance, double resistance_0)
|
|||
}
|
||||
resistance /= resistance_0;
|
||||
resistance *= 100.0;
|
||||
temperature = A[0] + A[1] * resistance + A[2] * pow(resistance, 2) -
|
||||
A[3] * pow(resistance, 3) - A[4] * pow(resistance, 4) +
|
||||
A[5] * pow(resistance, 5);
|
||||
temperature = RTD_C[0] + RTD_C[1] * resistance + RTD_C[2] * pow(resistance, 2) -
|
||||
RTD_C[3] * pow(resistance, 3) - RTD_C[4] * pow(resistance, 4) +
|
||||
RTD_C[5] * pow(resistance, 5);
|
||||
return temperature;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ LOG_MODULE_REGISTER(MAX31865, CONFIG_SENSOR_LOG_LEVEL);
|
|||
* For under zero, taken from
|
||||
* https://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf
|
||||
*/
|
||||
static const float A[6] = {-242.02, 2.2228, 2.5859e-3, 4.8260e-6, 2.8183e-8, 1.5243e-10};
|
||||
static const double RTD_C[6] = {-242.02, 2.2228, 2.5859e-3, 4.8260e-6, 2.8183e-8, 1.5243e-10};
|
||||
|
||||
struct max31865_data {
|
||||
double temperature;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue