-
-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to exit from main menu? #13
Comments
|
thanks for quick feedback! the problem in clearing the screen is that when the menu is called again in the loop, it doesn't show up until the encoder is moved again and the menu is redrawed. any suggestion to make it appear again without moving within menu options? thanks!! |
|
It works! Thanks so much! |
Hi Graziano, I have the same problem as you. Is it possible to get your code that you used to solve this. Ben |
Hi, have the same problem, when I recall the menu it keeps in the last position. How I put the cursor on the first item again? Thanks!! |
Nico, Together with a friend we came up with a solution to exit the menu and see other things on the LCD. and then go back to the menu when needed. I will try to post my code this evening. |
Here is the code I wrote for my CoG project. #include <HardwareSerial.h> LiquidCrystal lcd1(7, 6, 5, 4, 3, 2); //////////////////////////////////////////// int opdracht = 0; //aux function void Afzonderlijke_Gewichten(){opdracht = 1; lcd1.clear();} // Hier zijn alle afzonderlijke gewichten te zien float Zwaartekracht =9.81; ///////////////////////////////////////////////////////////////////////// MENU(Gewichten,"Gewichten", MENU(Calibratie,"Calibratie", MENU(Instellingen,"Instellingen", // Hier zijn de afstanden aan te passen van de onderlinge punten MENU(Metingen,"Metingen", MENU(Meten,"Metingen ", MENU(mainMenu,"Main menu", //the quadEncoder //a keyboard with only one key :D, this is the encoder button //multiple inputs allow conjugation of the quadEncoder with a single key keyboard that is the quadEncoder button //alternative to previous but now we can input from Serial too... //describing a menu output, alternatives so far are Serial or LiquidCrystal LCD ///////////////////////////////////////////////////////////////////////// lcd1.begin(20,4); pinMode(encBtn, INPUT); pinMode(sensorPin_LA, INPUT); /////////////////////////////////////////////////////////////////////////////// void loop() { float Gewicht_LA = 0; switch (opdracht){
if (opdracht != 0) { // om vanuit de berekeningen terug naar het menu te gaan if (millis() > NextTrigger){ |
Hi @benovitch, thanks for sharing your code, I have figured out how to refresh the menu when I go to a function, my question now is how I return to the top menu instead of the last item after that I have cleaned the screen. It seems always return to the last item selected when .drawn=NULL; is invoked. |
well, the philosophy was that your functions should return only when they are done, and you can have a loop on your functions... but if for some reason you wish to redraw or change focus then I've just added some new functions "redraw" and "focus" for that. https://github.com/neu-rah/ArduinoMenu/wiki/Customizing-menus |
Thanks @neu-rah!!! I will test these new code tonight. |
hi @neu-rah, I can't make .focus work in my project. .redraw(); works perfect, I don't need lcd.clear(); menu_lcd.drawn=NULL; anymore. But with .focus(); allways shows me a compile error. I don't understand whats happends. These are part of my code, tell me if a miss something or I'm doing something wrong:
menuLCD menu_lcd(lcd,20,3);//menu output device
MENU(configMenu, "Configuracion", MENU(mainMenu,"Main",
This is the error in compiler windows:
Thanks for your help!! |
focus is a member of menu, not from menuOut it should be called from a menu
or
|
With:
Not working, now its show: Reloj_Nico_v2.ino: In function 'void bklMenu()': |
well you get that variable by declaring
and it should be a global variable, no? |
I found my error, I declare MENU before void setup() but after my bklMenu() routine. I move all the MENU declaration to the top of the project. Now it works flawless!!! Thank you so much for your help!! |
great! |
Hi! Thanks for the precious update, the new functions works perfectly! Here is my code for the "Button" function, meant to let the Menu appear when keeping it pressed for more than 2 seconds: void Button(){ Serial.println(Counter-Timer1); if (current == LOW) { //Check Encoder button being kept pressed if (current == HIGH){ // reset the counter if the button is not pressed } |
thanks for sharing 👍 |
Hi, could you make an example of: I can't figure out how to use it. |
Hello! I noticed something strange happening when the menu is deactivated. If the encoder is rotated, then when the menu is re-called the encoder stream is executed in the menu. This is happening also if the menu is "focused" on a specific position through your last function. How to avoid that the encoder rotation is buffered by the encoder library? Thanks! |
yes, it should be like so as it is interrupt driven...
not sure if on the quad encoder stream or on composed stream.
still we should have deactivated (ignored) input while the menu is suspended. |
Clear, thanks! I tried with enc.flush(); and it works! :-) The Encoder stream is now ignored! Thanks!! Graziano |
menuNode::activeMenu; is a static member of class menuNode (base for all menus and fields) menuNode::activeMenu->sel; refers tho the current hilited element on the current focused menu/field |
Hello! Really great library, I tested with arduino nano+serial 1604 display and encoder with button and it works very well!
More than the issue already reported few days ago by lfc7 on menu refresh, which I haven't solved as well, I am wondering if there is any "embedded mechanism" to exit from main menu, and in such a case, how to re-enter.
Currently I have simply included an "Exit" menu option calling an exit function which prevent menu to be called in void loop().
Thanks!
The text was updated successfully, but these errors were encountered: