mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 22:57:50 +03:00
Merge 1aa6f6c203 into 13f0ebed96
This commit is contained in:
commit
e43f71ee57
@ -41,8 +41,10 @@ Button layout can be customized in **[Settings](#35-settings)**.
|
||||
|
||||
### Power On / Off
|
||||
|
||||
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.
|
||||
To turn the device on or off, **press and hold the Power button for approximately half a second.**.
|
||||
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.
|
||||
|
||||
@ -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
|
||||
- "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
|
||||
- **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:
|
||||
- "Portrait" (default) - Standard portrait orientation
|
||||
- "Landscape CW" - Landscape, rotated clockwise
|
||||
|
||||
@ -14,7 +14,7 @@ CrossPointSettings CrossPointSettings::instance;
|
||||
namespace {
|
||||
constexpr uint8_t SETTINGS_FILE_VERSION = 1;
|
||||
// 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";
|
||||
} // namespace
|
||||
|
||||
@ -32,6 +32,7 @@ bool CrossPointSettings::saveToFile() const {
|
||||
serialization::writePod(outputFile, sleepScreen);
|
||||
serialization::writePod(outputFile, extraParagraphSpacing);
|
||||
serialization::writePod(outputFile, shortPwrBtn);
|
||||
serialization::writePod(outputFile, powerButtonHoldDuration);
|
||||
serialization::writePod(outputFile, statusBar);
|
||||
serialization::writePod(outputFile, orientation);
|
||||
serialization::writePod(outputFile, frontButtonLayout);
|
||||
@ -81,6 +82,8 @@ bool CrossPointSettings::loadFromFile() {
|
||||
if (++settingsRead >= fileSettingsCount) break;
|
||||
serialization::readPod(inputFile, shortPwrBtn);
|
||||
if (++settingsRead >= fileSettingsCount) break;
|
||||
serialization::readPod(inputFile, powerButtonHoldDuration);
|
||||
if (++settingsRead >= fileSettingsCount) break;
|
||||
serialization::readPod(inputFile, statusBar);
|
||||
if (++settingsRead >= fileSettingsCount) break;
|
||||
serialization::readPod(inputFile, orientation);
|
||||
|
||||
@ -60,6 +60,9 @@ class CrossPointSettings {
|
||||
// Short power button press actions
|
||||
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
|
||||
enum HIDE_BATTERY_PERCENTAGE { HIDE_NEVER = 0, HIDE_READER = 1, HIDE_ALWAYS = 2 };
|
||||
|
||||
@ -74,6 +77,8 @@ class CrossPointSettings {
|
||||
uint8_t textAntiAliasing = 1;
|
||||
// Short power button click behaviour
|
||||
uint8_t shortPwrBtn = IGNORE;
|
||||
// Power button hold duration
|
||||
uint8_t powerButtonHoldDuration = PB_FAST;
|
||||
// EPUB reading orientation settings
|
||||
// 0 = portrait (default), 1 = landscape clockwise, 2 = inverted, 3 = landscape counter-clockwise
|
||||
uint8_t orientation = PORTRAIT;
|
||||
@ -106,7 +111,19 @@ class CrossPointSettings {
|
||||
static CrossPointSettings& getInstance() { return instance; }
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ const SettingInfo readerSettings[readerSettingsCount] = {
|
||||
SettingInfo::Toggle("Extra Paragraph Spacing", &CrossPointSettings::extraParagraphSpacing),
|
||||
SettingInfo::Toggle("Text Anti-Aliasing", &CrossPointSettings::textAntiAliasing)};
|
||||
|
||||
constexpr int controlsSettingsCount = 4;
|
||||
constexpr int controlsSettingsCount = 5;
|
||||
const SettingInfo controlsSettings[controlsSettingsCount] = {
|
||||
SettingInfo::Enum(
|
||||
"Front Button Layout", &CrossPointSettings::frontButtonLayout,
|
||||
@ -43,8 +43,9 @@ const SettingInfo controlsSettings[controlsSettingsCount] = {
|
||||
SettingInfo::Enum("Side Button Layout (reader)", &CrossPointSettings::sideButtonLayout,
|
||||
{"Prev, Next", "Next, Prev"}),
|
||||
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;
|
||||
const SettingInfo systemSettings[systemSettingsCount] = {
|
||||
SettingInfo::Enum("Time to Sleep", &CrossPointSettings::sleepTimeout,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user