Files
fantemp/src/main.cpp
BlackMark ab78d94872 Rewrite on libavr
Same controller: thermistor on ADC0 averaged over 1000 free-running
conversions, 50 kHz fan PWM on OC0B, 115200 Bd console with the full
command set, EEPROM temperature histogram, watchdog-reset path into the
boot section. The Steinhart-Hart math and the libm log are gone — the
Beta equation and the cubic fan curve are consteval-evaluated into
flash tables; the firmware never does floating point. Byte-identical
.text in both libavr modes. Legacy stays on master.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-18 04:37:26 +02:00

30 lines
649 B
C++

#include <libavr/libavr.hpp>
#include "board.hpp"
#include "bootloader.hpp"
#include "controller.hpp"
#include "statistics.hpp"
#include "terminal.hpp"
using namespace app;
template struct avr::isr::emit<uptime::ticker, sampler::input, serial_t>;
int main()
{
bootloader::handle_reset();
avr::init<uptime::ticker, sampler::input, fan, serial_t, statistics>();
avr::irq::enable();
sampler::input::start();
controller::init();
terminal::init();
while (true) {
controller::poll();
if (controller::data_available())
statistics::record(static_cast<std::int8_t>((controller::temperature_quarters() + 2) / 4));
terminal::poll();
}
}