Skip to content

ISP indicator hardening, host-side unit tests, PR/push CI#27

Merged
mbreiser merged 2 commits into
mreiser/isp-progress-indicatorfrom
isp-indicator-review
Jul 24, 2026
Merged

ISP indicator hardening, host-side unit tests, PR/push CI#27
mbreiser merged 2 commits into
mreiser/isp-progress-indicatorfrom
isp-indicator-review

Conversation

@floesche

Copy link
Copy Markdown
Member

Stacked on #26 (base: mreiser/isp-progress-indicator): review fixes for the visual ISP indicator, plus the repo's first host-side unit tests and PR CI.

Behavior fixes

  • Retire moved out of the reply-critical path. Isp::notify_host_command() is now called after panel_spi_arm_confirmation(), so the one-time LittleFS flash erase (tens of ms, core 1 parked via idleOtherCore()) cannot delay the CIPO confirmation of the command that triggered it. Residual quirk, documented in the code: the erase can still stall the next transaction, so bring-up tooling should send a throwaway display command after an ISP flash before starting a stream.
  • ERROR_DISPLAY (0xC2) no longer retires the smiley flag. Only content commands count; the filter is the shared retires_boot_indicator() predicate.
  • kNominalPages 512 -> 576. A 140 KB image (~547 pages) previously wrapped the bar back to 1 column right before COMMIT; the largest real images now reach 19/20 columns with no wrap.
  • Failed ISP_COMMIT shows a sad smiley (status 8, no reboot follows) instead of leaving the full progress bar, which read as success at a glance.
  • WRITE_PAGE index clamp. Bounds are checked on the 24-bit page index itself; idx * 256 can no longer wrap uint32 and slip past the staging limit.

Tests + CI

  • src/isp_logic.h (new): Arduino-free pure logic (staging constants, bar fill math, retire filter, both face glyphs), shared by isp.cpp, messenger.cpp, and the tests. protocol.h drops its unnecessary <Arduino.h> include so it compiles host-side.
  • test/test_isp_logic/ (new): 14 Unity test cases covering bar monotonicity, full-at-nominal, no-wrap for real image sizes, wrap behavior past nominal, the bounds check (including the wrap-index regression), the retire filter over every opcode, and glyph well-formedness/symmetry. Run with pixi run test (= platformio test -d panel -e native).
  • .github/workflows/ci.yml (new): runs the unit tests and the pixi run release catalog build on every PR and push to main, using the same pixi-locked toolchain as release.yml.
  • Note: the native tests use the system C++ compiler. conda-forge's cxx-compiler bakes the env prefix into its link inputs and breaks on the space in this repo's checkout path ("Generation 6"); documented in pixi.toml.

Validation

  • pixi run test: 14/14 pass.
  • All 10 firmware envs rebuild clean: pixi run release, pixi run diag, plus explicit builds of the four bcmtest/spidiag envs (the diag catalog does not include them).
  • Hardware re-check for flashing single panels and batch of 20 panels worked well

Review fixes on the LAB-44 visual indicator (stacked on #26):

- Retire the boot-indicator flag AFTER arming the CIPO confirmation:
  the one-shot LittleFS erase (tens of ms, core 1 parked) no longer
  delays the triggering command's reply. It can still stall the NEXT
  transaction; after an ISP flash, send a throwaway display command
  before starting a stream.
- Exclude ERROR_DISPLAY (0xC2) from retiring the flag; only content
  commands count (retires_boot_indicator).
- kNominalPages 512 -> 576: real images (up to ~140 KB / ~550 pages)
  now fill the bar near-linearly without wrapping.
- Failed ISP_COMMIT (status 8) shows a sad smiley instead of leaving
  the misleading full progress bar.
- WRITE_PAGE: bounds-check the 24-bit page index itself so a huge
  index cannot wrap the 32-bit offset math past the staging limit.

Testability:

- Extract the pure logic (staging constants, bar math, retire filter,
  glyphs) into Arduino-free src/isp_logic.h, shared by isp.cpp,
  messenger.cpp, and the tests.
- protocol.h no longer includes Arduino.h (stdint/stddef suffice) so
  the tests can compile it host-side.
- New Unity tests (panel/test/test_isp_logic, 14 cases) on the native
  platform via `pixi run test`, using the system C++ compiler
  (conda's cxx-compiler breaks on the space in this repo's path).
- New ci.yml runs the tests + the release catalog build on every PR
  and push to main.

All 10 firmware envs rebuild clean; 14/14 native tests pass.
@floesche
floesche requested a review from Copilot July 21, 2026 15:13
@floesche
floesche changed the base branch from main to mreiser/isp-progress-indicator July 21, 2026 15:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Hardens the panel’s visual ISP programming indicator behavior (progress bar + post-flash smiley), extracts Arduino-free ISP logic for host-side testing, and adds PR/push CI to continuously run those tests and build the firmware catalog.

Changes:

  • Moves boot-indicator “retire” work out of the reply-critical path; adds sad-smiley on failed commit; clamps WRITE_PAGE indices to prevent offset wrap.
  • Adds panel/src/isp_logic.h (pure logic shared by firmware + native unit tests) and introduces host-side Unity tests via PlatformIO native env.
  • Introduces GitHub Actions CI running pixi run test and pixi run release on PRs/pushes.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pixi.toml Adds a pixi run test task to run native PlatformIO unit tests.
pixi.lock Updates lockfile metadata (virtual packages) consistent with new pixi usage.
panel/test/test_isp_logic/test_main.cpp Adds host-side Unity tests covering ISP indicator math, bounds checks, retire filter, and glyph validity.
panel/src/protocol.h Removes Arduino dependency to allow host compilation (tests) while keeping protocol constants available.
panel/src/messenger.cpp Retires the post-flash indicator only after arming the SPI confirmation to avoid delaying the current transaction.
panel/src/main.cpp Calls Isp::boot_indicator_check() once at runtime (loop) so LittleFS ops happen after both cores are active.
panel/src/isp.h Exposes boot-indicator APIs and includes shared isp_logic.h.
panel/src/isp.cpp Implements progress bar + smiley/sad-smiley behavior; adds safe WRITE_PAGE bounds check and host-command retirement logic.
panel/src/isp_logic.h New Arduino-free shared logic/constants for indicator behavior and bounds checking.
panel/platformio.ini Adds a native env for host-side unit tests (Unity).
.github/workflows/ci.yml Adds PR/push CI job running unit tests and catalog build via pixi.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread panel/src/isp_logic.h
Comment thread panel/src/isp_logic.h
@floesche
floesche requested a review from mbreiser July 21, 2026 15:30
@mbreiser
mbreiser merged commit 4ebd07c into mreiser/isp-progress-indicator Jul 24, 2026
1 check 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.

3 participants