2025-12-15 13:16:46 +01:00
|
|
|
#pragma once
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <iosfwd>
|
|
|
|
|
|
|
|
|
|
class CrossPointSettings {
|
|
|
|
|
private:
|
|
|
|
|
// Private constructor for singleton
|
|
|
|
|
CrossPointSettings() = default;
|
|
|
|
|
|
|
|
|
|
// Static instance
|
|
|
|
|
static CrossPointSettings instance;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// Delete copy constructor and assignment
|
|
|
|
|
CrossPointSettings(const CrossPointSettings&) = delete;
|
|
|
|
|
CrossPointSettings& operator=(const CrossPointSettings&) = delete;
|
|
|
|
|
|
2026-01-27 13:08:58 +01:00
|
|
|
enum SLEEP_SCREEN_MODE { DARK = 0, LIGHT = 1, CUSTOM = 2, COVER = 3, BLANK = 4, SLEEP_SCREEN_MODE_COUNT };
|
|
|
|
|
enum SLEEP_SCREEN_COVER_MODE { FIT = 0, CROP = 1, SLEEP_SCREEN_COVER_MODE_COUNT };
|
2026-01-27 13:21:59 +00:00
|
|
|
enum SLEEP_SCREEN_COVER_FILTER {
|
|
|
|
|
NO_FILTER = 0,
|
|
|
|
|
BLACK_AND_WHITE = 1,
|
|
|
|
|
INVERTED_BLACK_AND_WHITE = 2,
|
|
|
|
|
SLEEP_SCREEN_COVER_FILTER_COUNT
|
|
|
|
|
};
|
2025-12-21 18:42:06 +11:00
|
|
|
|
2025-12-27 17:48:27 -06:00
|
|
|
// Status bar display type enum
|
2026-01-27 12:25:44 +00:00
|
|
|
enum STATUS_BAR_MODE {
|
|
|
|
|
NONE = 0,
|
|
|
|
|
NO_PROGRESS = 1,
|
|
|
|
|
FULL = 2,
|
|
|
|
|
FULL_WITH_PROGRESS_BAR = 3,
|
|
|
|
|
ONLY_PROGRESS_BAR = 4,
|
|
|
|
|
STATUS_BAR_MODE_COUNT
|
|
|
|
|
};
|
2025-12-27 17:48:27 -06:00
|
|
|
|
Rotation Support (#77)
• What is the goal of this PR?
Implement a horizontal EPUB reading mode so books can be read in
landscape orientation (both 90° and 270°), while keeping the rest of the
UI in portrait.
• What changes are included?
◦ Rendering / Display
▪ Added an orientation model to GfxRenderer (Portrait, LandscapeNormal,
LandscapeFlipped) and made:
▪ drawPixel, drawImage, displayWindow map logical coordinates
differently depending on orientation.
▪ getScreenWidth() / getScreenHeight() return orientation‑aware logical
dimensions (480×800 in portrait, 800×480 in landscape).
◦ Settings / Configuration
▪ Extended CrossPointSettings with:
▪ landscapeReading (toggle for portrait vs. landscape EPUB reading).
▪ landscapeFlipped (toggle to flip landscape 180° so both horizontal
holding directions are supported).
▪ Updated settings serialization/deserialization to persist these fields
while remaining backward‑compatible with existing settings files.
▪ Updated SettingsActivity to expose two new toggles:
▪ “Landscape Reading”
▪ “Flip Landscape (swap top/bottom)”
◦ EPUB Reader
▪ In EpubReaderActivity:
▪ On onEnter, set GfxRenderer orientation based on the new settings
(Portrait, LandscapeNormal, or LandscapeFlipped).
▪ On onExit, reset orientation back to Portrait so Home, WiFi, Settings,
etc. continue to render as before.
▪ Adjusted renderStatusBar to position the status bar and battery
indicator relative to GfxRenderer::getScreenHeight() instead of
hard‑coded Y coordinates, so it stays correctly at the bottom in both
portrait and landscape.
◦ EPUB Caching / Layout
▪ Extended Section cache metadata (section.bin) to include the logical
screenWidth and screenHeight used when pages were generated; bumped
SECTION_FILE_VERSION.
▪ Updated loadCacheMetadata to compare:
▪ font/margins/line compression/extraParagraphSpacing and screen
dimensions; mismatches now invalidate and clear the cache.
▪ Updated persistPageDataToSD and all call sites in EpubReaderActivity
to pass the current GfxRenderer::getScreenWidth() / getScreenHeight() so
portrait and landscape caches are kept separate and correctly sized.
Additional Context
• Cache behavior / migration
◦ Existing section.bin files (old SECTION_FILE_VERSION) will be detected
as incompatible and their caches cleared and rebuilt once per chapter
when first opened after this change.
◦ Within a given orientation, caches will be reused as before. Switching
orientation (portrait ↔ landscape) will cause a one‑time re‑index of
each chapter in the new orientation.
• Scope and risks
◦ Orientation changes are scoped to the EPUB reader; the Home screen,
Settings, WiFi selection, sleep screens, and web server UI continue to
assume portrait orientation.
◦ The renderer’s orientation is a static/global setting; if future code
uses GfxRenderer outside the reader while a reader instance is active,
it should be aware that orientation is no longer implicitly fixed.
◦ All drawing primitives now go through orientation‑aware coordinate
transforms; any code that previously relied on edge‑case behavior or
out‑of‑bounds writes might surface as logged “Outside range” warnings
instead.
• Testing suggestions / areas to focus on
◦ Verify in hardware:
▪ Portrait mode still renders correctly (boot, home, settings, WiFi,
reader).
▪ Landscape reading in both directions:
▪ Landscape Reading = ON, Flip Landscape = OFF.
▪ Landscape Reading = ON, Flip Landscape = ON.
▪ Status bar (page X/Y, % progress, battery icon) is fully visible and
aligned at the bottom in all three combinations.
◦ Open the same book:
▪ In portrait first, then switch to landscape and reopen it.
▪ Confirm that:
▪ Old portrait caches are rebuilt once for landscape (you should see the
“Indexing…” page).
▪ Progress save/restore still works (resume opens to the correct page in
the current orientation).
◦ Ensure grayscale rendering (the secondary pass in
EpubReaderActivity::renderContents) still looks correct in both
orientations.
---------
Co-authored-by: Dave Allie <dave@daveallie.com>
2025-12-28 05:33:20 -05:00
|
|
|
enum ORIENTATION {
|
2026-01-27 13:08:58 +01:00
|
|
|
PORTRAIT = 0, // 480x800 logical coordinates (current default)
|
|
|
|
|
LANDSCAPE_CW = 1, // 800x480 logical coordinates, rotated 180° (swap top/bottom)
|
|
|
|
|
INVERTED = 2, // 480x800 logical coordinates, inverted
|
|
|
|
|
LANDSCAPE_CCW = 3, // 800x480 logical coordinates, native panel orientation
|
|
|
|
|
ORIENTATION_COUNT
|
Rotation Support (#77)
• What is the goal of this PR?
Implement a horizontal EPUB reading mode so books can be read in
landscape orientation (both 90° and 270°), while keeping the rest of the
UI in portrait.
• What changes are included?
◦ Rendering / Display
▪ Added an orientation model to GfxRenderer (Portrait, LandscapeNormal,
LandscapeFlipped) and made:
▪ drawPixel, drawImage, displayWindow map logical coordinates
differently depending on orientation.
▪ getScreenWidth() / getScreenHeight() return orientation‑aware logical
dimensions (480×800 in portrait, 800×480 in landscape).
◦ Settings / Configuration
▪ Extended CrossPointSettings with:
▪ landscapeReading (toggle for portrait vs. landscape EPUB reading).
▪ landscapeFlipped (toggle to flip landscape 180° so both horizontal
holding directions are supported).
▪ Updated settings serialization/deserialization to persist these fields
while remaining backward‑compatible with existing settings files.
▪ Updated SettingsActivity to expose two new toggles:
▪ “Landscape Reading”
▪ “Flip Landscape (swap top/bottom)”
◦ EPUB Reader
▪ In EpubReaderActivity:
▪ On onEnter, set GfxRenderer orientation based on the new settings
(Portrait, LandscapeNormal, or LandscapeFlipped).
▪ On onExit, reset orientation back to Portrait so Home, WiFi, Settings,
etc. continue to render as before.
▪ Adjusted renderStatusBar to position the status bar and battery
indicator relative to GfxRenderer::getScreenHeight() instead of
hard‑coded Y coordinates, so it stays correctly at the bottom in both
portrait and landscape.
◦ EPUB Caching / Layout
▪ Extended Section cache metadata (section.bin) to include the logical
screenWidth and screenHeight used when pages were generated; bumped
SECTION_FILE_VERSION.
▪ Updated loadCacheMetadata to compare:
▪ font/margins/line compression/extraParagraphSpacing and screen
dimensions; mismatches now invalidate and clear the cache.
▪ Updated persistPageDataToSD and all call sites in EpubReaderActivity
to pass the current GfxRenderer::getScreenWidth() / getScreenHeight() so
portrait and landscape caches are kept separate and correctly sized.
Additional Context
• Cache behavior / migration
◦ Existing section.bin files (old SECTION_FILE_VERSION) will be detected
as incompatible and their caches cleared and rebuilt once per chapter
when first opened after this change.
◦ Within a given orientation, caches will be reused as before. Switching
orientation (portrait ↔ landscape) will cause a one‑time re‑index of
each chapter in the new orientation.
• Scope and risks
◦ Orientation changes are scoped to the EPUB reader; the Home screen,
Settings, WiFi selection, sleep screens, and web server UI continue to
assume portrait orientation.
◦ The renderer’s orientation is a static/global setting; if future code
uses GfxRenderer outside the reader while a reader instance is active,
it should be aware that orientation is no longer implicitly fixed.
◦ All drawing primitives now go through orientation‑aware coordinate
transforms; any code that previously relied on edge‑case behavior or
out‑of‑bounds writes might surface as logged “Outside range” warnings
instead.
• Testing suggestions / areas to focus on
◦ Verify in hardware:
▪ Portrait mode still renders correctly (boot, home, settings, WiFi,
reader).
▪ Landscape reading in both directions:
▪ Landscape Reading = ON, Flip Landscape = OFF.
▪ Landscape Reading = ON, Flip Landscape = ON.
▪ Status bar (page X/Y, % progress, battery icon) is fully visible and
aligned at the bottom in all three combinations.
◦ Open the same book:
▪ In portrait first, then switch to landscape and reopen it.
▪ Confirm that:
▪ Old portrait caches are rebuilt once for landscape (you should see the
“Indexing…” page).
▪ Progress save/restore still works (resume opens to the correct page in
the current orientation).
◦ Ensure grayscale rendering (the secondary pass in
EpubReaderActivity::renderContents) still looks correct in both
orientations.
---------
Co-authored-by: Dave Allie <dave@daveallie.com>
2025-12-28 05:33:20 -05:00
|
|
|
};
|
|
|
|
|
|
2026-02-05 14:37:17 +03:00
|
|
|
// Front button layout options (legacy)
|
2025-12-28 21:59:14 -06:00
|
|
|
// Default: Back, Confirm, Left, Right
|
|
|
|
|
// Swapped: Left, Right, Back, Confirm
|
2026-01-27 11:15:42 +01:00
|
|
|
enum FRONT_BUTTON_LAYOUT {
|
|
|
|
|
BACK_CONFIRM_LEFT_RIGHT = 0,
|
|
|
|
|
LEFT_RIGHT_BACK_CONFIRM = 1,
|
|
|
|
|
LEFT_BACK_CONFIRM_RIGHT = 2,
|
2026-01-27 13:08:58 +01:00
|
|
|
BACK_CONFIRM_RIGHT_LEFT = 3,
|
|
|
|
|
FRONT_BUTTON_LAYOUT_COUNT
|
2026-01-27 11:15:42 +01:00
|
|
|
};
|
2025-12-28 21:59:14 -06:00
|
|
|
|
2026-02-05 14:37:17 +03:00
|
|
|
// Front button hardware identifiers (for remapping)
|
|
|
|
|
enum FRONT_BUTTON_HARDWARE {
|
|
|
|
|
FRONT_HW_BACK = 0,
|
|
|
|
|
FRONT_HW_CONFIRM = 1,
|
|
|
|
|
FRONT_HW_LEFT = 2,
|
|
|
|
|
FRONT_HW_RIGHT = 3,
|
|
|
|
|
FRONT_BUTTON_HARDWARE_COUNT
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-29 11:17:10 +01:00
|
|
|
// Side button layout options
|
|
|
|
|
// Default: Previous, Next
|
|
|
|
|
// Swapped: Next, Previous
|
2026-01-27 13:08:58 +01:00
|
|
|
enum SIDE_BUTTON_LAYOUT { PREV_NEXT = 0, NEXT_PREV = 1, SIDE_BUTTON_LAYOUT_COUNT };
|
2025-12-29 11:17:10 +01:00
|
|
|
|
Aleo, Noto Sans, Open Dyslexic fonts (#163)
## Summary
* Swap out Bookerly font due to licensing issues, replace default font
with Aleo
* I did a bunch of searching around for a nice replacement font, and
this trumped several other like Literata, Merriwether, Vollkorn, etc
* Add Noto Sans, and Open Dyslexic as font options
* They can be selected in the settings screen
* Add font size options (Small, Medium, Large, Extra Large)
* Adjustable in settings
* Swap out uses of reader font in headings and replaced with slightly
larger Ubuntu font
* Replaced PixelArial14 font as it was difficult to track down, replace
with Space Grotesk
* Remove auto formatting on generated font files
* Massively speeds up formatting step now that there is a lot more CPP
font source
* Include fonts with their licenses in the repo
## Additional Context
Line compression setting will follow
| Font | Small | Medium | Large | X Large |
| --- | --- | --- | --- | --- |
| Aleo |

|

|

|

|
| Noto Sans |

|

|

|

|
| Open Dyslexic |

|

|

|

|
2025-12-30 18:21:47 +10:00
|
|
|
// Font family options
|
2026-01-27 13:08:58 +01:00
|
|
|
enum FONT_FAMILY { BOOKERLY = 0, NOTOSANS = 1, OPENDYSLEXIC = 2, FONT_FAMILY_COUNT };
|
Aleo, Noto Sans, Open Dyslexic fonts (#163)
## Summary
* Swap out Bookerly font due to licensing issues, replace default font
with Aleo
* I did a bunch of searching around for a nice replacement font, and
this trumped several other like Literata, Merriwether, Vollkorn, etc
* Add Noto Sans, and Open Dyslexic as font options
* They can be selected in the settings screen
* Add font size options (Small, Medium, Large, Extra Large)
* Adjustable in settings
* Swap out uses of reader font in headings and replaced with slightly
larger Ubuntu font
* Replaced PixelArial14 font as it was difficult to track down, replace
with Space Grotesk
* Remove auto formatting on generated font files
* Massively speeds up formatting step now that there is a lot more CPP
font source
* Include fonts with their licenses in the repo
## Additional Context
Line compression setting will follow
| Font | Small | Medium | Large | X Large |
| --- | --- | --- | --- | --- |
| Aleo |

|

|

|

|
| Noto Sans |

|

|

|

|
| Open Dyslexic |

|

|

|

|
2025-12-30 18:21:47 +10:00
|
|
|
// Font size options
|
2026-01-27 13:08:58 +01:00
|
|
|
enum FONT_SIZE { SMALL = 0, MEDIUM = 1, LARGE = 2, EXTRA_LARGE = 3, FONT_SIZE_COUNT };
|
|
|
|
|
enum LINE_COMPRESSION { TIGHT = 0, NORMAL = 1, WIDE = 2, LINE_COMPRESSION_COUNT };
|
|
|
|
|
enum PARAGRAPH_ALIGNMENT {
|
|
|
|
|
JUSTIFIED = 0,
|
|
|
|
|
LEFT_ALIGN = 1,
|
|
|
|
|
CENTER_ALIGN = 2,
|
|
|
|
|
RIGHT_ALIGN = 3,
|
|
|
|
|
PARAGRAPH_ALIGNMENT_COUNT
|
|
|
|
|
};
|
Aleo, Noto Sans, Open Dyslexic fonts (#163)
## Summary
* Swap out Bookerly font due to licensing issues, replace default font
with Aleo
* I did a bunch of searching around for a nice replacement font, and
this trumped several other like Literata, Merriwether, Vollkorn, etc
* Add Noto Sans, and Open Dyslexic as font options
* They can be selected in the settings screen
* Add font size options (Small, Medium, Large, Extra Large)
* Adjustable in settings
* Swap out uses of reader font in headings and replaced with slightly
larger Ubuntu font
* Replaced PixelArial14 font as it was difficult to track down, replace
with Space Grotesk
* Remove auto formatting on generated font files
* Massively speeds up formatting step now that there is a lot more CPP
font source
* Include fonts with their licenses in the repo
## Additional Context
Line compression setting will follow
| Font | Small | Medium | Large | X Large |
| --- | --- | --- | --- | --- |
| Aleo |

|

|

|

|
| Noto Sans |

|

|

|

|
| Open Dyslexic |

|

|

|

|
2025-12-30 18:21:47 +10:00
|
|
|
|
2026-01-03 08:33:42 +00:00
|
|
|
// Auto-sleep timeout options (in minutes)
|
2026-01-27 13:08:58 +01:00
|
|
|
enum SLEEP_TIMEOUT {
|
|
|
|
|
SLEEP_1_MIN = 0,
|
|
|
|
|
SLEEP_5_MIN = 1,
|
|
|
|
|
SLEEP_10_MIN = 2,
|
|
|
|
|
SLEEP_15_MIN = 3,
|
|
|
|
|
SLEEP_30_MIN = 4,
|
|
|
|
|
SLEEP_TIMEOUT_COUNT
|
|
|
|
|
};
|
2026-01-03 08:33:42 +00:00
|
|
|
|
|
|
|
|
// E-ink refresh frequency (pages between full refreshes)
|
2026-01-27 13:08:58 +01:00
|
|
|
enum REFRESH_FREQUENCY {
|
|
|
|
|
REFRESH_1 = 0,
|
|
|
|
|
REFRESH_5 = 1,
|
|
|
|
|
REFRESH_10 = 2,
|
|
|
|
|
REFRESH_15 = 3,
|
|
|
|
|
REFRESH_30 = 4,
|
|
|
|
|
REFRESH_FREQUENCY_COUNT
|
|
|
|
|
};
|
2026-01-03 08:33:42 +00:00
|
|
|
|
2026-01-12 10:07:26 +01:00
|
|
|
// Short power button press actions
|
2026-01-27 13:08:58 +01:00
|
|
|
enum SHORT_PWRBTN { IGNORE = 0, SLEEP = 1, PAGE_TURN = 2, SHORT_PWRBTN_COUNT };
|
2026-01-12 10:07:26 +01:00
|
|
|
|
2026-01-12 10:53:58 +01:00
|
|
|
// Hide battery percentage
|
2026-01-27 13:08:58 +01:00
|
|
|
enum HIDE_BATTERY_PERCENTAGE { HIDE_NEVER = 0, HIDE_READER = 1, HIDE_ALWAYS = 2, HIDE_BATTERY_PERCENTAGE_COUNT };
|
2026-01-12 10:53:58 +01:00
|
|
|
|
feat: UI themes, Lyra (#528)
## Summary
### What is the goal of this PR?
- Visual UI overhaul
- UI theme selection
### What changes are included?
- Added a setting "UI Theme": Classic, Lyra
- The classic theme is the current Crosspoint theme
- The Lyra theme implements these mockups:
https://www.figma.com/design/UhxoV4DgUnfrDQgMPPTXog/Lyra-Theme?node-id=2003-7596&t=4CSOZqf0n9uQMxDt-0
by Discord users yagofarias, ruby and gan_shu
- New functions in GFXRenderer to render rounded rectangles, greyscale
fills (using dithering) and thick lines
- Basic UI components are factored into BaseTheme methods which can be
overridden by each additional theme. Methods that are not overridden
will fallback to BaseTheme behavior. This means any new
features/components in CrossPoint only need to be developed for the
"Classic" BaseTheme.
- Additional themes can easily be developed by the community using this
foundation



## Additional Context
- Only the Home, Library and main Settings screens have been implemented
so far, this will be extended to the transfer screens and chapter
selection screen later on, but we need to get the ball rolling somehow
:)
- Loading extra covers on the home screen in the Lyra theme takes a
little more time (about 2 seconds), I added a loading bar popup (reusing
the Indexing progress bar from the reader view, factored into a neat UI
component) but the popup adds ~400ms to the loading time.
- ~~Home screen thumbnails will need to be generated separately for each
theme, because they are displayed in different sizes. Because we're
using dithering, displaying a thumb with the wrong size causes the
picture to look janky or dark as it does on the screenshots above. No
worries this will be fixed in a future PR.~~ Thumbs are now generated
with a size parameter
- UI Icons will need to be implemented in a future PR.
---
### 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? _**PARTIALLY**_
This is not a vibe coded PR. Copilot was used for autocompletion to save
time but I reviewed, understood and edited all generated code.
---------
Co-authored-by: Dave Allie <dave@daveallie.com>
2026-02-05 17:50:11 +07:00
|
|
|
// UI Theme
|
|
|
|
|
enum UI_THEME { CLASSIC = 0, LYRA = 1 };
|
|
|
|
|
|
2025-12-15 13:16:46 +01:00
|
|
|
// Sleep screen settings
|
2025-12-21 18:42:06 +11:00
|
|
|
uint8_t sleepScreen = DARK;
|
2026-01-05 11:07:27 +01:00
|
|
|
// Sleep screen cover mode settings
|
|
|
|
|
uint8_t sleepScreenCoverMode = FIT;
|
2026-01-27 13:21:59 +00:00
|
|
|
// Sleep screen cover filter
|
|
|
|
|
uint8_t sleepScreenCoverFilter = NO_FILTER;
|
2025-12-27 17:48:27 -06:00
|
|
|
// Status bar settings
|
|
|
|
|
uint8_t statusBar = FULL;
|
2025-12-15 13:16:46 +01:00
|
|
|
// Text rendering settings
|
|
|
|
|
uint8_t extraParagraphSpacing = 1;
|
2026-01-07 10:14:35 +01:00
|
|
|
uint8_t textAntiAliasing = 1;
|
2026-01-12 10:07:26 +01:00
|
|
|
// Short power button click behaviour
|
|
|
|
|
uint8_t shortPwrBtn = IGNORE;
|
Rotation Support (#77)
• What is the goal of this PR?
Implement a horizontal EPUB reading mode so books can be read in
landscape orientation (both 90° and 270°), while keeping the rest of the
UI in portrait.
• What changes are included?
◦ Rendering / Display
▪ Added an orientation model to GfxRenderer (Portrait, LandscapeNormal,
LandscapeFlipped) and made:
▪ drawPixel, drawImage, displayWindow map logical coordinates
differently depending on orientation.
▪ getScreenWidth() / getScreenHeight() return orientation‑aware logical
dimensions (480×800 in portrait, 800×480 in landscape).
◦ Settings / Configuration
▪ Extended CrossPointSettings with:
▪ landscapeReading (toggle for portrait vs. landscape EPUB reading).
▪ landscapeFlipped (toggle to flip landscape 180° so both horizontal
holding directions are supported).
▪ Updated settings serialization/deserialization to persist these fields
while remaining backward‑compatible with existing settings files.
▪ Updated SettingsActivity to expose two new toggles:
▪ “Landscape Reading”
▪ “Flip Landscape (swap top/bottom)”
◦ EPUB Reader
▪ In EpubReaderActivity:
▪ On onEnter, set GfxRenderer orientation based on the new settings
(Portrait, LandscapeNormal, or LandscapeFlipped).
▪ On onExit, reset orientation back to Portrait so Home, WiFi, Settings,
etc. continue to render as before.
▪ Adjusted renderStatusBar to position the status bar and battery
indicator relative to GfxRenderer::getScreenHeight() instead of
hard‑coded Y coordinates, so it stays correctly at the bottom in both
portrait and landscape.
◦ EPUB Caching / Layout
▪ Extended Section cache metadata (section.bin) to include the logical
screenWidth and screenHeight used when pages were generated; bumped
SECTION_FILE_VERSION.
▪ Updated loadCacheMetadata to compare:
▪ font/margins/line compression/extraParagraphSpacing and screen
dimensions; mismatches now invalidate and clear the cache.
▪ Updated persistPageDataToSD and all call sites in EpubReaderActivity
to pass the current GfxRenderer::getScreenWidth() / getScreenHeight() so
portrait and landscape caches are kept separate and correctly sized.
Additional Context
• Cache behavior / migration
◦ Existing section.bin files (old SECTION_FILE_VERSION) will be detected
as incompatible and their caches cleared and rebuilt once per chapter
when first opened after this change.
◦ Within a given orientation, caches will be reused as before. Switching
orientation (portrait ↔ landscape) will cause a one‑time re‑index of
each chapter in the new orientation.
• Scope and risks
◦ Orientation changes are scoped to the EPUB reader; the Home screen,
Settings, WiFi selection, sleep screens, and web server UI continue to
assume portrait orientation.
◦ The renderer’s orientation is a static/global setting; if future code
uses GfxRenderer outside the reader while a reader instance is active,
it should be aware that orientation is no longer implicitly fixed.
◦ All drawing primitives now go through orientation‑aware coordinate
transforms; any code that previously relied on edge‑case behavior or
out‑of‑bounds writes might surface as logged “Outside range” warnings
instead.
• Testing suggestions / areas to focus on
◦ Verify in hardware:
▪ Portrait mode still renders correctly (boot, home, settings, WiFi,
reader).
▪ Landscape reading in both directions:
▪ Landscape Reading = ON, Flip Landscape = OFF.
▪ Landscape Reading = ON, Flip Landscape = ON.
▪ Status bar (page X/Y, % progress, battery icon) is fully visible and
aligned at the bottom in all three combinations.
◦ Open the same book:
▪ In portrait first, then switch to landscape and reopen it.
▪ Confirm that:
▪ Old portrait caches are rebuilt once for landscape (you should see the
“Indexing…” page).
▪ Progress save/restore still works (resume opens to the correct page in
the current orientation).
◦ Ensure grayscale rendering (the secondary pass in
EpubReaderActivity::renderContents) still looks correct in both
orientations.
---------
Co-authored-by: Dave Allie <dave@daveallie.com>
2025-12-28 05:33:20 -05:00
|
|
|
// EPUB reading orientation settings
|
|
|
|
|
// 0 = portrait (default), 1 = landscape clockwise, 2 = inverted, 3 = landscape counter-clockwise
|
|
|
|
|
uint8_t orientation = PORTRAIT;
|
2026-02-05 14:37:17 +03:00
|
|
|
// Button layouts (front layout retained for migration only)
|
2025-12-28 21:59:14 -06:00
|
|
|
uint8_t frontButtonLayout = BACK_CONFIRM_LEFT_RIGHT;
|
2025-12-29 11:17:10 +01:00
|
|
|
uint8_t sideButtonLayout = PREV_NEXT;
|
2026-02-05 14:37:17 +03:00
|
|
|
// Front button remap (logical -> hardware)
|
|
|
|
|
// Used by MappedInputManager to translate logical buttons into physical front buttons.
|
|
|
|
|
uint8_t frontButtonBack = FRONT_HW_BACK;
|
|
|
|
|
uint8_t frontButtonConfirm = FRONT_HW_CONFIRM;
|
|
|
|
|
uint8_t frontButtonLeft = FRONT_HW_LEFT;
|
|
|
|
|
uint8_t frontButtonRight = FRONT_HW_RIGHT;
|
2025-12-30 18:34:46 +10:00
|
|
|
// Reader font settings
|
2025-12-31 01:28:25 +10:00
|
|
|
uint8_t fontFamily = BOOKERLY;
|
Aleo, Noto Sans, Open Dyslexic fonts (#163)
## Summary
* Swap out Bookerly font due to licensing issues, replace default font
with Aleo
* I did a bunch of searching around for a nice replacement font, and
this trumped several other like Literata, Merriwether, Vollkorn, etc
* Add Noto Sans, and Open Dyslexic as font options
* They can be selected in the settings screen
* Add font size options (Small, Medium, Large, Extra Large)
* Adjustable in settings
* Swap out uses of reader font in headings and replaced with slightly
larger Ubuntu font
* Replaced PixelArial14 font as it was difficult to track down, replace
with Space Grotesk
* Remove auto formatting on generated font files
* Massively speeds up formatting step now that there is a lot more CPP
font source
* Include fonts with their licenses in the repo
## Additional Context
Line compression setting will follow
| Font | Small | Medium | Large | X Large |
| --- | --- | --- | --- | --- |
| Aleo |

|

|

|

|
| Noto Sans |

|

|

|

|
| Open Dyslexic |

|

|

|

|
2025-12-30 18:21:47 +10:00
|
|
|
uint8_t fontSize = MEDIUM;
|
2025-12-30 18:34:46 +10:00
|
|
|
uint8_t lineSpacing = NORMAL;
|
2026-01-02 01:21:48 -06:00
|
|
|
uint8_t paragraphAlignment = JUSTIFIED;
|
2026-01-03 08:33:42 +00:00
|
|
|
// Auto-sleep timeout setting (default 10 minutes)
|
|
|
|
|
uint8_t sleepTimeout = SLEEP_10_MIN;
|
|
|
|
|
// E-ink refresh frequency (default 15 pages)
|
|
|
|
|
uint8_t refreshFrequency = REFRESH_15;
|
2026-01-19 17:56:26 +05:00
|
|
|
uint8_t hyphenationEnabled = 0;
|
|
|
|
|
|
2026-01-05 10:29:08 +01:00
|
|
|
// Reader screen margin settings
|
|
|
|
|
uint8_t screenMargin = 5;
|
2026-01-07 20:02:33 +11:00
|
|
|
// OPDS browser settings
|
|
|
|
|
char opdsServerUrl[128] = "";
|
2026-01-27 06:02:38 -05:00
|
|
|
char opdsUsername[64] = "";
|
|
|
|
|
char opdsPassword[64] = "";
|
2026-01-12 10:53:58 +01:00
|
|
|
// Hide battery percentage
|
|
|
|
|
uint8_t hideBatteryPercentage = HIDE_NEVER;
|
2026-01-14 06:47:24 -05:00
|
|
|
// Long-press chapter skip on side buttons
|
|
|
|
|
uint8_t longPressChapterSkip = 1;
|
feat: UI themes, Lyra (#528)
## Summary
### What is the goal of this PR?
- Visual UI overhaul
- UI theme selection
### What changes are included?
- Added a setting "UI Theme": Classic, Lyra
- The classic theme is the current Crosspoint theme
- The Lyra theme implements these mockups:
https://www.figma.com/design/UhxoV4DgUnfrDQgMPPTXog/Lyra-Theme?node-id=2003-7596&t=4CSOZqf0n9uQMxDt-0
by Discord users yagofarias, ruby and gan_shu
- New functions in GFXRenderer to render rounded rectangles, greyscale
fills (using dithering) and thick lines
- Basic UI components are factored into BaseTheme methods which can be
overridden by each additional theme. Methods that are not overridden
will fallback to BaseTheme behavior. This means any new
features/components in CrossPoint only need to be developed for the
"Classic" BaseTheme.
- Additional themes can easily be developed by the community using this
foundation



## Additional Context
- Only the Home, Library and main Settings screens have been implemented
so far, this will be extended to the transfer screens and chapter
selection screen later on, but we need to get the ball rolling somehow
:)
- Loading extra covers on the home screen in the Lyra theme takes a
little more time (about 2 seconds), I added a loading bar popup (reusing
the Indexing progress bar from the reader view, factored into a neat UI
component) but the popup adds ~400ms to the loading time.
- ~~Home screen thumbnails will need to be generated separately for each
theme, because they are displayed in different sizes. Because we're
using dithering, displaying a thumb with the wrong size causes the
picture to look janky or dark as it does on the screenshots above. No
worries this will be fixed in a future PR.~~ Thumbs are now generated
with a size parameter
- UI Icons will need to be implemented in a future PR.
---
### 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? _**PARTIALLY**_
This is not a vibe coded PR. Copilot was used for autocompletion to save
time but I reviewed, understood and edited all generated code.
---------
Co-authored-by: Dave Allie <dave@daveallie.com>
2026-02-05 17:50:11 +07:00
|
|
|
// UI Theme
|
|
|
|
|
uint8_t uiTheme = LYRA;
|
2026-01-05 10:29:08 +01:00
|
|
|
|
2025-12-15 13:16:46 +01:00
|
|
|
~CrossPointSettings() = default;
|
|
|
|
|
|
|
|
|
|
// Get singleton instance
|
2025-12-15 23:17:23 +11:00
|
|
|
static CrossPointSettings& getInstance() { return instance; }
|
2025-12-15 13:16:46 +01:00
|
|
|
|
2026-01-12 10:07:26 +01:00
|
|
|
uint16_t getPowerButtonDuration() const {
|
|
|
|
|
return (shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::SLEEP) ? 10 : 400;
|
|
|
|
|
}
|
Aleo, Noto Sans, Open Dyslexic fonts (#163)
## Summary
* Swap out Bookerly font due to licensing issues, replace default font
with Aleo
* I did a bunch of searching around for a nice replacement font, and
this trumped several other like Literata, Merriwether, Vollkorn, etc
* Add Noto Sans, and Open Dyslexic as font options
* They can be selected in the settings screen
* Add font size options (Small, Medium, Large, Extra Large)
* Adjustable in settings
* Swap out uses of reader font in headings and replaced with slightly
larger Ubuntu font
* Replaced PixelArial14 font as it was difficult to track down, replace
with Space Grotesk
* Remove auto formatting on generated font files
* Massively speeds up formatting step now that there is a lot more CPP
font source
* Include fonts with their licenses in the repo
## Additional Context
Line compression setting will follow
| Font | Small | Medium | Large | X Large |
| --- | --- | --- | --- | --- |
| Aleo |

|

|

|

|
| Noto Sans |

|

|

|

|
| Open Dyslexic |

|

|

|

|
2025-12-30 18:21:47 +10:00
|
|
|
int getReaderFontId() const;
|
2025-12-19 13:37:34 +01:00
|
|
|
|
2025-12-15 13:16:46 +01:00
|
|
|
bool saveToFile() const;
|
|
|
|
|
bool loadFromFile();
|
2025-12-30 18:34:46 +10:00
|
|
|
|
|
|
|
|
float getReaderLineCompression() const;
|
2026-01-03 08:33:42 +00:00
|
|
|
unsigned long getSleepTimeoutMs() const;
|
|
|
|
|
int getRefreshFrequency() const;
|
2025-12-15 13:16:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Helper macro to access settings
|
|
|
|
|
#define SETTINGS CrossPointSettings::getInstance()
|