From 818641522682120bd3b7501c6f285f39e197270e Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 10 Nov 2026 09:48:01 +0700 Subject: [PATCH] hf waveshare load: fix 2.7" height and partial last byte packing The 2.7" panel is 176x264: the send loop pushes 48 x 121 = 5808 bytes, so with 276 rows the bottom 12 rows of the image were silently dropped. map8to1() stored a partial last byte before the final shift, leaving its pixels right-aligned. On the 122 px wide 2.13" the last two columns were drawn at off-panel columns 126/127. MSB-align the partial byte instead. Byte-aligned widths are unchanged. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + client/src/cmdhfwaveshare.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b20b69888..abe7c55b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Fixed `hf waveshare load` - 2.7" height is 264, and last pixels of non byte-aligned rows (2.13") were misplaced (@iceman1001) - Preserve jobserver in Makefile builds to fix ProxSpace build speeds (@tpglitch) - Added `hf gp info`, `hf gp crs` and `hf gp aids` - read GlobalPlatform card info, list CRS registered applets and find applet AIDs, all without keys (@iceman1001) - Added GlobalPlatform ISD, CRS, ARA-M, telecom, UnionPay and digital key AIDs to `aidlist.json` (@iceman1001) diff --git a/client/src/cmdhfwaveshare.c b/client/src/cmdhfwaveshare.c index 7dd216e43..c57dec8c7 100644 --- a/client/src/cmdhfwaveshare.c +++ b/client/src/cmdhfwaveshare.c @@ -74,7 +74,7 @@ static model_t models[] = { {"2.9 inch e-paper", 16, 296, 128}, {"4.2 inch e-paper", 100, 400, 300}, // tested {"7.5 inch e-paper", 120, 800, 480}, - {"2.7 inch e-paper", 121, 176, 276}, // tested + {"2.7 inch e-paper", 121, 176, 264}, // tested {"2.13 inch e-paper B (with red)", 106, 104, 212}, // tested {"1.54 inch e-paper B (with red)", 100, 200, 200}, // tested {"7.5 inch e-paper HD", 120, 880, 528}, @@ -100,6 +100,8 @@ static uint8_t *map8to1(gdImagePtr img, int color) { } count += 1; if ((count >= 8) || (X == gdImageSX(img) - 1)) { + // MSB-align a partial last byte + data = (data << (8 - count)) & 0xFF; colormap8[X / 8 + Y * width8] = (~data) & 0xFF; count = 0; data = 0;