Upgraded LCDMenuLib2 to 2.1.2.

pull/32/head
Holger Wirtz 4 years ago
parent b1b47c2574
commit 1a38fb0d5b
  1. 4
      UI.hpp
  2. 6
      third-party/LCDMenuLib2/examples/00_beginners/LCDML_000_serialMonitor/LCDML_000_serialMonitor.ino
  3. 2
      third-party/LCDMenuLib2/examples/00_beginners/LCDML_000_serialMonitor/LCDML_control.ino
  4. 20
      third-party/LCDMenuLib2/examples/00_beginners/LCDML_000_serialMonitor/LCDML_display_menu.ino
  5. 6
      third-party/LCDMenuLib2/examples/00_beginners/LCDML_001_liquidCrystal/LCDML_001_liquidCrystal.ino
  6. 2
      third-party/LCDMenuLib2/examples/00_beginners/LCDML_001_liquidCrystal/LCDML_control.ino
  7. 2
      third-party/LCDMenuLib2/examples/00_beginners/LCDML_001_liquidCrystal/LCDML_display_dynFunction.ino
  8. 41
      third-party/LCDMenuLib2/examples/00_beginners/LCDML_001_liquidCrystal/LCDML_display_menu.ino
  9. 2
      third-party/LCDMenuLib2/examples/01_backend/LCDML_010_simpleThread/LCDML_control.ino
  10. 2
      third-party/LCDMenuLib2/examples/01_backend/LCDML_011_TaskScheduler/LCDML_control.ino
  11. 2
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_020_filelist/LCDML_control.ino
  12. 2
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_021_dynUpdatedContent/LCDML_control.ino
  13. 2
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_022_multiLanguage/LCDML_control.ino
  14. 2
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_023_multiLanguage_small/LCDML_control.ino
  15. 2
      third-party/LCDMenuLib2/examples/03_displaytypes/gfx/LCDML_adafruit_gfx_ssd1306/LCDML_control.ino
  16. 2
      third-party/LCDMenuLib2/examples/03_displaytypes/gfx/LCDML_adafruit_gfx_st7735/LCDML_control.ino
  17. 2
      third-party/LCDMenuLib2/examples/03_displaytypes/glcd/LCDML_u8g2lib/LCDML_control.ino
  18. 2
      third-party/LCDMenuLib2/examples/03_displaytypes/glcd/LCDML_u8glib/LCDML_control.ino
  19. 2
      third-party/LCDMenuLib2/examples/03_displaytypes/lcd/LCDML_i2c_display_20x4/LCDML_control.ino
  20. 2
      third-party/LCDMenuLib2/examples/03_displaytypes/lcd/LCDML_liquidcrystal_20x4/LCDML_control.ino
  21. 1
      third-party/LCDMenuLib2/keywords.txt
  22. 2
      third-party/LCDMenuLib2/library.properties
  23. 249
      third-party/LCDMenuLib2/src/LCDMenuLib2.cpp
  24. 13
      third-party/LCDMenuLib2/src/LCDMenuLib2.h
  25. 17
      third-party/LCDMenuLib2/src/LCDMenuLib2_macros.h

@ -309,6 +309,10 @@ void setup_debug_message(void) {
lcd.print(F("* DEBUG MODE *"));
lcd.setCursor(1, 1);
lcd.print(F("ENABLE CONSOLE"));
delay(300);
lcd.setCursor(1, 1);
lcd.print(_LCDML_VERSION);
lcd.print(F(" "));
}
#endif

