Merge branch 'feat-page-overlay' of https://github.com/jpirnay/crosspoint-reader into mybuild

This commit is contained in:
jpirnay
2026-03-19 17:25:57 +01:00
+13 -3
View File
@@ -727,11 +727,21 @@ void SleepActivity::renderOverlaySleepScreen() const {
return rc == PNG_SUCCESS;
};
// Try /sleep/ directory first (random selection, same as renderCustomSleepScreen).
// Try /.sleep/ (preferred) or /sleep/ directory (random selection, same as renderCustomSleepScreen).
// Accepts both .bmp and .png files; .bmp headers are validated during the scan.
bool overlayDrawn = false;
auto dir = Storage.open("/sleep");
const char* sleepDir = nullptr;
auto dir = Storage.open("/.sleep");
if (dir && dir.isDirectory()) {
sleepDir = "/.sleep";
} else {
if (dir) dir.close();
dir = Storage.open("/sleep");
if (dir && dir.isDirectory()) {
sleepDir = "/sleep";
}
}
if (sleepDir) {
std::vector<std::string> files;
char name[500];
for (auto file = dir.openNextFile(); file; file = dir.openNextFile()) {
@@ -769,7 +779,7 @@ void SleepActivity::renderOverlaySleepScreen() const {
}
APP_STATE.lastSleepImage = randomFileIndex;
APP_STATE.saveToFile();
const std::string selected = "/sleep/" + files[randomFileIndex];
const std::string selected = std::string(sleepDir) + "/" + files[randomFileIndex];
if (FsHelpers::checkFileExtension(selected, ".png")) {
overlayDrawn = tryDrawPngOverlay(selected);
} else {