console: values in a column, the curve as a graph, and Ctrl+C
Three more things the original did better, and two bugs found doing them. `curve` walks every whole degree from 10 to 60 with a bar, which is the original's. The port sampled it every five degrees and printed a bare percentage — ten numbers for a cubic, showing none of its shape. The bar is the duty itself, so it needs no scale. `show` and `statistics` print one value per line behind a dotted label instead of a run-on line. That reads the same either way for a single reading and is the whole difference when `monitor` emits one a second forever. The label renderer is now shared with the help, since it is the same thing three times; the flash overload takes its width from the string's type, so the padding needs no hand-counted constant and the labels stay out of SRAM. `statistics` gains the sample total, and says "not available" rather than a zero it never measured. Ctrl+C echoes `^C` and gives a fresh prompt, abandoning whatever was half-typed, and it is what stops `monitor` now. Stopping on *any* byte was the port's own invention and it reads fine until a host sends a line ending: `monitor\r\n` stopped itself on the `\n` it arrived with, one reading in, which is why monitoring looked broken from a script and fine by hand. The other bug is arithmetic. A temperature's fraction came from `(quarters % 4) * 25`, and C++ gives a negative remainder for a negative dividend — so -40.25 C printed as "-40.-25". The sign comes off first now, and the fraction is two digits, so the column lines up: -40.00, -40.25. Verified against v1.8b on the board, which was flashed back to compare against directly: same 51 curve rows over the same span with the same 100-column bars, agreeing within the one percentage point the consteval table costs against the legacy runtime doubles. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
13
README.md
13
README.md
@@ -1,6 +1,6 @@
|
||||
# fantemp
|
||||
|
||||
**v2.1.** Temperature-controlled fan firmware (ATmega328P, 16 MHz), rewritten on
|
||||
**v2.2.** Temperature-controlled fan firmware (ATmega328P, 16 MHz), rewritten on
|
||||
[libavr](https://git.blackmark.me/avr/libavr): thermistor on ADC0 sampled
|
||||
free-running and averaged over 1000 conversions, fan on OC0B at 50 kHz,
|
||||
115200 Bd serial console (`help` lists the commands), temperature
|
||||
@@ -21,6 +21,17 @@ command that cannot be abbreviated, because `r` should not be able to wipe the
|
||||
histogram. `save` (new) forces a writeback, which otherwise happens every 30
|
||||
minutes and on the way into the bootloader.
|
||||
|
||||
`show`, `statistics` and the histogram print one value per line behind a dotted
|
||||
label, the way the original did — a run-on line is fine for one reading and
|
||||
unreadable when `monitor` emits one a second. `curve` walks every whole degree
|
||||
from 10 to 60 with a bar, because the curve is a cubic and five-degree samples
|
||||
without a graph show none of its shape.
|
||||
|
||||
**Ctrl+C** abandons a half-typed line and gives a fresh prompt, echoing `^C`, and
|
||||
it is what stops `monitor`. Stopping on *any* byte, which is what the port did
|
||||
first, reads well right up until a host sends a line ending: `monitor\r\n` then
|
||||
stopped itself on the `\n` it arrived with, one reading in.
|
||||
|
||||
## Reaching the bootloader
|
||||
|
||||
`bootloader` **jumps**; it does not reset. That is not a style choice:
|
||||
|
||||
Reference in New Issue
Block a user