@ -19,6 +19,10 @@
// settings for LCD
#define _LCDML_DISP_cols 20
#define _LCDML_DISP_rows 4
// enable this line (set to 1) to show a header above the first menu element
// this function can be changed in LCDML_display_menu tab
#define _LCDML_DSIP_use_header 0
// *********************************************************************
// Prototypes
@ -31,7 +35,7 @@
// Objects
// *********************************************************************
LCDMenuLib2_menu LCDML_0 (255, 0, 0, NULL, NULL); // root menu element (do not change)
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows-_LCDML_DSIP_use_header, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
// *********************************************************************
// LCDML MENU/DISP

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -39,12 +39,30 @@ void lcdml_menu_display()
LCDMenuLib2_menu *tmp;
// some limit values
uint8_t i = LCDML.MENU_getScroll();
uint8_t maxi = _LCDML_DISP_rows + i;
uint8_t maxi = (_LCDML_DISP_rows - _LCDML_DSIP_use_header) + i;
uint8_t n = 0;
// check if this element has children
if ((tmp = LCDML.MENU_getDisplayedObj()) != NULL)
{
// Display a header with the parent element name
if(_LCDML_DSIP_use_header > 0)
{
// only one line
if(LCDML.MENU_getLayer() == 0)
{
// this text is displayed when no header is available
Serial.println(F("Root Menu"));
}
else
{
// Display parent name
LCDML_getContent(content_text, LCDML.MENU_getParentID());
Serial.print(content_text);
Serial.println();
}
}
// loop to display lines
do
{

@ -21,6 +21,10 @@
#define _LCDML_DISP_cols 20
#define _LCDML_DISP_rows 4
// enable this line (set to 1) to show a header above the first menu element
// this function can be changed in LCDML_display_menu tab
#define _LCDML_DSIP_use_header 0
#define _LCDML_DISP_cfg_cursor 0x7E // cursor Symbol
#define _LCDML_DISP_cfg_scrollbar 1 // enable a scrollbar
@ -52,7 +56,7 @@
// Objects
// *********************************************************************
LCDMenuLib2_menu LCDML_0 (255, 0, 0, NULL, NULL); // root menu element (do not change)
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows-_LCDML_DSIP_use_header, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
// *********************************************************************
// LCDML MENU/DISP

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -66,7 +66,7 @@ void mDyn_para(uint8_t line)
sprintf (buf, "dynValue: %d", g_dynParam);
// use the line from function parameters
lcd.setCursor(1, line);
lcd.setCursor(1, (line + _LCDML_DSIP_use_header));
lcd.print(buf);
}

@ -31,9 +31,28 @@ void lcdml_menu_display()
LCDMenuLib2_menu *tmp;
// some limit values
uint8_t i = LCDML.MENU_getScroll();
uint8_t maxi = _LCDML_DISP_rows + i;
uint8_t maxi = (_LCDML_DISP_rows - _LCDML_DSIP_use_header) + i;
uint8_t n = 0;
// Display a header with the parent element name
if(_LCDML_DSIP_use_header > 0)
{
// only one line
if(LCDML.MENU_getLayer() == 0)
{
// this text is displayed when no header is available
lcd.setCursor(0,0);
lcd.print(F("Root Menu"));
}
else
{
// Display parent name
LCDML_getContent(content_text, LCDML.MENU_getParentID());
lcd.setCursor(0,0);
lcd.print(content_text);
}
}
// check if this element has children
if ((tmp = LCDML.MENU_getDisplayedObj()) != NULL)
{
@ -48,7 +67,7 @@ void lcdml_menu_display()
{
// display normal content
LCDML_getContent(content_text, tmp->getID());
lcd.setCursor(1, n);
lcd.setCursor(1, (n+_LCDML_DSIP_use_header));
lcd.print(content_text);
}
else
@ -69,18 +88,18 @@ void lcdml_menu_display()
if(LCDML.DISP_checkMenuCursorUpdate())
{
// init vars
uint8_t n_max = (LCDML.MENU_getChilds() >= _LCDML_DISP_rows) ? _LCDML_DISP_rows : (LCDML.MENU_getChilds());
uint8_t n_max = (LCDML.MENU_getChilds() >= (_LCDML_DISP_rows - _LCDML_DSIP_use_header)) ? (_LCDML_DISP_rows - _LCDML_DSIP_use_header) : (LCDML.MENU_getChilds());
uint8_t scrollbar_min = 0;
uint8_t scrollbar_max = LCDML.MENU_getChilds();
uint8_t scrollbar_cur_pos = LCDML.MENU_getCursorPosAbs();
uint8_t scroll_pos = ((1.*n_max * _LCDML_DISP_rows) / (scrollbar_max - 1) * scrollbar_cur_pos);
uint8_t scroll_pos = ((1.*n_max * (_LCDML_DISP_rows - _LCDML_DSIP_use_header)) / (scrollbar_max - 1) * scrollbar_cur_pos);
// display rows
for (uint8_t n = 0; n < n_max; n++)
{
//set cursor
lcd.setCursor(0, n);
lcd.setCursor(0, (n+_LCDML_DSIP_use_header));
//set cursor char
if (n == LCDML.MENU_getCursorPos()) {
@ -92,11 +111,11 @@ void lcdml_menu_display()
// delete or reset scrollbar
if (_LCDML_DISP_cfg_scrollbar == 1) {
if (scrollbar_max > n_max) {
lcd.setCursor((_LCDML_DISP_cols - 1), n);
lcd.setCursor((_LCDML_DISP_cols - 1), (n+_LCDML_DSIP_use_header));
lcd.write((uint8_t)0);
}
else {
lcd.setCursor((_LCDML_DISP_cols - 1), n);
lcd.setCursor((_LCDML_DISP_cols - 1), (n+_LCDML_DSIP_use_header));
lcd.print(' ');
}
}
@ -108,18 +127,18 @@ void lcdml_menu_display()
//set scroll position
if (scrollbar_cur_pos == scrollbar_min) {
// min pos
lcd.setCursor((_LCDML_DISP_cols - 1), 0);
lcd.setCursor((_LCDML_DISP_cols - 1), (0+_LCDML_DSIP_use_header));
lcd.write((uint8_t)1);
} else if (scrollbar_cur_pos == (scrollbar_max - 1)) {
// max pos
lcd.setCursor((_LCDML_DISP_cols - 1), (n_max - 1));
lcd.setCursor((_LCDML_DISP_cols - 1), (n_max - 1 + _LCDML_DSIP_use_header));
lcd.write((uint8_t)4);
} else {
// between
lcd.setCursor((_LCDML_DISP_cols - 1), scroll_pos / n_max);
lcd.setCursor((_LCDML_DISP_cols - 1), (scroll_pos / n_max + _LCDML_DSIP_use_header));
lcd.write((uint8_t)(scroll_pos % n_max) + 1);
}
}
}
}
}
}

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
long g_LCDML_CONTROL_button_press_time = 0;
unsigned long g_LCDML_CONTROL_button_press_time = 0;
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************

