refactor: Avoid vector for page turn rates list (#1818)

## Summary

Small cleanup to avoid a dynamically allocated static structure for auto
page-turn rate values.

---

### 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**_
This commit is contained in:
Zach Nelson
2026-05-04 08:45:44 -05:00
committed by GitHub
parent a5fac320ab
commit 6c4ae7c41a
+4 -3
View File
@@ -10,6 +10,7 @@
#include <Logging.h>
#include <esp_system.h>
#include <iterator>
#include <limits>
#include "CrossPointSettings.h"
@@ -31,7 +32,7 @@ namespace {
// pagesPerRefresh now comes from SETTINGS.getRefreshFrequency()
constexpr unsigned long skipChapterMs = 700;
// pages per minute, first item is 1 to prevent division by zero if accessed
const std::vector<int> PAGE_TURN_LABELS = {1, 1, 3, 6, 12};
constexpr int PAGE_TURN_RATES[] = {1, 1, 3, 6, 12};
int clampPercent(int percent) {
if (percent < 0) {
@@ -469,14 +470,14 @@ void EpubReaderActivity::applyOrientation(const uint8_t orientation) {
}
void EpubReaderActivity::toggleAutoPageTurn(const uint8_t selectedPageTurnOption) {
if (selectedPageTurnOption == 0 || selectedPageTurnOption >= PAGE_TURN_LABELS.size()) {
if (selectedPageTurnOption == 0 || selectedPageTurnOption >= std::size(PAGE_TURN_RATES)) {
automaticPageTurnActive = false;
return;
}
lastPageTurnTime = millis();
// calculates page turn duration by dividing by number of pages
pageTurnDuration = (1UL * 60 * 1000) / PAGE_TURN_LABELS[selectedPageTurnOption];
pageTurnDuration = (1UL * 60 * 1000) / PAGE_TURN_RATES[selectedPageTurnOption];
automaticPageTurnActive = true;
const uint8_t statusBarHeight = UITheme::getInstance().getStatusBarHeight();