feat: add Time to Sleep user preference setting

Add configurable auto-sleep timeout in Settings with options:
- 1 minute
- 5 minutes
- 10 minutes (default)
- 15 minutes
- 30 minutes

Changes:
- Add SLEEP_TIMEOUT enum and sleepTimeout field to CrossPointSettings
- Add getSleepTimeoutMs() helper method
- Add sleepTimeout to settings serialization
- Add 'Time to Sleep' option in SettingsActivity
- Replace hardcoded AUTO_SLEEP_TIMEOUT_MS with SETTINGS.getSleepTimeoutMs()
This commit is contained in:
ratedcounsel
2025-12-31 08:55:42 +00:00
parent 062d69dc2a
commit 536d85026c
4 changed files with 30 additions and 5 deletions

View File

@@ -45,6 +45,9 @@ class CrossPointSettings {
enum LINE_COMPRESSION { TIGHT = 0, NORMAL = 1, WIDE = 2 };
enum PARAGRAPH_ALIGNMENT { JUSTIFIED = 0, LEFT_ALIGN = 1, CENTER_ALIGN = 2, RIGHT_ALIGN = 3 };
// Auto-sleep timeout options (in minutes)
enum SLEEP_TIMEOUT { SLEEP_1_MIN = 0, SLEEP_5_MIN = 1, SLEEP_10_MIN = 2, SLEEP_15_MIN = 3, SLEEP_30_MIN = 4 };
// Sleep screen settings
uint8_t sleepScreen = DARK;
// Status bar settings
@@ -64,6 +67,8 @@ class CrossPointSettings {
uint8_t fontSize = MEDIUM;
uint8_t lineSpacing = NORMAL;
uint8_t paragraphAlignment = JUSTIFIED;
// Auto-sleep timeout setting (default 10 minutes)
uint8_t sleepTimeout = SLEEP_10_MIN;
~CrossPointSettings() = default;
@@ -77,6 +82,7 @@ class CrossPointSettings {
bool loadFromFile();
float getReaderLineCompression() const;
unsigned long getSleepTimeoutMs() const;
};
// Helper macro to access settings