Skip to content

support grayscale (including strip rendering) in simulator#19

Open
rmmh wants to merge 1 commit into
crosspoint-reader:mainfrom
rmmh:sim-strip-grayscale-preview
Open

support grayscale (including strip rendering) in simulator#19
rmmh wants to merge 1 commit into
crosspoint-reader:mainfrom
rmmh:sim-strip-grayscale-preview

Conversation

@rmmh

@rmmh rmmh commented Jun 30, 2026

Copy link
Copy Markdown

This greatly improves fidelity, both graphically and for OOM testing.

before/after
image

This greatly improves fidelity, both graphically and for OOM testing.
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 87d85579-0ef9-4ea3-8e74-32b6bdb8da92

📥 Commits

Reviewing files that changed from the base of the PR and between 23988a2 and d4df89f.

📒 Files selected for processing (2)
  • src/HalDisplay.cpp
  • src/HalDisplay.h
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (4)
src/Hal*.{cpp,h}

📄 CodeRabbit inference engine (CLAUDE.md)

When the firmware adds a new method to a HAL class, add a matching stub to the corresponding Hal*.cpp/.h file in the simulator to keep the same public surface or the firmware will not link

Files:

  • src/HalDisplay.h
  • src/HalDisplay.cpp
src/**/*.{cpp,h}

📄 CodeRabbit inference engine (CLAUDE.md)

Do not call SDL render functions from anywhere except presentIfNeeded in simulator_main on the main thread; keep all SDL calls on the main thread (required for macOS compatibility)

Files:

  • src/HalDisplay.h
  • src/HalDisplay.cpp
src/*.h

📄 CodeRabbit inference engine (CLAUDE.md)

When adding a new Arduino/ESP-IDF symbol, add the minimum stub to the corresponding header in src/ matching the upstream signature and returning a sensible default

Files:

  • src/HalDisplay.h
src/HalDisplay.cpp

📄 CodeRabbit inference engine (CLAUDE.md)

src/HalDisplay.cpp: When changing orientation rotation logic, update both the firmware renderer (90 CCW rotation for Portrait) and the simulator's SDL_RenderCopyEx undoing logic with matching dst rect and centre-offset calculations
Set SDL_HINT_RENDER_SCALE_QUALITY=1 before SDL_CreateTexture, plus use SDL_WINDOW_ALLOW_HIGHDPI and SDL_RenderSetLogicalSize to prevent Bayer-dithered grays from rendering as harsh black/white stripes on Retina displays

Files:

  • src/HalDisplay.cpp
🔇 Additional comments (3)
src/HalDisplay.h (1)

70-75: LGTM!

src/HalDisplay.cpp (2)

54-57: 🎯 Functional Correctness

No stride mismatch here. DISPLAY_WIDTH is 792/800, so each scanline is byte-aligned and getBit() uses the same row layout as the strip writes.

			> Likely an incorrect or invalid review comment.

351-353: 🎯 Functional Correctness

No action needed for displayGrayBuffer()
It intentionally composes from grayscalePreviewState; the grayscale buffer is captured earlier through the copy/strip helpers.


📝 Walkthrough

Walkthrough

Adds a GrayscalePreviewState in HalDisplay.cpp holding base/LSB/MSB plane buffers with validity flags, plus compositor helpers. refreshDisplay now snapshots the BW framebuffer through these helpers. Grayscale HAL methods are implemented to feed and compose the preview; supportsStripGrayscale() now returns true.

Changes

Grayscale Preview Pipeline

Layer / File(s) Summary
GrayscalePreviewState and compositor helpers
src/HalDisplay.cpp
Adds #include <array>, defines anonymous-namespace GrayscalePreviewState with base/LSB/MSB buffers and validity flags, and implements argbGray, getBit, renderBwPixels, plane snapshot/clear/copy, and composeGrayscalePreview.
HalDisplay method wiring and refreshDisplay integration
src/HalDisplay.cpp, src/HalDisplay.h
refreshDisplay replaces the inline pixel loop with a base snapshot and renderBwPixels call. displayGrayBuffer, writeGrayscalePlaneStrip, and supportsStripGrayscale are implemented to feed and compose the preview state. Header comment updated to document intentional strip support.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding grayscale and strip rendering support in the simulator.
Description check ✅ Passed The description is related to the changeset and accurately frames the grayscale fidelity and OOM-testing improvements.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Warning

⚠️ This pull request shows signs of AI-generated slop (phantom_api). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

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.

1 participant