Screen handler bugfix for multi currency
All checks were successful
BTClock CI / build (push) Successful in 21m36s
BTClock CI / merge (map[name:btclock_rev_b version:esp32s3], 213epd) (push) Successful in 34s
BTClock CI / merge (map[name:btclock_v8 version:esp32s3], 213epd) (push) Successful in 33s
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 213epd) (push) Successful in 32s
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 29epd) (push) Successful in 32s
BTClock CI / release (push) Successful in 12s
All checks were successful
BTClock CI / build (push) Successful in 21m36s
BTClock CI / merge (map[name:btclock_rev_b version:esp32s3], 213epd) (push) Successful in 34s
BTClock CI / merge (map[name:btclock_v8 version:esp32s3], 213epd) (push) Successful in 33s
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 213epd) (push) Successful in 32s
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 29epd) (push) Successful in 32s
BTClock CI / release (push) Successful in 12s
This commit is contained in:
parent
833d46fa5a
commit
73a20cf9a7
2 changed files with 28 additions and 3 deletions
2
data
2
data
|
@ -1 +1 @@
|
|||
Subproject commit 468e105adfaded0440ff8bba61a8241d54f28cd4
|
||||
Subproject commit 48e585d4ec12bbc441499936d7cbf53d4307b9ec
|
|
@ -108,6 +108,7 @@ bool ScreenHandler::handleCurrencyRotation(bool forward) {
|
|||
setCurrentScreen(getCurrentScreen());
|
||||
return true;
|
||||
}
|
||||
// If we're at the last/first currency of current screen, let nextScreen/previousScreen handle it
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
@ -143,14 +144,38 @@ int ScreenHandler::findNextVisibleScreen(int currentScreen, bool forward) {
|
|||
|
||||
void ScreenHandler::nextScreen() {
|
||||
if (handleCurrencyRotation(true)) return;
|
||||
|
||||
int currentIndex = findScreenIndexByValue(getCurrentScreen());
|
||||
setCurrentScreen(findNextVisibleScreen(currentIndex, true));
|
||||
int nextScreen = findNextVisibleScreen(currentIndex, true);
|
||||
|
||||
// If moving from a currency-specific screen to another currency-specific screen
|
||||
// reset to first currency
|
||||
if (isCurrencySpecific(getCurrentScreen()) && isCurrencySpecific(nextScreen)) {
|
||||
std::vector<std::string> ac = getActiveCurrencies();
|
||||
if (!ac.empty()) {
|
||||
setCurrentCurrency(getCurrencyChar(ac.front()));
|
||||
}
|
||||
}
|
||||
|
||||
setCurrentScreen(nextScreen);
|
||||
}
|
||||
|
||||
void ScreenHandler::previousScreen() {
|
||||
if (handleCurrencyRotation(false)) return;
|
||||
|
||||
int currentIndex = findScreenIndexByValue(getCurrentScreen());
|
||||
setCurrentScreen(findNextVisibleScreen(currentIndex, false));
|
||||
int prevScreen = findNextVisibleScreen(currentIndex, false);
|
||||
|
||||
// If moving from a currency-specific screen to another currency-specific screen
|
||||
// reset to last currency
|
||||
if (isCurrencySpecific(getCurrentScreen()) && isCurrencySpecific(prevScreen)) {
|
||||
std::vector<std::string> ac = getActiveCurrencies();
|
||||
if (!ac.empty()) {
|
||||
setCurrentCurrency(getCurrencyChar(ac.back()));
|
||||
}
|
||||
}
|
||||
|
||||
setCurrentScreen(prevScreen);
|
||||
}
|
||||
|
||||
void ScreenHandler::showSystemStatusScreen() {
|
||||
|
|
Loading…
Reference in a new issue