Rework SSD1677 4-gray refresh into per-mode single-activation waveforms - #231
Merged
Conversation
Panel_SSD1677_4Gray now dispatches quality/text/fast to a shared absolute refresh path (Mode 2 face-parity recovery, parity-aware full-frame transfer, one Mode 1 activation) whose only per-mode difference is a static LUT, and fastest to a differential monochrome update with a static LUT and software-computed transition groups. - quality: oscillation prefix erases image history with a group-balanced net drive, preventing ghost accumulation over repeated refreshes; the tone-forming tail runs twice so the endpoints stay as stable as the vendor waveform ones - text: white-first waveform, forms the four levels without a black flash - fast: absolute 4-gray waveform derived from the community SDK, with the black darken return shortened to 28 frames (the excess overdrive rebounds toward gray during later undriven holds) - fastest: 2-frame reverse-polarity prepulse plus 8-frame dose with state-aware holds outside the updated region; VCOM matches the panel offset so held pixels sit field-free - absolute refreshes wait on the BUSY line without the 400 ms refresh-minimum floor - the fastest fallback now records its display baseline, so a fastest-only usage no longer degrades into a full refresh on every update
lgfx_qoi.c unconditionally defined QOI_DEBUG, so error paths always called fprintf(stderr). This pulls in newlib stdio and can fail to link on cores that do not provide the _write syscall. The png/jpg decoders reference no stdio; this aligns qoi with them. Define QOI_DEBUG externally to re-enable the debug output.
The loop counter was int while count is uint_fast8_t. On ARM cores uint_fast8_t is unsigned int, so the comparison triggers -Wsign-compare (on xtensa/riscv it is unsigned char, promoted to int, which is why ESP32 builds never warned). Harmless at runtime; use the same type as count.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rework the SSD1677 4-gray refresh so that quality / text / fast dispatch to a shared absolute refresh path (Mode 2 face-parity recovery, parity-aware full-frame transfer, one Mode 1 activation) whose only per-mode difference is a static LUT, while fastest stays a differential monochrome update with a static LUT and software-computed transition groups.
Two small library fixes ride along:
QOI_DEBUGopt-in:lgfx_qoi.cunconditionally defined it, so error paths always calledfprintf(stderr), pulling newlib stdio into every build; the png/jpg decoders reference no stdio, and this aligns qoi with them (defineQOI_DEBUGexternally to restore the output)-Wsign-comparewarning inTouch_CST226::getTouchRaw(): the loop counter wasintwhilecountisuint_fast8_t, which warns on architectures whereuint_fast8_tisunsigned intHardware validation
Waveform tuning and regression tests were run on an M5PaperMono SSD1677 panel. The quality / fast / fastest waveforms in this PR are the settled versions from that work (fast full refresh measures ~341 ms with the vendor-derived LUT; fastest keeps untouched black/gray/white pixels stable across repeated dirty-rect updates). The text waveform keeps the white-first structure; its group balance is inherently uneven, which is a known power-off ghosting trade-off of that structure.
Checks
ssd1677_lut_balance.py) for the static LUTsgit diff --check