Don't change pages during skipping delay

This commit is contained in:
Yaroslav 2026-01-22 00:11:46 +03:00
parent 344f675233
commit 92337be649
2 changed files with 10 additions and 3 deletions

View File

@ -179,7 +179,7 @@ void EpubReaderActivity::loop() {
delayedSkipDir = nextPressed ? +1 : -1;
delayedSkipExecuteAtMs = millis() + 500;
xSemaphoreGive(renderingMutex);
// Block release-based page change until unpressed
// Block changing page until unpressed skip button
awaitingReleaseAfterSkip = true;
return;
}
@ -191,6 +191,10 @@ void EpubReaderActivity::loop() {
mappedInput.wasReleased(MappedInputManager::Button::Power)) ||
mappedInput.wasReleased(MappedInputManager::Button::Right);
if (delayedSkipPending) {
return;
}
if (!prevReleased && !nextReleased) {
return;
}
@ -252,7 +256,6 @@ void EpubReaderActivity::displayTaskLoop() {
renderScreen();
xSemaphoreGive(renderingMutex);
} else if (delayedSkipPending && now >= delayedSkipExecuteAtMs) {
// Execute the delayed chapter skip now
xSemaphoreTake(renderingMutex, portMAX_DELAY);
nextPageNumber = 0;
currentSpineIndex += delayedSkipDir;

View File

@ -128,7 +128,7 @@ void XtcReaderActivity::loop() {
delayedSkipAmount = 10; // long-press skip amount
delayedSkipExecuteAtMs = millis() + 500;
xSemaphoreGive(renderingMutex);
// Block release-based page change until unpressed
// Block changing page until unpressed skip button
awaitingReleaseAfterSkip = true;
return;
}
@ -140,6 +140,10 @@ void XtcReaderActivity::loop() {
mappedInput.wasReleased(MappedInputManager::Button::Power)) ||
mappedInput.wasReleased(MappedInputManager::Button::Right);
if (delayedSkipPending) {
return;
}
if (!prevReleased && !nextReleased) {
return;
}