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>
This commit is contained in:
29
src/main.cpp
Normal file
29
src/main.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user