mirror of
https://github.com/esphome/esphome.git
synced 2026-10-03 09:46:03 +00:00
[sensor] Fix a double promotion warning in the NTC resistance filter (#19985)
This commit is contained in:
@@ -450,7 +450,7 @@ optional<float> ToNTCResistanceFilter::new_value(float value) {
|
||||
}
|
||||
double k = 273.15;
|
||||
// https://de.wikipedia.org/wiki/Steinhart-Hart-Gleichung#cite_note-stein2_s4-3
|
||||
double t = value + k;
|
||||
double t = static_cast<double>(value) + k;
|
||||
double y = (this->a_ - 1 / (t)) / (2 * this->c_);
|
||||
double x = sqrt(pow(this->b_ / (3 * this->c_), 3) + y * y);
|
||||
double resistance = exp(pow(x - y, 1 / 3.0) - pow(x + y, 1 / 3.0));
|
||||
|
||||
Reference in New Issue
Block a user