Open floxia opened 8 months ago
Hi, i will check this. At the moment i try to reproduce your case.
The LCDMenuLib needs a fix function structure. You are not calling the setup part.
Try this code please:
void mFunc_jump_to_ID(uint8_t param)
{
if(LCDML.FUNC_setup()) // ****** SETUP *********
{
// remmove compiler warnings when the param variable is not used:
LCDML_UNUSED(param);
}
if(LCDML.FUNC_loop()) // ****** LOOP *********
{
// loop function, can be run in a loop when LCDML_DISP_triggerMenu(xx) is set
LCDML.OTHER_setCursorToID(4);
}
if(LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
}
}
Thanks for your kind reply. I have updated the functions as per your answer in your example sketch LCDML_000_serialMonitor.ino but it did not work.
I have added the function at the bottom of the LCDML_display_menuFunction.ino file:
void mFunc_jump_to_ID(uint8_t param)
{
if(LCDML.FUNC_setup()) // ****** SETUP *********
{
// remove compiler warnings when the param variable is not used:
LCDML_UNUSED(param);
}
if(LCDML.FUNC_loop()) // ****** LOOP *********
{
// loop function, can be run in a loop when LCDML_DISP_triggerMenu(xx) is set
LCDML.OTHER_setCursorToID(11);
}
if(LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
}
}
And added the call back function to LCDML_000_serialMonitor.ino:
LCDML_add (0 , LCDML_0 , 1 , "Information" , mFunc_information); // this menu function can be found on "LCDML_display_menuFunction" tab
LCDML_add (1 , LCDML_0 , 2 , "Time info" , mFunc_timer_info); // this menu function can be found on "LCDML_display_menuFunction" tab
LCDML_add (2 , LCDML_0 , 3 , "Program" , mFunc_jump_to_ID); // NULL = no menu function
LCDML_add (3 , LCDML_0_3 , 1 , "Program 1" , NULL); // NULL = no menu function
LCDML_add (4 , LCDML_0_3_1 , 1 , "P1 dummy" , NULL); // NULL = no menu function
LCDML_add (5 , LCDML_0_3_1 , 2 , "P1 Settings" , NULL); // NULL = no menu function
LCDML_add (6 , LCDML_0_3_1_2 , 1 , "Warm" , NULL); // NULL = no menu function
LCDML_add (7 , LCDML_0_3_1_2 , 2 , "Cold" , NULL); // NULL = no menu function
LCDML_add (8 , LCDML_0_3_1_2 , 3 , "Back" , mFunc_back); // this menu function can be found on "LCDML_display_menuFunction" tab
LCDML_add (9 , LCDML_0_3_1 , 3 , "Back" , mFunc_back); // this menu function can be found on "LCDML_display_menuFunction" tab
LCDML_add (10 , LCDML_0_3 , 2 , "Program 2" , mFunc_p2); // this menu function can be found on "LCDML_display_menuFunction" tab
LCDML_add (11 , LCDML_0_3 , 3 , "Back" , mFunc_back); // this menu function can be found on "LCDML_display_menuFunction" tab
LCDML_add (12 , LCDML_0 , 4 , "Special" , NULL); // NULL = no menu function
LCDML_add (13 , LCDML_0_4 , 1 , "Go to Root" , mFunc_goToRootMenu); // this menu function can be found on "LCDML_display_menuFunction" tab
LCDML_add (14 , LCDML_0_4 , 2 , "Jump to Time info", mFunc_jumpTo_timer_info); // this menu function can be found on "LCDML_display_menuFunction" tab
LCDML_add (15 , LCDML_0_4 , 3 , "Back" , mFunc_back); // this menu function can be found on "LCDML_display_menuFunction" tab
I am expecting when pressing the enter button here:
22:39:37.834 -> ===========================================
22:39:37.867 -> ================ Menu ====================
22:39:37.899 -> ===========================================
22:39:37.964 -> ( ) Information
22:39:37.964 -> ( ) Time info
22:39:37.998 -> (x) Program
22:39:37.998 -> ( ) Special
To see:
22:39:39.042 -> ===========================================
22:39:39.108 -> ================ Menu ====================
22:39:39.141 -> ===========================================
22:39:39.206 -> ( ) Program 1
22:39:39.206 -> ( ) Program 2
22:39:39.252 -> (x) Back
Although, at the moment, it just opens the submenu like:
22:39:39.042 -> ===========================================
22:39:39.108 -> ================ Menu ====================
22:39:39.141 -> ===========================================
22:39:39.206 -> (x) Program 1
22:39:39.206 -> ( ) Program 2
22:39:39.252 -> ( ) Back
Perhaps using your example sketch will make it easier for you to troubleshoot this.
Thank you again.
Hello, today i find some time to check your point. You can only set menu functions to elements which have no sub elements.
When i set your function to an element without childs it works normaly.
LCDML_add (0 , LCDML_0 , 1 , "Information" , mFunc_information); // this menu function can be found on "LCDML_display_menuFunction" tab LCDML_add (1 , LCDML_0 , 2 , "Time info" , mFunc_timer_info); // this menu function can be found on "LCDML_display_menuFunction" tab LCDML_add (2 , LCDML_0 , 3 , "Program" , NULL); // NULL = no menu function LCDML_add (3 , LCDML_0_3 , 1 , "Program 1" , NULL); // NULL = no menu function LCDML_add (4 , LCDML_0_3_1 , 1 , "P1 dummy" , mFunc_jump_to_ID); // NULL = no menu function
What is your usecase to use an element with childs as menu function without showing the childs ?
Hi Jomelo, thanks for your excellent work in creating this fantastic library. I am facing an issue, and you might know what I might be doing wrong!
I am attempting to jump to a desired menu item ID using the callback function:
I have also tried the callback function below with the same results.
In this menu structure:
The above function, when called, should jump straight to ID #4 in this case:
LCDML._add(4, LCDML._0_2, 3, "Item 2, Sub 3", NULL);
Although the function only works if it is not called from a parent but only from a child, as I suspect the parent is already bound to "open the submenu function", I cannot call any callback function from a menu item with submenus.
Therefore, for example,
This works:
LCDML._add(2, LCDML._0_2, 1, "Item 2, Sub 1", mFunc_jump_to_ID);
This does not work:
LCDML._add(1, LCDML._0, 2, "Item 2", mFunc_jump_to_ID);
I am not sure what I am missing here, I am also not seeing any other settings to call a function when the submenu is opened which would be useful to jump to the desired item. I am trying to jump to the desired value of each submenu previously stored elsewhere, showing the current setting selected.
Any ideas on how to solve this would be greatly appreciated.