|
|
|
@ -46,14 +46,12 @@ LCDMenuLib2::LCDMenuLib2(LCDMenuLib2_menu &p_r, const uint8_t p_rows, const uint |
|
|
|
|
rootMenu = &p_r; |
|
|
|
|
curMenu = rootMenu; |
|
|
|
|
|
|
|
|
|
window_rows = p_rows; |
|
|
|
|
window_rows = p_rows; |
|
|
|
|
// the cols variable is removed
|
|
|
|
|
|
|
|
|
|
callback_contentUpdate = contentUpdate; // callback update content
|
|
|
|
|
callback_contentClear = contentClear; // callback clear content
|
|
|
|
|
callback_menuControl = menuControl; // callback buttons
|
|
|
|
|
|
|
|
|
|
init();
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* ******************************************************************** */ |
|
|
|
@ -63,7 +61,7 @@ LCDMenuLib2::LCDMenuLib2(LCDMenuLib2_menu &p_r, const uint8_t p_rows, const uint |
|
|
|
|
/* ******************************************************************** */ |
|
|
|
|
|
|
|
|
|
/* ******************************************************************** */ |
|
|
|
|
void LCDMenuLib2::init() |
|
|
|
|
void LCDMenuLib2::init(uint8_t p_maxElements) |
|
|
|
|
/* ******************************************************************** */ |
|
|
|
|
{ |
|
|
|
|
// init some variables
|
|
|
|
@ -80,6 +78,8 @@ void LCDMenuLib2::init() |
|
|
|
|
menu_timer = 0; |
|
|
|
|
menu_default_time = 100000000; |
|
|
|
|
|
|
|
|
|
maxElements = p_maxElements; |
|
|
|
|
|
|
|
|
|
// reset all buttons
|
|
|
|
|
BT_resetAll(); |
|
|
|
|
|
|
|
|
@ -299,6 +299,9 @@ void LCDMenuLib2::loop_menu(void) |
|
|
|
|
// ============================================
|
|
|
|
|
if(bitRead(REG_special, _LCDML_REG_special_jumpTo_enabled)) |
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpTo.. / LCDML.OTHER_setCursorTo... - is active")); |
|
|
|
|
|
|
|
|
|
MENU_enScroll(); |
|
|
|
|
|
|
|
|
|
bitClear(REG_special, _LCDML_REG_special_jumpTo_enabled);
|
|
|
|
@ -310,9 +313,12 @@ void LCDMenuLib2::loop_menu(void) |
|
|
|
|
// got to root
|
|
|
|
|
if(activMenu != NULL) |
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpTo.. / LCDML.OTHER_setCursorTo... - close active function")); |
|
|
|
|
|
|
|
|
|
// this function called be recursive (only once)
|
|
|
|
|
// set this bit to call the FUNC_close function when the goRoot function is called
|
|
|
|
|
bitSet(REG_MenuFunction, _LCDML_REG_MenuFunction_end); |
|
|
|
|
bitSet(REG_MenuFunction, _LCDML_REG_MenuFunction_end);
|
|
|
|
|
|
|
|
|
|
if(bitRead(REG_MenuFunction, _LCDML_REG_MenuFunction_close_active) == false) |
|
|
|
|
{ |
|
|
|
@ -325,23 +331,29 @@ void LCDMenuLib2::loop_menu(void) |
|
|
|
|
|
|
|
|
|
BT_resetAll(); |
|
|
|
|
|
|
|
|
|
activMenu = NULL; |
|
|
|
|
activMenu = NULL;
|
|
|
|
|
|
|
|
|
|
bitClear(REG_MenuFunction, _LCDML_REG_MenuFunction_close_active);
|
|
|
|
|
bitClear(REG_MenuFunction, _LCDML_REG_MenuFunction_end); |
|
|
|
|
bitClear(REG_MenuFunction, _LCDML_REG_MenuFunction_setup); |
|
|
|
|
|
|
|
|
|
bitClear(REG_special, _LCDML_REG_special_disable_screensaver); |
|
|
|
|
|
|
|
|
|
bitClear(REG_special, _LCDML_REG_special_disable_screensaver);
|
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// do nothing
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// reset the old parameter from the closed function / this parameter is set when a new jumpTo.. function is called
|
|
|
|
|
jT_paramOld = 0; |
|
|
|
|
|
|
|
|
|
// set the menu to root
|
|
|
|
|
MENU_goRoot(); |
|
|
|
|
|
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpTo.. / LCDML.OTHER_setCursorTo... - searching element")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// search element
|
|
|
|
|
switch(jT_mode) |
|
|
|
|
{ |
|
|
|
@ -358,17 +370,60 @@ void LCDMenuLib2::loop_menu(void) |
|
|
|
|
default: |
|
|
|
|
// error
|
|
|
|
|
break; |
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//maxElements;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
New Search function
|
|
|
|
|
(only id based) |
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
//tmp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check element handling
|
|
|
|
|
if(found == true) |
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpTo.. / LCDML.OTHER_setCursorTo... - element found")); |
|
|
|
|
|
|
|
|
|
// get element to to open
|
|
|
|
|
tmp = curMenu->getChild(cursor_obj_pos);
|
|
|
|
|
|
|
|
|
|
// reset the search action to do some normal handlings
|
|
|
|
|
bitClear(REG_control, _LCDML_REG_control_search_display); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch(jT_mode) |
|
|
|
|
{ |
|
|
|
@ -462,6 +517,8 @@ void LCDMenuLib2::loop_menu(void) |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// do nothing
|
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpTo.. / LCDML.OTHER_setCursorTo... - nothing found")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bitClear(REG_control, _LCDML_REG_control_search_display); |
|
|
|
@ -497,7 +554,7 @@ void LCDMenuLib2::loop_menu(void) |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// close the running function
|
|
|
|
|
// close the running function
|
|
|
|
|
|
|
|
|
|
// set this bit to call the FUNC_close function when the goRoot function is called
|
|
|
|
|
bitSet(REG_MenuFunction, _LCDML_REG_MenuFunction_end); |
|
|
|
@ -512,6 +569,9 @@ void LCDMenuLib2::loop_menu(void) |
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
activMenu = NULL; |
|
|
|
|
|
|
|
|
|
// reset the custom parameter
|
|
|
|
|
jT_param = 0;
|
|
|
|
|
|
|
|
|
|
bitClear(REG_MenuFunction, _LCDML_REG_MenuFunction_close_active); |
|
|
|
|
bitClear(REG_special, _LCDML_REG_special_disable_screensaver); |
|
|
|
@ -533,7 +593,7 @@ void LCDMenuLib2::loop_menu(void) |
|
|
|
|
{ |
|
|
|
|
MENU_goBack(); |
|
|
|
|
} |
|
|
|
|
goBackCnt = 0;
|
|
|
|
|
goBackCnt = 0;
|
|
|
|
|
|
|
|
|
|
// check if the cursor stands on the correct possition
|
|
|
|
|
if(layer == 0) |
|
|
|
@ -548,18 +608,18 @@ void LCDMenuLib2::loop_menu(void) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
{
|
|
|
|
|
// on going back, when the parent element is hidden, the condition is checken
|
|
|
|
|
// if the element is hidden, go to the next parent element and so on ...
|
|
|
|
|
while(layer > 0 && MENU_countChilds(curMenu) == 0) |
|
|
|
|
{ |
|
|
|
|
MENU_goBack(); |
|
|
|
|
} |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// only update the content when no jump function is active
|
|
|
|
|
DISP_update(); |
|
|
|
|
DISP_update();
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -573,9 +633,9 @@ void LCDMenuLib2::loop_menu(void) |
|
|
|
|
// check update handling
|
|
|
|
|
// ============================================
|
|
|
|
|
if(bitRead(REG_update, _LCDML_REG_update_menu) == true || bitRead(REG_update, _LCDML_REG_update_cursor) == true) |
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
if(activMenu == NULL) |
|
|
|
|
{ |
|
|
|
|
{
|
|
|
|
|
if(bitRead(REG_special, _LCDML_REG_special_disable_scroll) == false) |
|
|
|
|
{ |
|
|
|
|
// clear button status from scrolling
|
|
|
|
@ -591,7 +651,7 @@ void LCDMenuLib2::loop_menu(void) |
|
|
|
|
BT_resetAll(); |
|
|
|
|
}
|
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
{
|
|
|
|
|
// do nothing
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1047,7 +1107,7 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state) |
|
|
|
|
rollover = true;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(bitRead(REG_control, _LCDML_REG_control_rollover) && rollover == true && child_cnt > window_rows) |
|
|
|
|
if(bitRead(REG_control, _LCDML_REG_control_rollover) && rollover == true) |
|
|
|
|
{ |
|
|
|
|
// rollover the menu
|
|
|
|
|
if((tmp = curMenu->getChild(0)) != NULL) |
|
|
|
@ -1135,7 +1195,7 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state) |
|
|
|
|
rollover = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(bitRead(REG_control, _LCDML_REG_control_rollover) && rollover == true && child_cnt > window_rows) |
|
|
|
|
if(bitRead(REG_control, _LCDML_REG_control_rollover) && rollover == true) |
|
|
|
|
{ |
|
|
|
|
cursor_obj_pos = 0; |
|
|
|
|
cursor_pos_abs = 0; |
|
|
|
@ -1571,7 +1631,11 @@ void LCDMenuLib2::FUNC_call(void) |
|
|
|
|
|
|
|
|
|
if(activMenu != NULL) |
|
|
|
|
{ |
|
|
|
|
if(jT_param > 0) |
|
|
|
|
if(jT_paramOld > 0) |
|
|
|
|
{ |
|
|
|
|
activMenu->callback(jT_paramOld); |
|
|
|
|
} |
|
|
|
|
else if(jT_param > 0) |
|
|
|
|
{ |
|
|
|
|
activMenu->callback(jT_param); |
|
|
|
|
} |
|
|
|
@ -2125,56 +2189,133 @@ boolean LCDMenuLib2::OTHER_searchFunction(LCDMenuLib2_menu &p_m, uint8_t mod |
|
|
|
|
void LCDMenuLib2::OTHER_jumpToFunc(LCDML_FuncPtr_pu8 p_search, uint8_t p_para) |
|
|
|
|
/* ******************************************************************** */ |
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToFunc")); |
|
|
|
|
|
|
|
|
|
bitSet(REG_special, _LCDML_REG_special_jumpTo_enabled); |
|
|
|
|
jT_mode = 0; |
|
|
|
|
jT_id = 0; |
|
|
|
|
jT_param = p_para; |
|
|
|
|
jT_function = p_search; |
|
|
|
|
|
|
|
|
|
if(bitRead(REG_special, _LCDML_REG_special_jumpTo_enabled) == true) |
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToFunc - is still activ")); |
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToFunc - start")); |
|
|
|
|
|
|
|
|
|
// enable jump to Func
|
|
|
|
|
bitSet(REG_special, _LCDML_REG_special_jumpTo_enabled); |
|
|
|
|
jT_mode = 0; |
|
|
|
|
jT_id = 0; |
|
|
|
|
|
|
|
|
|
if(activMenu != NULL) |
|
|
|
|
{ |
|
|
|
|
jT_paramOld = jT_param; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
jT_paramOld = 0; |
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jT_param = p_para; |
|
|
|
|
jT_function = p_search; |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* ******************************************************************** */ |
|
|
|
|
void LCDMenuLib2::OTHER_jumpToID(uint8_t p_id, uint8_t p_para) |
|
|
|
|
/* ******************************************************************** */ |
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToID")); |
|
|
|
|
if(bitRead(REG_special, _LCDML_REG_special_jumpTo_enabled) == true) |
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToID - is still activ")); |
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToID - start")); |
|
|
|
|
|
|
|
|
|
// enable jump to ID
|
|
|
|
|
bitSet(REG_special, _LCDML_REG_special_jumpTo_enabled); |
|
|
|
|
jT_mode = 1; |
|
|
|
|
jT_id = p_id; |
|
|
|
|
|
|
|
|
|
if(activMenu != NULL) |
|
|
|
|
{ |
|
|
|
|
jT_paramOld = jT_param; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
jT_paramOld = 0; |
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bitSet(REG_special, _LCDML_REG_special_jumpTo_enabled); |
|
|
|
|
jT_mode = 1; |
|
|
|
|
jT_id = p_id; |
|
|
|
|
jT_param = p_para; |
|
|
|
|
jT_function = NULL; |
|
|
|
|
jT_param = p_para; |
|
|
|
|
jT_function = NULL; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* ******************************************************************** */ |
|
|
|
|
void LCDMenuLib2::OTHER_setCursorToFunc(LCDML_FuncPtr_pu8 p_search) |
|
|
|
|
/* ******************************************************************** */ |
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_setCursorToFunc")); |
|
|
|
|
|
|
|
|
|
bitSet(REG_special, _LCDML_REG_special_jumpTo_enabled); |
|
|
|
|
jT_mode = 2; |
|
|
|
|
jT_id = 0; |
|
|
|
|
jT_param = 0; |
|
|
|
|
jT_function = p_search; |
|
|
|
|
if(bitRead(REG_special, _LCDML_REG_special_jumpTo_enabled) == true) |
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_setCursorToFunc - is still activ")); |
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_setCursorToFunc - start")); |
|
|
|
|
|
|
|
|
|
// enable jump to Func
|
|
|
|
|
bitSet(REG_special, _LCDML_REG_special_jumpTo_enabled); |
|
|
|
|
jT_mode = 2; |
|
|
|
|
jT_id = 0; |
|
|
|
|
|
|
|
|
|
if(activMenu != NULL) |
|
|
|
|
{ |
|
|
|
|
jT_paramOld = jT_param; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
jT_paramOld = 0; |
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jT_param = 0; |
|
|
|
|
jT_function = p_search; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* ******************************************************************** */ |
|
|
|
|
void LCDMenuLib2::OTHER_setCursorToID(uint8_t p_id) |
|
|
|
|
/* ******************************************************************** */ |
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_setCursorToID")); |
|
|
|
|
|
|
|
|
|
bitSet(REG_special, _LCDML_REG_special_jumpTo_enabled); |
|
|
|
|
jT_mode = 3; |
|
|
|
|
jT_id = p_id; |
|
|
|
|
jT_param = 0; |
|
|
|
|
jT_function = NULL;
|
|
|
|
|
if(bitRead(REG_special, _LCDML_REG_special_jumpTo_enabled) == true) |
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_setCursorToID - is still activ")); |
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{ |
|
|
|
|
// debug information
|
|
|
|
|
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_setCursorToID - start")); |
|
|
|
|
|
|
|
|
|
// enable jump to Func
|
|
|
|
|
bitSet(REG_special, _LCDML_REG_special_jumpTo_enabled); |
|
|
|
|
jT_mode = 3; |
|
|
|
|
jT_id = p_id; |
|
|
|
|
|
|
|
|
|
if(activMenu != NULL) |
|
|
|
|
{ |
|
|
|
|
jT_paramOld = jT_param; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
jT_paramOld = 0; |
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jT_param = 0; |
|
|
|
|
jT_function = NULL;
|
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|