Compare commits

..

3 Commits

Author SHA1 Message Date
Yaroslav
3664355b1a Run clang-format-fix 2026-01-22 02:43:40 +03:00
Yaroslav
ffc30eb18c Fix unpressing while skipping delay block 2026-01-22 00:53:42 +03:00
Yaroslav
92337be649 Don't change pages during skipping delay 2026-01-22 00:11:46 +03:00
7 changed files with 16 additions and 16 deletions

View File

@ -5,8 +5,8 @@
#include <algorithm> #include <algorithm>
#include "MappedInputManager.h"
#include "CrossPointSettings.h" #include "CrossPointSettings.h"
#include "MappedInputManager.h"
#include "RecentBooksStore.h" #include "RecentBooksStore.h"
#include "ScreenComponents.h" #include "ScreenComponents.h"
#include "fontIds.h" #include "fontIds.h"

View File

@ -179,7 +179,7 @@ void EpubReaderActivity::loop() {
delayedSkipDir = nextPressed ? +1 : -1; delayedSkipDir = nextPressed ? +1 : -1;
delayedSkipExecuteAtMs = millis() + 500; delayedSkipExecuteAtMs = millis() + 500;
xSemaphoreGive(renderingMutex); xSemaphoreGive(renderingMutex);
// Block release-based page change until unpressed // Block changing page until unpressed skip button
awaitingReleaseAfterSkip = true; awaitingReleaseAfterSkip = true;
return; return;
} }
@ -201,6 +201,10 @@ void EpubReaderActivity::loop() {
return; return;
} }
if (delayedSkipPending) {
return;
}
// any botton press when at end of the book goes back to the last page // any botton press when at end of the book goes back to the last page
if (currentSpineIndex > 0 && currentSpineIndex >= epub->getSpineItemsCount()) { if (currentSpineIndex > 0 && currentSpineIndex >= epub->getSpineItemsCount()) {
currentSpineIndex = epub->getSpineItemsCount() - 1; currentSpineIndex = epub->getSpineItemsCount() - 1;
@ -209,7 +213,6 @@ void EpubReaderActivity::loop() {
return; return;
} }
// No current section, attempt to rerender the book // No current section, attempt to rerender the book
if (!section) { if (!section) {
updateRequired = true; updateRequired = true;
@ -252,7 +255,6 @@ void EpubReaderActivity::displayTaskLoop() {
renderScreen(); renderScreen();
xSemaphoreGive(renderingMutex); xSemaphoreGive(renderingMutex);
} else if (delayedSkipPending && now >= delayedSkipExecuteAtMs) { } else if (delayedSkipPending && now >= delayedSkipExecuteAtMs) {
// Execute the delayed chapter skip now
xSemaphoreTake(renderingMutex, portMAX_DELAY); xSemaphoreTake(renderingMutex, portMAX_DELAY);
nextPageNumber = 0; nextPageNumber = 0;
currentSpineIndex += delayedSkipDir; currentSpineIndex += delayedSkipDir;

View File

@ -2,15 +2,12 @@
#include <GfxRenderer.h> #include <GfxRenderer.h>
#include "CrossPointSettings.h"
#include "KOReaderCredentialStore.h" #include "KOReaderCredentialStore.h"
#include "KOReaderSyncActivity.h" #include "KOReaderSyncActivity.h"
#include "CrossPointSettings.h"
#include "MappedInputManager.h" #include "MappedInputManager.h"
#include "fontIds.h" #include "fontIds.h"
namespace {
} // namespace
bool EpubReaderChapterSelectionActivity::hasSyncOption() const { return KOREADER_STORE.hasCredentials(); } bool EpubReaderChapterSelectionActivity::hasSyncOption() const { return KOREADER_STORE.hasCredentials(); }
int EpubReaderChapterSelectionActivity::getTotalItems() const { int EpubReaderChapterSelectionActivity::getTotalItems() const {

View File

@ -128,7 +128,7 @@ void XtcReaderActivity::loop() {
delayedSkipAmount = 10; // long-press skip amount delayedSkipAmount = 10; // long-press skip amount
delayedSkipExecuteAtMs = millis() + 500; delayedSkipExecuteAtMs = millis() + 500;
xSemaphoreGive(renderingMutex); xSemaphoreGive(renderingMutex);
// Block release-based page change until unpressed // Block changing page until unpressed skip button
awaitingReleaseAfterSkip = true; awaitingReleaseAfterSkip = true;
return; return;
} }
@ -150,6 +150,10 @@ void XtcReaderActivity::loop() {
return; return;
} }
if (delayedSkipPending) {
return;
}
// Handle end of book // Handle end of book
if (currentPage >= xtc->getPageCount()) { if (currentPage >= xtc->getPageCount()) {
currentPage = xtc->getPageCount() - 1; currentPage = xtc->getPageCount() - 1;

View File

@ -6,9 +6,6 @@
#include "MappedInputManager.h" #include "MappedInputManager.h"
#include "fontIds.h" #include "fontIds.h"
namespace {
} // namespace
int XtcReaderChapterSelectionActivity::getPageItems() const { int XtcReaderChapterSelectionActivity::getPageItems() const {
constexpr int startY = 60; constexpr int startY = 60;
constexpr int lineHeight = 30; constexpr int lineHeight = 30;