@ -135,6 +135,7 @@ _LCDML_DISP_rows_max LITERAL1
_LCDML_DISP_cols LITERAL1
_LCDML_DISP_rows LITERAL1
_LCDML_DSIP_use_header LITERAL1
_LCDML_DISP_rs LITERAL1
_LCDML_DISP_e LITERAL1
_LCDML_DISP_rw LITERAL1

@ -1,5 +1,5 @@
name=LCDMenuLib2
version=2.1.0
version=2.1.2
author=Nils Feldkaemper <nilsfeld@gmail.com>
maintainer=Nils Feldkaemper <nilsfeld@gmail.com>
sentence=Easy creation of a tree based menu with screensaver and multi layers.

@ -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;
}
}

@ -68,15 +68,17 @@
// create DBG_print makro when debugging is enabled
#ifdef LCDML_DBG
#define DBG_print(enable, str) if(enable == 1) { Serial.print(str); }
#define DBG_println(enable, str) if(enable == 1) { Serial.println(str); }
#define DBG_print(enable, str) if(enable == 1) { Serial.print(str); }
#define DBG_println(enable, str) if(enable == 1) { Serial.println(str); }
#define DBG_printstrln(enable, str, val, form) if(enable == 1) { Serial.print(str); Serial.println(val, form);}
#else
#define DBG_print(enable, str)
#define DBG_println(enable, str)
#define DBG_printstrln(enable, str, val, form)
#endif
// Version
#define _LCDML_VERSION "LCDML2 v2.1.0"
#define _LCDML_VERSION "LCDML2 v2.1.2"
// Include Arduino ios
#include "Arduino.h"
@ -200,8 +202,11 @@
uint8_t jT_mode; // contains the jumpTo Mode
uint8_t jT_id; // contains the jumpTo id
uint8_t jT_param; // contains the jumpTo param
uint8_t jT_paramOld; // contains the jumpTo param
LCDML_FuncPtr_pu8 jT_function; // contains the jumpTo function
uint8_t maxElements;
// menu intern values
uint8_t window_rows; // the maximum rows of the current windows (1 is the minium)
uint8_t window_start; // the window start
@ -251,7 +256,7 @@
LCDMenuLib2(LCDMenuLib2_menu &p_r ,const uint8_t p_rows, const uint8_t p_cols, LCDML_FuncPtr contentUpdate, LCDML_FuncPtr contentClear, LCDML_FuncPtr menuControl);
// init method
void init(void); // initialisation of the menu / reset the complete menu
void init(uint8_t); // initialisation of the menu / reset the complete menu
// loop methods
void loop(void); // call the loop_menu and the loop_control function

@ -98,17 +98,17 @@
LCDML_getCustomElementName(lcdml, var, element_id)
#define LCDML_createMenu(N)\
LCDML_createCustomLang(N, lcdml)
LCDML_createCustomLang(N, lcdml)
#define LCDML_getContent(var, id) \
LCDML_getCustomContent(lcdml, var, id)
LCDML_getCustomContent(lcdml, var, id)
//Menu Item Types
#define LCDML_addAdvanced(id, parent, child, condition, content, callback, param, settings) \
LCDML_langDef(id, lcdml, content); \
LCDMenuLib2_menu parent ## _ ## child(id, param, settings, callback, condition ); \
#define LCDML_addAdvanced(id, parent, child, p_condition, p_content, p_callback, p_param, p_settings) \
LCDML_langDef(id, lcdml, p_content); \
LCDMenuLib2_menu parent ## _ ## child(id, p_param, p_settings, p_callback, p_condition ); \
void LCDML_DISP_ ## id ## _function() { \
parent.addChild(parent ## _ ## child); \
parent.addChild(parent ## _ ## child); \
}
#define LCDML_add(id, parent, child, content, callback) \
@ -116,7 +116,7 @@
#define LCDML_setup(N)\
LCDML_DISP_initFunction(N); \
LCDML.init()
LCDML.init(N)
@ -385,6 +385,9 @@
/* ---------------------------------------
* func repeat
* ---------------------------------------

Loading…
Cancel
Save