bug fix static in motor und speed

This commit is contained in:
2022-01-29 12:25:06 +01:00
parent 1265cfda5c
commit 9c4c82f8b3
18 changed files with 197 additions and 99 deletions
+7 -6
View File
@@ -20,18 +20,19 @@ void Menu::addEntry(MenuAction* entry) {
// TODO: Same shit here. Why I get the first element after an increment.
static uint8_t inc = 0;
inc++;
if (inc == 2) {
if (inc == 1) {
this->it = this->entrys.begin();
}
}
void Menu::printMenu() {
Serial.println("\n\n");
std::cout << std::endl;
for (std::list<MenuAction*>::iterator iter = this->entrys.begin(); iter != this->entrys.end(); iter++) {
MenuAction* selectedEntry = *(iter);
if (this->it == iter)
Serial.print(" ");
Serial.println(selectedEntry->getName());
std::cout << " " << selectedEntry->getName() << std::endl;
else
std::cout << selectedEntry->getName() << std::endl;
}
this->inSubmenu = false;
}
@@ -62,11 +63,9 @@ void Menu::up() {
std::list<MenuAction*>::iterator iter = this->entrys.end();
iter--;
if (this->it != this->entrys.begin()) {
Serial.println("--");
this->it--;
}
else {
Serial.println("begin");
this->it = iter;
}
this->printMenu();
@@ -86,6 +85,8 @@ void Menu::right() {
selectedEntry->getMenu()->setParentMenu(this);
}
selectedEntry->runAction();
if (selectedEntry->getIsMenu())
selectedEntry->getMenu()->down();
}
void Menu::left() {