Commit 0a9330e
committed
Feed every column from the floor, and move the maths into the YAML
Two changes that turn out to be one.
The data line now enters at the BOTTOM of each column and runs upward, so
the thirteen feeds sit in a line along the floor of the rack where a
skirting board hides them instead of thirteen wires coming over the top.
That inverts the coordinate map: pixel 0 is a column's lowest bin - row M
on rack 1, row G on rack 2 - and the row letters count backwards up the
strand. Anchoring on `first + bins - 1` rather than on `first` is what
keeps the U's short columns right: columns 5-9 carry rows I-M, and their
row M is pixel 0 exactly like every other column's, because every column
reaches the same floor.
The `row < first` guard earns its place here in a way it did not before.
Counting down from the bottom, a negative row makes the offset LARGER, so
without it an out-of-range request returns a plausible index off the end
of the strand rather than -1.
And the headers are gone. rack_geometry.h and the two per-rack headers
were three files a user had to copy beside a config and could forget;
the same C++ now lives in `substitutions:` in the node that uses it, so
flashing a rack is copying one file. Each strand's lambda is its column
number and three ${...} references - thirteen copies of an integer and
one copy of the arithmetic, which is what the header was for.
That would normally cost the test suite, since an inline YAML lambda is
only testable by flashing a board. It does not: tests/cpp/yaml_lambda.py
lifts those blocks straight out of the configuration and
test_yaml_lambdas.cpp #includes them inside wrappers that supply the
names a lambda has in scope. The three #includes in `paint()` are the
strand's lambda, in the order the YAML has them, so the text under test
is the text that ships and a test cannot pass against a copy that has
drifted. FakeLight indexes through vector::at, which turns the bug the
whole arrangement exists to catch - a short column indexed as a tall one
- into a thrown exception rather than a flickering column elsewhere on
the rack.
Written test-first: the suite went red on ten cases, all direction
(`CHECK( 54 == 0 )` - row G sitting at the far end of its strand instead
of at the feed), and green on the one-line change to bin_first_led.
Verified: 490 Python tests, 35 C++ cases / 1223 assertions, ruff clean,
and both nodes compile to firmware - RAM unchanged at 18.1% and 17.0%,
so the geometry is still entirely in flash.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011au3uaZneMFTbnssPSwpLt1 parent 56f7a0e commit 0a9330e
15 files changed
Lines changed: 1289 additions & 964 deletions
File tree
- .github/workflows
- examples
- esphome
- tests
- cpp
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
| 485 | + | |
489 | 486 | | |
490 | 487 | | |
491 | 488 | | |
| |||
552 | 549 | | |
553 | 550 | | |
554 | 551 | | |
555 | | - | |
556 | | - | |
557 | | - | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
558 | 555 | | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
566 | 568 | | |
567 | 569 | | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
573 | 592 | | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
579 | 600 | | |
580 | | - | |
581 | | - | |
582 | | - | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
583 | 607 | | |
584 | 608 | | |
585 | 609 | | |
586 | 610 | | |
587 | 611 | | |
588 | 612 | | |
589 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
590 | 622 | | |
591 | 623 | | |
592 | 624 | | |
593 | 625 | | |
594 | 626 | | |
595 | | - | |
596 | | - | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
597 | 631 | | |
598 | 632 | | |
599 | 633 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | 8 | | |
12 | 9 | | |
13 | 10 | | |
| |||
17 | 14 | | |
18 | 15 | | |
19 | 16 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments