Skip to content

feat: Prefer ".sleep" over "sleep" for custom image directory#948

Merged
jonasdiemer merged 3 commits intocrosspoint-reader:masterfrom
jpirnay:feat-sleep
Mar 2, 2026
Merged

feat: Prefer ".sleep" over "sleep" for custom image directory#948
jonasdiemer merged 3 commits intocrosspoint-reader:masterfrom
jpirnay:feat-sleep

Conversation

@jpirnay
Copy link
Contributor

@jpirnay jpirnay commented Feb 17, 2026

Summary

  • Custom sleep screen images now load from /.sleep directory (preferred), falling back to /sleep for backwards compatibility. The dot-prefix keeps the directory hidden from the file browser.
  • Rewrote User Guide section 3.6 to document all six sleep screen modes, cover settings, and the updated custom image setup.

Additional Context

  • The sleep directoy entry while browsing files was distracting.

AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

No actionable comments were generated in the recent review. 🎉

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a8d030a and 168da93.

📒 Files selected for processing (1)
  • USER_GUIDE.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • USER_GUIDE.md

📝 Walkthrough

Walkthrough

Sleep Screen documentation was expanded with mode, cover, and custom-image guidance. Code now prefers /.sleep over /sleep when locating sleep images, stores the resolved path in sleepDir, and uses it for BMP path construction and logging; custom-image logic only runs if a valid sleep directory is found.

Changes

Cohort / File(s) Summary
Documentation
USER_GUIDE.md
Rewrote Sleep Screen section: added Mode table (Dark, Light, Custom, Cover, Cover + Custom, None), Sleep Screen Cover settings (modes and filters), Custom images instructions (SD card placement, multiple-image .sleep behavior, single-image fallback), tips on formatting and BMP/color guidance.
Sleep image lookup & loading
src/activities/boot_sleep/SleepActivity.cpp
Changed directory lookup to prefer /.sleep with fallback to /sleep; introduced sleepDir to hold the chosen directory; updated BMP file path construction and log messages to use sleepDir; guard custom-image logic on existence of sleepDir; preserved existing BMP fallback behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: preferring the '.sleep' directory over 'sleep' for custom image storage, which is the central code modification.
Description check ✅ Passed The description is directly related to the changeset, covering both the code change (directory preference with fallback) and documentation update (User Guide rewrite), with clear rationale for the change.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
USER_GUIDE.md (1)

188-189: Consider clarifying the fallback behavior.

Line 189 states sleep.bmp is "only used if no .sleep directory is found," but the code also falls back to sleep.bmp when the directory exists but contains no valid BMP files (or if loading fails). Consider rewording to:

Single Image: Place a file named sleep.bmp in the root directory. This is used as a fallback if no valid images are found in the sleep directory.

This is a minor point—the current wording is acceptable for most users.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@USER_GUIDE.md` around lines 188 - 189, Update the USER_GUIDE.md wording for
the "Single Image" case to clarify fallback behavior: change the sentence that
reads "This is only used if no `.sleep` directory is found" to indicate that
`sleep.bmp` is used as a fallback when no valid BMP images are found in the
`.sleep` directory (including when the directory exists but is empty or loading
fails), referencing the `.sleep` directory and `sleep.bmp` terms so it's easy to
locate and replace the line.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97c3314 and 4c2274a.

📒 Files selected for processing (2)
  • USER_GUIDE.md
  • src/activities/boot_sleep/SleepActivity.cpp
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: cppcheck
🔇 Additional comments (3)
src/activities/boot_sleep/SleepActivity.cpp (2)

35-48: LGTM! Directory lookup logic is well-structured.

The two-phase lookup correctly prefers /.sleep over /sleep, handles all resource cleanup paths properly (closing the first handle before opening the second, and ensuring cleanup at line 102 for non-successful paths), and only proceeds with file iteration when a valid directory is found.


88-91: LGTM!

Path construction and logging correctly use the resolved sleepDir variable, making it clear which directory the image was loaded from during debugging.

USER_GUIDE.md (1)

166-175: LGTM! Comprehensive mode table.

The mode table clearly documents all six sleep screen options with their fallback behaviors, which accurately reflects the code implementation.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@USER_GUIDE.md`:
- Around line 188-189: Update the USER_GUIDE.md wording for the "Single Image"
case to clarify fallback behavior: change the sentence that reads "This is only
used if no `.sleep` directory is found" to indicate that `sleep.bmp` is used as
a fallback when no valid BMP images are found in the `.sleep` directory
(including when the directory exists but is empty or loading fails), referencing
the `.sleep` directory and `sleep.bmp` terms so it's easy to locate and replace
the line.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c2274a and a8d030a.

