build: the libavr pin advances past phase 6

The renames land (interrupt_guard, consume_reset_cause, set_duty), the
sampler binds its input in the new converter shape (the input pack plus
in<>::start() as free-running's one kick), and the console states
.allow_baud_error = true for the 115200-at-16-MHz this board has always
spoken - the receiver-tolerance table libavr now enforces is stricter
than the rate's own +2.1 %. The loader probe reads through
avr::flash_load instead of raw pgmspace, the terminal's line buffer is
std::array with backspace and delete named, the tree is reformatted
under InsertBraces, and the sources are ASCII.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-09 11:45:07 +02:00
parent 0e9060db69
commit b1caf49522
13 changed files with 161 additions and 113 deletions

View File

@@ -5,9 +5,9 @@
#include <libavr/flash.hpp>
// 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.
// The auto-mode fan curve, tabulated at compile time: a cubic in C
// (0.002246*x^3 - 0.09*x^2 + 0.91*x, zero below 20 C) as a flash_table of
// duty percent per C.
namespace app::curve {
namespace detail {
@@ -15,33 +15,39 @@ namespace detail {
consteval std::uint8_t duty_entry(int celsius)
{
double x = celsius;
if (x < 20)
if (x < 20) {
return 0;
}
double duty = 0.002246 * x * x * x - 0.09 * x * x + 0.91 * x;
if (duty < 0)
if (duty < 0) {
duty = 0;
if (duty > 100)
}
if (duty > 100) {
duty = 100;
}
return static_cast<std::uint8_t>(duty + 0.5);
}
inline constexpr avr::flash_table<[] {
std::array<std::uint8_t, 100> out{};
for (int t = 0; t < 100; ++t)
for (int t = 0; t < 100; ++t) {
out[static_cast<std::size_t>(t)] = duty_entry(t);
}
return out;
}()>
table;
} // namespace detail
// Duty percent for a temperature (clamped to the 0..99 °C table window).
// Duty percent for a temperature (clamped to the 0..99 C table window).
inline std::uint8_t duty(std::int8_t celsius)
{
if (celsius < 0)
if (celsius < 0) {
celsius = 0;
if (celsius > 99)
}
if (celsius > 99) {
celsius = 99;
}
return detail::table[static_cast<std::uint8_t>(celsius)];
}