Update all Menus to new Print function
This commit is contained in:
+12
-20
@@ -31,26 +31,18 @@ bool Menu::isInSubmenu() {
|
||||
}
|
||||
|
||||
void Menu::printMenu() {
|
||||
if (this->lcd) {
|
||||
lcd->clear();
|
||||
lcd->setCursor(0, 0);
|
||||
lcd->print("-> ");
|
||||
lcd->print((**this->selectedEntry).getName());
|
||||
lcd->setCursor(0, 1);
|
||||
std::list<MenuAction*>::iterator iter = this->selectedEntry;
|
||||
iter++;
|
||||
if (iter != this->entrys.end()) {
|
||||
lcd->print((**iter).getName());
|
||||
} else
|
||||
lcd->print((*this->entrys.begin())->getName());
|
||||
}
|
||||
std::cout << std::endl;
|
||||
for (std::list<MenuAction*>::iterator iter = this->entrys.begin(); iter != this->entrys.end(); iter++) {
|
||||
if (this->selectedEntry == iter)
|
||||
std::cout << " " << (**iter).getName() << std::endl;
|
||||
else
|
||||
std::cout << (**iter).getName() << std::endl;
|
||||
}
|
||||
std::list<MenuAction*>::iterator iter = this->selectedEntry;
|
||||
|
||||
String lineOne = "-> ";
|
||||
String lineTwo = "";
|
||||
|
||||
lineOne.concat((**iter).getName());
|
||||
iter++;
|
||||
if (iter != this->entrys.end()) {
|
||||
lineTwo.concat((**iter).getName());
|
||||
} else
|
||||
lineTwo.concat((*this->entrys.begin())->getName());
|
||||
|
||||
this->inSubmenu = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -196,16 +196,16 @@ void MenuIntInput::printMenu() {
|
||||
|
||||
if (this->currentPosition == 0 && this->length == 1) {
|
||||
// No arrow
|
||||
sprintf(bufferName, " %s ", this->names + 12 * this->currentPosition);
|
||||
sprintf(bufferName, " %s ", this->names + MAX_NAME_LENGTH * this->currentPosition);
|
||||
} else if (this->currentPosition > 0 && this->length - 1 == this->currentPosition) {
|
||||
// Left arrow only
|
||||
sprintf(bufferName, "< %s ", this->names + 12 * this->currentPosition);
|
||||
sprintf(bufferName, "< %s ", this->names + MAX_NAME_LENGTH * this->currentPosition);
|
||||
} else if (this->currentPosition == 0 && this->length > 1) {
|
||||
// Right arrow only
|
||||
sprintf(bufferName, " %s >", this->names + 12 * this->currentPosition);
|
||||
sprintf(bufferName, " %s >", this->names + MAX_NAME_LENGTH * this->currentPosition);
|
||||
} else {
|
||||
// Both arrow
|
||||
sprintf(bufferName, "< %s >", this->names + 12 * this->currentPosition);
|
||||
sprintf(bufferName, "< %s >", this->names + MAX_NAME_LENGTH * this->currentPosition);
|
||||
}
|
||||
|
||||
char bufferValue[17];
|
||||
@@ -214,12 +214,5 @@ void MenuIntInput::printMenu() {
|
||||
else
|
||||
sprintf(bufferValue, " -> 0");
|
||||
|
||||
if (this->lcd) {
|
||||
lcd->clear();
|
||||
lcd->setCursor(0, 0);
|
||||
lcd->print(bufferName);
|
||||
lcd->setCursor(0, 1);
|
||||
lcd->print(bufferValue);
|
||||
}
|
||||
std::cout << bufferName << " : " << bufferValue << std::endl;
|
||||
this->print(bufferName, bufferValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user