small refactorings
This commit is contained in:
parent
0c32b8e5b3
commit
94c37872d1
2 changed files with 17 additions and 24 deletions
|
|
@ -123,7 +123,7 @@ uint16_t ESPboyMenuGUI::menuInit(const char** menuLinesF, uint16_t menuLineColor
|
||||||
}
|
}
|
||||||
if (keyPressed&MenuGUI_PAD_ACT && menuList.menuLine[menuList.menuCurrent][0] != '-') {
|
if (keyPressed&MenuGUI_PAD_ACT && menuList.menuLine[menuList.menuCurrent][0] != '-') {
|
||||||
#ifdef buttonclicks
|
#ifdef buttonclicks
|
||||||
tone(SOUNDPIN,100,100);
|
tone(SOUNDPIN,200,10);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tft->drawRect(0, (menuList.menuCurrent+menuList.menuOffset)*MENU_SPACE_BETWEEN_LINES, 122, MENU_SPACE_BETWEEN_LINES, TFT_BLACK);
|
tft->drawRect(0, (menuList.menuCurrent+menuList.menuOffset)*MENU_SPACE_BETWEEN_LINES, 122, MENU_SPACE_BETWEEN_LINES, TFT_BLACK);
|
||||||
|
|
@ -140,7 +140,7 @@ uint16_t ESPboyMenuGUI::menuInit(const char** menuLinesF, uint16_t menuLineColor
|
||||||
}
|
}
|
||||||
if (keyPressed&MenuGUI_PAD_ESC){
|
if (keyPressed&MenuGUI_PAD_ESC){
|
||||||
#ifdef buttonclicks
|
#ifdef buttonclicks
|
||||||
tone(SOUNDPIN,100,100);
|
tone(SOUNDPIN,200,10);
|
||||||
#endif
|
#endif
|
||||||
tft->fillScreen(TFT_BLACK);
|
tft->fillScreen(TFT_BLACK);
|
||||||
return(0);
|
return(0);
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ const char *menuMain[] PROGMEM = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *menuRecord[] PROGMEM = {
|
const char *menuRecord[] PROGMEM = {
|
||||||
"-SEND", //send selected record
|
"SEND", //send selected record
|
||||||
"SHOW",
|
"SHOW",
|
||||||
"SET REPEAT",
|
"SET REPEAT",
|
||||||
"RENAME",
|
"RENAME",
|
||||||
|
|
@ -495,10 +495,7 @@ gotolabel:
|
||||||
while (!userInput) userInput = getUserInputLocal().toInt();
|
while (!userInput) userInput = getUserInputLocal().toInt();
|
||||||
if (userInput > DEFAULT_SIGNAL_REPEAT_NUMBER*10) userInput = DEFAULT_SIGNAL_REPEAT_NUMBER;
|
if (userInput > DEFAULT_SIGNAL_REPEAT_NUMBER*10) userInput = DEFAULT_SIGNAL_REPEAT_NUMBER;
|
||||||
recordStoredVector[selectedSignal-1].recordRepeatno = userInput;
|
recordStoredVector[selectedSignal-1].recordRepeatno = userInput;
|
||||||
printConsoleLocal(F("DONE"), TFT_MAGENTA, 1, 0);
|
printInfoMessage(F("DONE"));
|
||||||
while (!myESPboy.getKeys())delay(10);
|
|
||||||
while (myESPboy.getKeys())delay(10);
|
|
||||||
printConsoleLocal("", TFT_MAGENTA, 1, 0);
|
|
||||||
break;
|
break;
|
||||||
case rename_:
|
case rename_:
|
||||||
printConsoleLocal(F("Enter new name"), TFT_MAGENTA, 1, 0);
|
printConsoleLocal(F("Enter new name"), TFT_MAGENTA, 1, 0);
|
||||||
|
|
@ -508,10 +505,7 @@ gotolabel:
|
||||||
while (!userInputName.length()) userInputName = getUserInputLocal();
|
while (!userInputName.length()) userInputName = getUserInputLocal();
|
||||||
userInputName = userInputName.substring(0,18);
|
userInputName = userInputName.substring(0,18);
|
||||||
memcpy(&recordStoredVector[selectedSignal-1].recordName, userInputName.c_str(), userInputName.length()+1);
|
memcpy(&recordStoredVector[selectedSignal-1].recordName, userInputName.c_str(), userInputName.length()+1);
|
||||||
printConsoleLocal(F("DONE"), TFT_MAGENTA, 1, 0);
|
printInfoMessage(F("DONE"));
|
||||||
while (!myESPboy.getKeys())delay(10);
|
|
||||||
while (myESPboy.getKeys())delay(10);
|
|
||||||
printConsoleLocal("", TFT_MAGENTA, 1, 0);
|
|
||||||
break;
|
break;
|
||||||
case delete_:
|
case delete_:
|
||||||
recordStoredVector.erase(recordStoredVector.begin()+(selectedSignal-1));
|
recordStoredVector.erase(recordStoredVector.begin()+(selectedSignal-1));
|
||||||
|
|
@ -533,6 +527,15 @@ gotolabel:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void printInfoMessage(String messageToPrint){
|
||||||
|
toggleDisplayModeLocal(1);
|
||||||
|
printConsoleLocal(messageToPrint, TFT_MAGENTA, 1, 0);
|
||||||
|
while (!myESPboy.getKeys())delay(10);
|
||||||
|
while (myESPboy.getKeys())delay(10);
|
||||||
|
printConsoleLocal("", TFT_MAGENTA, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void loop(){
|
void loop(){
|
||||||
switch (menuInitLocal(menuMain, TFT_YELLOW, TFT_BLUE, TFT_BLUE)){
|
switch (menuInitLocal(menuMain, TFT_YELLOW, TFT_BLUE, TFT_BLUE)){
|
||||||
case listen_:
|
case listen_:
|
||||||
|
|
@ -545,29 +548,19 @@ void loop(){
|
||||||
if(!recordStoredVector.empty())
|
if(!recordStoredVector.empty())
|
||||||
listofstored_f();
|
listofstored_f();
|
||||||
else{
|
else{
|
||||||
toggleDisplayModeLocal(1);
|
printInfoMessage(F("Records not found"));}
|
||||||
printConsoleLocal(F("Records not found"), TFT_MAGENTA, 1, 0);
|
|
||||||
while (!myESPboy.getKeys())delay(10);
|
|
||||||
while (myESPboy.getKeys())delay(10);
|
|
||||||
printConsoleLocal("", TFT_MAGENTA, 1, 0);}
|
|
||||||
break;
|
break;
|
||||||
case saveall_:
|
case saveall_:
|
||||||
toggleDisplayModeLocal(1);
|
toggleDisplayModeLocal(1);
|
||||||
printConsoleLocal(F("Save to EEPROM..."), TFT_MAGENTA, 1, 0);
|
printConsoleLocal(F("Save to EEPROM..."), TFT_MAGENTA, 1, 0);
|
||||||
writeEEPROMall();
|
writeEEPROMall();
|
||||||
printConsoleLocal(F("DONE"), TFT_MAGENTA, 1, 0);
|
printInfoMessage(F("DONE"));
|
||||||
while (!myESPboy.getKeys())delay(10);
|
|
||||||
while (myESPboy.getKeys())delay(10);
|
|
||||||
printConsoleLocal("", TFT_MAGENTA, 1, 0);
|
|
||||||
break;
|
break;
|
||||||
case clearall_:
|
case clearall_:
|
||||||
toggleDisplayModeLocal(1);
|
toggleDisplayModeLocal(1);
|
||||||
printConsoleLocal(F("Clearing memory..."), TFT_MAGENTA, 1, 0);
|
printConsoleLocal(F("Clearing memory..."), TFT_MAGENTA, 1, 0);
|
||||||
recordStoredVector.clear();
|
recordStoredVector.clear();
|
||||||
printConsoleLocal(F("DONE"), TFT_MAGENTA, 1, 0);
|
printInfoMessage(F("DONE"));
|
||||||
while (!myESPboy.getKeys())delay(10);
|
|
||||||
while (myESPboy.getKeys())delay(10);
|
|
||||||
printConsoleLocal("", TFT_MAGENTA, 1, 0);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
delay(150);
|
delay(150);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue