Change temperature curve to cubic

This commit is contained in:
BlackMark 2020-04-01 05:07:30 +02:00
parent aab90f0fc0
commit d6fa78ae5f

View File

@ -24,7 +24,14 @@ void Controller::callback()
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);
}