📒 Files selected for processing (1)
  • USER_GUIDE.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: cppcheck
  • GitHub Check: build
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@USER_GUIDE.md`:
- Around line 181-182: The doc uses two different labels for the same filter:
"Inverted Contrast" in the Sleep Screen Cover Filter list and "Inverted" in the
Settings section; pick one label and make it consistent across the guide by
updating the Sleep Screen Cover Filter entry (or the Settings entry) so both use
the same exact option name ("Inverted" or "Inverted Contrast") and verify any
other occurrences of "Inverted" or "Inverted Contrast" (e.g., the "Sleep Screen
Cover Filter" heading and the Settings list) are identical.

@Levrk
Copy link
Contributor

Levrk commented Feb 17, 2026

conflicts with #887 which allows for images to be viewed from the file browser

@osteotek
Copy link
Member

osteotek commented Feb 17, 2026

If we merge this I assure you there will be feedback from users who preferred it the old way 😄

@jpirnay
Copy link
Contributor Author

jpirnay commented Feb 17, 2026

If we merge this I assure you there will be feedback from users who preferred it the old way 😄

That's the reason I made it backward compatible, it will read the old directory

@elvisgastelum
Copy link

If we merge this in, I suggest adding a way to show/hide hidden folders and files directly from the file manager from hotspot/network (in a quick or convenient way). I currently use this file manager to activate and deactivate sleep covers quickly, without having to remove the SD card and use a computer to move the files.

My current workflow is:

To activate a sleep cover, I move it from a custom folder called sleep-archive to the sleep folder.

To deactivate a sleep cover, I move it from the sleep folder back to sleep-archive.

I know I’m probably the only one doing this, but if we can toggle hidden folders/files on and off, I’ll still be able to manage my sleep covers on the go, without needing to remove the SD card from the Xteink.

This probably help more users in the future to be more comfortable with the system

@osteotek
Copy link
Member

@elvisgastelum sleep folder can still be used for images, and you your workflow should not change. @jpirnay correct me if I'm wrong

@elvisgastelum
Copy link

@elvisgastelum sleep folder can still be used for images, and you your workflow should not change. @jpirnay correct me if I'm wrong

Yeah i understood, i just suggest that feature because I would like to migrate to a dot folder instead of sleep, i see the .sleep pretty useful when im looking for the books in the internal file explorer and I don’t want to see any other noisy files or folders

@jpirnay
Copy link
Contributor Author

jpirnay commented Feb 18, 2026

@elvisgastelum sleep folder can still be used for images, and you your workflow should not change. @jpirnay correct me if I'm wrong

// Check if we have a /.sleep (preferred) or /sleep directory
  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";
    }
  }

Will support both directory structures

@osteotek osteotek requested a review from a team February 20, 2026 18:42
@mrtnvgr
Copy link
Contributor

mrtnvgr commented Feb 22, 2026

If .sleep is valid, it's logical that .sleep.bmp should also be :)

@mrtnvgr
Copy link
Contributor

mrtnvgr commented Feb 27, 2026

Does this have any blockers?

Comment on lines +35 to +46
// Check if we have a /.sleep (preferred) or /sleep directory
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";
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small thought to reduce repetition here:

Suggested change
// Check if we have a /.sleep (preferred) or /sleep directory
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";
}
}
// Check if we have a /.sleep (preferred) or /sleep directory
static constexpr const char* kSleepDirs[] = {"/.sleep", "/sleep"};
const char* sleepDir = nullptr;
FsFile dir;
for (const auto* candidate : kSleepDirs) {
dir = Storage.open(candidate);
if (dir && dir.isDirectory()) {
sleepDir = candidate;
break;
}
if (dir) dir.close();
}

@jonasdiemer jonasdiemer merged commit ef02737 into crosspoint-reader:master Mar 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants