Change temperature curve to cubic
This commit is contained in:
parent
aab90f0fc0
commit
d6fa78ae5f
@ -24,7 +24,14 @@ void Controller::callback()
|
|||||||
|
|
||||||
uint8_t Controller::mapTemperature(double temperature)
|
uint8_t Controller::mapTemperature(double temperature)
|
||||||
{
|
{
|
||||||
double fanSpeed = (10 * temperature - 200) / 3;
|
[[maybe_unused]] constexpr auto linearCurve = [](double x) { return (10 * x - 200) / 3; };
|
||||||
|
constexpr auto cubicCurve = [](double x) {
|
||||||
|
if (x < 20)
|
||||||
|
return 0.0;
|
||||||
|
return 0.002246 * x * x * x - 0.09 * x * x + 0.91 * x;
|
||||||
|
};
|
||||||
|
|
||||||
|
double fanSpeed = cubicCurve(temperature);
|
||||||
return clamp<uint8_t>(fanSpeed, 0, 100);
|
return clamp<uint8_t>(fanSpeed, 0, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user