diff --git a/fantemp/controller.cpp b/fantemp/controller.cpp index 5f3c931..06977d8 100644 --- a/fantemp/controller.cpp +++ b/fantemp/controller.cpp @@ -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(fanSpeed, 0, 100); }