Repository navigation
Conversation
The display reads 249 data bytes from each 250-byte packet and treats the last byte as a separator; the "ef69" terminator belongs to that data stream. _generate_update_image chunked only the raw pixel records (and only when longer than 250 bytes) and appended the terminator afterwards, so updates whose length fell on certain residues (raw lengths 248/249 mod 249, and 248-250 unchunked) lost the terminator: the status reply was swallowed or the display answered needReSend:1 to every later update. Chunk the records and the terminator together. Also restart the render count at 0 after every full frame (the display expects that) and keep the count increment inside the update mutex. Claude-Session: https://claude.ai/code/session_015HUJhXMdZg27SVrwtSV3Dv
Run the real LcdCommRevC._generate_update_image over many raw lengths (including those that used to break: 248, 249, 250, 497, 498, 1992 and ~227 KB), for 2.1", 5" and 8" sub-revisions, with a model of the display packet parsing; check the render count restarts at 0 after a full frame. Claude-Session: https://claude.ai/code/session_015HUJhXMdZg27SVrwtSV3Dv
This branch has not been deployed
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
Fixes rev C partial updates (
UPDATE_BITMAP) that leave the display stuck: after one bad update, the screen keeps showing the last good image and ignores every later partial update.The display reads 249 data bytes from each 250-byte packet and treats the last byte as a separator. The
ef69terminator belongs to that data stream._generate_update_imagechunked only the pixel records (and only when they were longer than 250 bytes), then appendedef69after chunking. For some payload lengths the terminator therefore landed on or across a separator slot:> 250thresholdWhen that happens, the
QUERY_STATUSreply is swallowed, or the display answersneedReSend:1|renderCnt:0to every later update.needReSend:1is sticky and only a full frame clears it. With themes that update often, this eventually happens in normal use, which matches reports of a frozen screen.Changes
library/lcd/lcd_comm_rev_c.pyb"\x00".join(chunked(raw + b"\xef\x69", 249)). This is the same framing_generate_full_imagealready uses.Count.Startto 0 after each full frame (the display restarts its expected count there), and increment it insideupdate_queue_mutex.tests/library/lcd/test_lcd_comm_rev_c_update_framing.py(new, unittest)_generate_update_imageover many raw lengths, including every bad residue up to about 2 KB and a ~227 KB update. It covers the 2.1", 5" and 8" sub-revisions against a model of the display's packet parsing.Testing
On a device: Turing 2.1" rev C, ROM 89, Linux.
needReSend:1exactly when the length residue hit 248 or 0.DisplayPILImage(including the bad lengths, with a full frame in the middle) all returnedneedReSend:0.main.pywith theme 26 ran normally.Note on existing tests
tests/library/lcd/test_lcd_comm_rev_c.pyalready errors onmain, becauseMockedLcdCommRevCdoesn't setsub_revisionorrom_version. I left that harness and its goldens untouched. Once someone repairs it, therev_c_display_pil_image_patch_*goldens will change only if their payload length falls in one of the broken classes above. The new test file has a working harness that could be reused.The root cause was found while experimenting with the protocol details discussed in #348; credit to @gwendal-h for first spotting the
ef69/needReSendsymptom there.https://claude.ai/code/session_015HUJhXMdZg27SVrwtSV3Dv