Add Inkplate5V2 XKCD Random Webcomic Strip example - #290
Conversation
Display random XKCD comics with on-device PNG scaling on Inkplate 5 V2. Features: auto-refresh every 60s, button skip (GPIO 36), title and alt-text display, robust HTTPS downloads, grayscale 3-bit mode. Requires ArduinoJson library (Arduino IDE Library Manager).
|
Hello @stared, |
|
Hi @JosipKuci, thanks for your kind words! Anyway, since we are on that topic, from my experience as a user, it would be great if it were not nearly as organized by device. I mean, except for some device-dependent demos, most were for as many as supported, with some possible flags or ifs. |
| scalingCtx.offsetY = (targetHeight - scaledHeight) / 2; | ||
| scalingCtx.dither = dither; | ||
| scalingCtx.invert = invert; | ||
| scalingCtx.displayPtr = &display; |
There was a problem hiding this comment.
Nice clean integration! Since scalingCtx.displayPtr holds a global reference to &display, it might be worth resetting or clearing scalingCtx.displayPtr = nullptr at the end of drawScaledPngFromBuffer (or on early return error paths) just to prevent stale pointer references if the function exits early.
I created it 6 months ago - rediscovered that. And sharing here, so you can use that as well.
Features
Files added
examples/Inkplate5V2/Projects/Inkplate5V2_XKCD_Random_Webcomic_Strip/credentials.template.h- WiFi credential template (actualcredentials.his gitignored)pngle_scaling.h/pngle_scaling.cpp- on-device PNG scaling using pngle libraryDependencies