bug fix static in motor und speed
This commit is contained in:
+7
-6
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user