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 <noreply@anthropic.com>
This commit is contained in:
iceman1001andClaude Opus 5.5 committed 2026-11-10 09:48:01 +07:00
1 parent 199cd05327
commit 8186415226
2 files changed
+4 -1

No files matched your search

+1
View File
@@ -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)
+3 -1
View File
@@ -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;