This commit is contained in:
Yaroslav 2026-01-27 21:26:21 +11:00 committed by GitHub
commit e43f71ee57
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 31 additions and 7 deletions

View File

@ -41,8 +41,10 @@ Button layout can be customized in **[Settings](#35-settings)**.
### Power On / Off ### Power On / Off
To turn the device on or off, **press and hold the Power button for approximately half a second**. To turn the device on or off, **press and hold the Power button for approximately half a second.**.
In **[Settings](#35-settings)** you can configure the power button to turn the device off with a short press instead of a long one. In **[Settings](#35-settings)** you can adjust the hold duration and turn the device off with a short press instead of a long one.
If the **Short Power Button Click** setting is set to "Sleep", a short press powers the device off and the hold duration setting is ignored.
To reboot the device (for example if it's frozen, or after a firmware update), press and release the Reset button, and then quickly press and hold the Power button for a few seconds. To reboot the device (for example if it's frozen, or after a firmware update), press and release the Reset button, and then quickly press and hold the Power button for a few seconds.
@ -107,6 +109,7 @@ The Settings screen allows you to configure the device's behavior. There are a f
- "Ignore" - Require a long press to turn off the device - "Ignore" - Require a long press to turn off the device
- "Sleep" - A short press powers the device off - "Sleep" - A short press powers the device off
- "Page Turn" - A short press in reading mode turns to the next page; a long press turns the device off - "Page Turn" - A short press in reading mode turns to the next page; a long press turns the device off
- **Power Button Hold Duration**: Controls how long the Power button must be held to turn off the device when short click is not set to Sleep.
- **Reading Orientation**: Set the screen orientation for reading EPUB files: - **Reading Orientation**: Set the screen orientation for reading EPUB files:
- "Portrait" (default) - Standard portrait orientation - "Portrait" (default) - Standard portrait orientation
- "Landscape CW" - Landscape, rotated clockwise - "Landscape CW" - Landscape, rotated clockwise

View File

@ -14,7 +14,7 @@ CrossPointSettings CrossPointSettings::instance;
namespace { namespace {
constexpr uint8_t SETTINGS_FILE_VERSION = 1; constexpr uint8_t SETTINGS_FILE_VERSION = 1;
// Increment this when adding new persisted settings fields // Increment this when adding new persisted settings fields
constexpr uint8_t SETTINGS_COUNT = 20; constexpr uint8_t SETTINGS_COUNT = 21;
constexpr char SETTINGS_FILE[] = "/.crosspoint/settings.bin"; constexpr char SETTINGS_FILE[] = "/.crosspoint/settings.bin";
} // namespace } // namespace
@ -32,6 +32,7 @@ bool CrossPointSettings::saveToFile() const {
serialization::writePod(outputFile, sleepScreen); serialization::writePod(outputFile, sleepScreen);
serialization::writePod(outputFile, extraParagraphSpacing); serialization::writePod(outputFile, extraParagraphSpacing);
serialization::writePod(outputFile, shortPwrBtn); serialization::writePod(outputFile, shortPwrBtn);
serialization::writePod(outputFile, powerButtonHoldDuration);
serialization::writePod(outputFile, statusBar); serialization::writePod(outputFile, statusBar);
serialization::writePod(outputFile, orientation); serialization::writePod(outputFile, orientation);
serialization::writePod(outputFile, frontButtonLayout); serialization::writePod(outputFile, frontButtonLayout);
@ -81,6 +82,8 @@ bool CrossPointSettings::loadFromFile() {
if (++settingsRead >= fileSettingsCount) break; if (++settingsRead >= fileSettingsCount) break;
serialization::readPod(inputFile, shortPwrBtn); serialization::readPod(inputFile, shortPwrBtn);
if (++settingsRead >= fileSettingsCount) break; if (++settingsRead >= fileSettingsCount) break;
serialization::readPod(inputFile, powerButtonHoldDuration);
if (++settingsRead >= fileSettingsCount) break;
serialization::readPod(inputFile, statusBar); serialization::readPod(inputFile, statusBar);
if (++settingsRead >= fileSettingsCount) break; if (++settingsRead >= fileSettingsCount) break;
serialization::readPod(inputFile, orientation); serialization::readPod(inputFile, orientation);

View File

@ -60,6 +60,9 @@ class CrossPointSettings {
// Short power button press actions // Short power button press actions
enum SHORT_PWRBTN { IGNORE = 0, SLEEP = 1, PAGE_TURN = 2 }; enum SHORT_PWRBTN { IGNORE = 0, SLEEP = 1, PAGE_TURN = 2 };
// Power button hold duration options
enum POWER_BTN_HOLD_DURATION { PB_FAST = 0, PB_NORMAL = 1, PB_SLOW = 2 };
// Hide battery percentage // Hide battery percentage
enum HIDE_BATTERY_PERCENTAGE { HIDE_NEVER = 0, HIDE_READER = 1, HIDE_ALWAYS = 2 }; enum HIDE_BATTERY_PERCENTAGE { HIDE_NEVER = 0, HIDE_READER = 1, HIDE_ALWAYS = 2 };
@ -74,6 +77,8 @@ class CrossPointSettings {
uint8_t textAntiAliasing = 1; uint8_t textAntiAliasing = 1;
// Short power button click behaviour // Short power button click behaviour
uint8_t shortPwrBtn = IGNORE; uint8_t shortPwrBtn = IGNORE;
// Power button hold duration
uint8_t powerButtonHoldDuration = PB_FAST;
// EPUB reading orientation settings // EPUB reading orientation settings
// 0 = portrait (default), 1 = landscape clockwise, 2 = inverted, 3 = landscape counter-clockwise // 0 = portrait (default), 1 = landscape clockwise, 2 = inverted, 3 = landscape counter-clockwise
uint8_t orientation = PORTRAIT; uint8_t orientation = PORTRAIT;
@ -106,7 +111,19 @@ class CrossPointSettings {
static CrossPointSettings& getInstance() { return instance; } static CrossPointSettings& getInstance() { return instance; }
uint16_t getPowerButtonDuration() const { uint16_t getPowerButtonDuration() const {
return (shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::SLEEP) ? 10 : 400; if (shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::SLEEP) {
return 10;
} else {
switch (powerButtonHoldDuration) {
case POWER_BTN_HOLD_DURATION::PB_FAST:
default:
return 500;
case POWER_BTN_HOLD_DURATION::PB_NORMAL:
return 1000;
case POWER_BTN_HOLD_DURATION::PB_SLOW:
return 2000;
}
}
} }
int getReaderFontId() const; int getReaderFontId() const;

View File

@ -35,7 +35,7 @@ const SettingInfo readerSettings[readerSettingsCount] = {
SettingInfo::Toggle("Extra Paragraph Spacing", &CrossPointSettings::extraParagraphSpacing), SettingInfo::Toggle("Extra Paragraph Spacing", &CrossPointSettings::extraParagraphSpacing),
SettingInfo::Toggle("Text Anti-Aliasing", &CrossPointSettings::textAntiAliasing)}; SettingInfo::Toggle("Text Anti-Aliasing", &CrossPointSettings::textAntiAliasing)};
constexpr int controlsSettingsCount = 4; constexpr int controlsSettingsCount = 5;
const SettingInfo controlsSettings[controlsSettingsCount] = { const SettingInfo controlsSettings[controlsSettingsCount] = {
SettingInfo::Enum( SettingInfo::Enum(
"Front Button Layout", &CrossPointSettings::frontButtonLayout, "Front Button Layout", &CrossPointSettings::frontButtonLayout,
@ -43,8 +43,9 @@ const SettingInfo controlsSettings[controlsSettingsCount] = {
SettingInfo::Enum("Side Button Layout (reader)", &CrossPointSettings::sideButtonLayout, SettingInfo::Enum("Side Button Layout (reader)", &CrossPointSettings::sideButtonLayout,
{"Prev, Next", "Next, Prev"}), {"Prev, Next", "Next, Prev"}),
SettingInfo::Toggle("Long-press Chapter Skip", &CrossPointSettings::longPressChapterSkip), SettingInfo::Toggle("Long-press Chapter Skip", &CrossPointSettings::longPressChapterSkip),
SettingInfo::Enum("Short Power Button Click", &CrossPointSettings::shortPwrBtn, {"Ignore", "Sleep", "Page Turn"})}; SettingInfo::Enum("Short Power Button Click", &CrossPointSettings::shortPwrBtn, {"Ignore", "Sleep", "Page Turn"}),
SettingInfo::Enum("Power Button Hold Duration", &CrossPointSettings::powerButtonHoldDuration,
{"0.5s", "1s", "2s"})};
constexpr int systemSettingsCount = 5; constexpr int systemSettingsCount = 5;
const SettingInfo systemSettings[systemSettingsCount] = { const SettingInfo systemSettings[systemSettingsCount] = {
SettingInfo::Enum("Time to Sleep", &CrossPointSettings::sleepTimeout, SettingInfo::Enum("Time to Sleep", &CrossPointSettings::sleepTimeout,