Skip to content

perf: generate the crossing animation instead of storing 2 KB of bitmaps (backport of #119) - #123

Merged
TheAngryRaven merged 1 commit into
masterfrom
claude/crossing-pattern-master
Aug 3, 2026
Merged

perf: generate the crossing animation instead of storing 2 KB of bitmaps (backport of #119)#123
TheAngryRaven merged 1 commit into
masterfrom
claude/crossing-pattern-master

Conversation

@TheAngryRaven

Copy link
Copy Markdown
Owner

Backport of b16c42e (#119) from the beta channel to master — 2,048 B of flash, isolated code, already proven on beta.

What

The two "calculating" frames shown while inside a crossing zone were hand-stored 1 KB PROGMEM bitmaps. Decoding them shows both are pure block patterns: eight 16×16 px cells confined to the odd 16 px row bands, the two frames offset by one cell so alternating them scrolls sideways. 2,048 bytes of flash to say that is a bad trade.

They're now emitted by the host-tested crossing_pattern unit and drawn with fillRect(). The bird splash is untouched — that's real artwork, not a pattern, and after this it's the only bitmap left in images.h.

Equivalence is proven, not assumed

tests/crossing_pattern_test.cpp pins the original 2 KB as goldens, rasterizes the generated rectangles into a framebuffer, and memcmps all 128×64 pixels of both frames. What shows on the device is unchanged.

Note on how this was applied

Not a straight cherry-pick. display_pages.ino, images.h and CLAUDE.md are CRLF on master and LF on BETA, so git cherry-pick conflicts on the entire file for each of them.

Applied by hand instead:

  • images.h — verified byte-identical between master and BETA-pre-change modulo line endings first, then took BETA's post-change content converted back to CRLF.
  • display_pages.ino, CLAUDE.md — the individual hunks applied in place, so master keeps its CRLF. (CLAUDE.md needed a different anchor row anyway: master has no sprint_select entry.)
  • crossing_pattern.{h,cpp}, tests/crossing_pattern_test.cpp, and the two CMake one-liners came across unchanged.

Diff is 9 files / +339 / −139, with no whole-file line-ending churn.

Test plan

  • cmake -S tests -B build && cmake --build build271 cases / 4,192 assertions, all pass on master
  • The 5 frameRects cases specifically: 5 passed / 167 assertions, including both byte-identical golden comparisons
  • No dangling references to image_data_calculating1/2 outside comments and the test goldens
  • crossing_pattern.cpp added to both tests/CMakeLists.txt and BirdsEye/sim/CMakeLists.txt (the sim compiles display_pages.ino, so omitting it would be an undefined symbol at link)
  • CI: compile-sketch flash delta should show ≈ −2,048 B on both boards

Generated by Claude Code

Backport of b16c42e from the beta channel (PR #119).

The two 'calculating' frames were hand-stored 1 KB PROGMEM bitmaps, but
decoding them shows both are pure block patterns: eight 16x16 px cells
confined to the odd 16 px row bands, with the two frames offset by one
cell so alternating them scrolls sideways. Storing 2048 bytes of flash
to say that is a bad trade.

They are now emitted by the new host-tested crossing_pattern unit and
drawn with fillRect(). Equivalence is proven, not assumed: the original
2 KB is pinned as goldens in crossing_pattern_test.cpp, which rasterizes
the generated rectangles and memcmps all 128x64 pixels of both frames.
The bird splash is untouched - it is real artwork, not a pattern.

Applied by hand rather than by cherry-pick: display_pages.ino, images.h
and CLAUDE.md are CRLF on master and LF on BETA, so a straight pick
conflicts on the whole file. images.h was confirmed identical to BETA's
modulo line endings before taking its post-change content; the
display_pages.ino and CLAUDE.md hunks were applied in place so master
keeps its CRLF.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HnTP6BdA9xjLR5hSWE9frb
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Coverage — host-testable units

📂 Overall coverage

Metric Coverage
Lines 🟢 799/809 (98.8%)
Functions 🟢 83/83 (100.0%)
Branches 🟢 622/691 (90.0%)

📄 File coverage

File Lines Functions Branches
BirdsEye/camera_fsm.cpp 🟢 222/230 (96.5%) 🟢 20/20 (100.0%) 🟡 126/144 (87.5%)
BirdsEye/crc32.cpp 🟢 30/30 (100.0%) 🟢 4/4 (100.0%) 🟢 24/24 (100.0%)
BirdsEye/crossing_pattern.cpp 🟢 15/15 (100.0%) 🟢 1/1 (100.0%) 🟢 12/12 (100.0%)
BirdsEye/dovex_header.cpp 🟢 100/101 (99.0%) 🟢 6/6 (100.0%) 🔴 61/92 (66.3%)
BirdsEye/filename_validator.cpp 🟢 14/14 (100.0%) 🟢 1/1 (100.0%) 🟢 30/30 (100.0%)
BirdsEye/gps_stats.cpp 🟢 25/25 (100.0%) 🟢 3/3 (100.0%) 🟢 8/8 (100.0%)
BirdsEye/gps_status_page.cpp 🟢 25/25 (100.0%) 🟢 3/3 (100.0%) 🟢 24/24 (100.0%)
BirdsEye/gps_time.cpp 🟢 45/45 (100.0%) 🟢 6/6 (100.0%) 🟢 30/32 (93.8%)
BirdsEye/gps_validation.cpp 🟢 24/24 (100.0%) 🟢 2/2 (100.0%) 🟢 66/66 (100.0%)
BirdsEye/haversine.cpp 🟢 8/8 (100.0%) 🟢 1/1 (100.0%) ⚫ 0/0 (0.0%)
BirdsEye/insta360_protocol.cpp 🟢 140/140 (100.0%) 🟢 16/16 (100.0%) 🟡 86/98 (87.8%)
BirdsEye/lap_format.cpp 🟢 18/18 (100.0%) 🟢 1/1 (100.0%) 🟢 9/9 (100.0%)
BirdsEye/sat_bars.cpp 🟢 33/33 (100.0%) 🟢 2/2 (100.0%) 🟢 51/54 (94.4%)
BirdsEye/sd_access_policy.cpp 🟢 9/9 (100.0%) 🟢 3/3 (100.0%) 🟢 18/18 (100.0%)
BirdsEye/sd_format_page.cpp 🟢 25/25 (100.0%) 🟢 3/3 (100.0%) 🟢 25/26 (96.2%)
BirdsEye/sensoregg_protocol.cpp 🟢 39/40 (97.5%) 🟢 7/7 (100.0%) 🟢 25/26 (96.2%)
BirdsEye/tach_filter.cpp 🟢 15/15 (100.0%) 🟢 3/3 (100.0%) 🟡 7/8 (87.5%)
BirdsEye/wake_cause.cpp 🟢 12/12 (100.0%) 🟢 1/1 (100.0%) 🟢 20/20 (100.0%)

@TheAngryRaven
TheAngryRaven merged commit 265fb06 into master Aug 3, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants