Keep the curve and thermistor comments timeless

Both headers described the port transformation ("legacy cubic becomes",
"no hand-rolled series needed") rather than what the code is. State the
cubic and the __builtin_log rationale directly.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-18 10:10:47 +02:00
parent f17ebd17e5
commit b7a2e50506
2 changed files with 5 additions and 5 deletions

View File

@@ -5,9 +5,9 @@
#include <libavr/flash.hpp>
// The auto-mode fan curve, tabulated at compile time: the legacy cubic
// (0.002246·x³ 0.09·x² + 0.91·x, zero below 20 °C) becomes a libavr
// flash_table of duty percent per °C.
// The auto-mode fan curve, tabulated at compile time: a cubic in °C
// (0.002246·x³ 0.09·x² + 0.91·x, zero below 20 °C) as a flash_table of
// duty percent per °C.
namespace app::curve {
namespace detail {

View File

@@ -21,8 +21,8 @@ namespace detail {
consteval double temperature_of(double adc)
{
double resistance = series_resistor * adc / (1023.0 - adc);
// __builtin_log constant-folds on the AVR backend, so no runtime libm
// and no hand-rolled series is needed for the compile-time table.
// __builtin_log constant-folds on the AVR backend, so the table is
// built at compile time with no runtime libm.
double steinhart = __builtin_log(resistance / nominal_resistance) / beta + 1.0 / (nominal_temperature + 273.15);
return 1.0 / steinhart - 273.15;
}