From 7168c46deca6a647aa4e2dadc2cb6f308a92c37c Mon Sep 17 00:00:00 2001 From: jpirnay Date: Tue, 7 Apr 2026 23:28:51 +0200 Subject: [PATCH] Minor fixes --- lib/Epub/Epub/converters/PngToFramebufferConverter.cpp | 2 ++ src/activities/boot_sleep/SleepActivity.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Epub/Epub/converters/PngToFramebufferConverter.cpp b/lib/Epub/Epub/converters/PngToFramebufferConverter.cpp index 641e91d0..a580b58c 100644 --- a/lib/Epub/Epub/converters/PngToFramebufferConverter.cpp +++ b/lib/Epub/Epub/converters/PngToFramebufferConverter.cpp @@ -502,6 +502,8 @@ bool PngToFramebufferConverter::decodeToFramebuffer(const std::string& imagePath // the 2-bit cache file format, but caching is disabled in this path // (BmpViewerActivity passes an empty cachePath). ctx.renderModeIsBW = (renderer.getRenderMode() == GfxRenderer::BW); + LOG_DBG("PNG", "Render mode at decode: %d (BW=%d) -> 1bit dither=%d", (int)renderer.getRenderMode(), + (int)GfxRenderer::BW, ctx.renderModeIsBW ? 1 : 0); if (ctx.renderModeIsBW) { ctx.atkinson1BitDitherer = new (std::nothrow) Atkinson1BitDitherer(ctx.dstWidth); if (!ctx.atkinson1BitDitherer) { diff --git a/src/activities/boot_sleep/SleepActivity.cpp b/src/activities/boot_sleep/SleepActivity.cpp index f1ee331d..a49e1f44 100644 --- a/src/activities/boot_sleep/SleepActivity.cpp +++ b/src/activities/boot_sleep/SleepActivity.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -22,6 +23,7 @@ #include "fontIds.h" #include "images/Logo120.h" + namespace { // Context passed through PNGdec's decode() user-pointer to the per-scanline draw callback. @@ -216,9 +218,9 @@ size_t pickSleepImageIndex(size_t numFiles) { if (last == SIZE_MAX || last >= numFiles) return 0; return (last + 1) % numFiles; } - size_t idx = random(numFiles); + size_t idx = static_cast(esp_random() % numFiles); while (numFiles > 1 && APP_STATE.lastSleepImage != SIZE_MAX && idx == APP_STATE.lastSleepImage) { - idx = random(numFiles); + idx = static_cast(esp_random() % numFiles); } return idx; }