added leaved feature

This commit is contained in:
2023-01-04 00:18:07 +01:00
parent 15689bf56b
commit abb85340bc
2 changed files with 20 additions and 4 deletions
+15 -4
View File
@@ -38,8 +38,10 @@ void MenuInformationSites::right() {
}
void MenuInformationSites::left() {
if (this->parentMenu)
if (this->parentMenu) {
this->parentMenu->printMenu();
this->leaved = true;
}
}
void MenuInformationSites::no() {
@@ -52,7 +54,14 @@ void MenuInformationSites::yes() {
}
void MenuInformationSites::printMenu() {
if (this->leaved) {
this->leaved = false;
this->lastPageNumber++;
this->init();
}
this->printPage();
this->lastPageNumber = this->currentPage;
}
void MenuInformationSites::update() {
@@ -64,10 +73,12 @@ void MenuInformationSites::update() {
}
bool MenuInformationSites::setCountPages(uint8_t pages) {
if (this->countPages < pages)
this->countPages = pages;
else
this->countPages = pages;
this->currentPage = 0;
if (this->countPages == 0) {
this->countPages = 1;
return false;
}
return true;
}