Upgraded LCDMenuLib2 to 2.1.2.

pull/32/head
Holger Wirtz 5 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. 39
      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. 165
      third-party/LCDMenuLib2/src/LCDMenuLib2.cpp
  24. 9
      third-party/LCDMenuLib2/src/LCDMenuLib2.h
  25. 11
      third-party/LCDMenuLib2/src/LCDMenuLib2_macros.h

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

@ -20,6 +20,10 @@
#define _LCDML_DISP_cols 20 #define _LCDML_DISP_cols 20
#define _LCDML_DISP_rows 4 #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 // Prototypes
// ********************************************************************* // *********************************************************************
@ -31,7 +35,7 @@
// Objects // Objects
// ********************************************************************* // *********************************************************************
LCDMenuLib2_menu LCDML_0 (255, 0, 0, NULL, NULL); // root menu element (do not change) 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 // LCDML MENU/DISP

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

@ -39,12 +39,30 @@ void lcdml_menu_display()
LCDMenuLib2_menu *tmp; LCDMenuLib2_menu *tmp;
// some limit values // some limit values
uint8_t i = LCDML.MENU_getScroll(); 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; uint8_t n = 0;
// check if this element has children // check if this element has children
if ((tmp = LCDML.MENU_getDisplayedObj()) != NULL) 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 // loop to display lines
do do
{ {

@ -21,6 +21,10 @@
#define _LCDML_DISP_cols 20 #define _LCDML_DISP_cols 20
#define _LCDML_DISP_rows 4 #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_cursor 0x7E // cursor Symbol
#define _LCDML_DISP_cfg_scrollbar 1 // enable a scrollbar #define _LCDML_DISP_cfg_scrollbar 1 // enable a scrollbar
@ -52,7 +56,7 @@
// Objects // Objects
// ********************************************************************* // *********************************************************************
LCDMenuLib2_menu LCDML_0 (255, 0, 0, NULL, NULL); // root menu element (do not change) 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 // LCDML MENU/DISP

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

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

@ -31,9 +31,28 @@ void lcdml_menu_display()
LCDMenuLib2_menu *tmp; LCDMenuLib2_menu *tmp;
// some limit values // some limit values
uint8_t i = LCDML.MENU_getScroll(); 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; 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 // check if this element has children
if ((tmp = LCDML.MENU_getDisplayedObj()) != NULL) if ((tmp = LCDML.MENU_getDisplayedObj()) != NULL)
{ {
@ -48,7 +67,7 @@ void lcdml_menu_display()
{ {
// display normal content // display normal content
LCDML_getContent(content_text, tmp->getID()); LCDML_getContent(content_text, tmp->getID());
lcd.setCursor(1, n); lcd.setCursor(1, (n+_LCDML_DSIP_use_header));
lcd.print(content_text); lcd.print(content_text);
} }
else else
@ -69,18 +88,18 @@ void lcdml_menu_display()
if(LCDML.DISP_checkMenuCursorUpdate()) if(LCDML.DISP_checkMenuCursorUpdate())
{ {
// init vars // 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_min = 0;
uint8_t scrollbar_max = LCDML.MENU_getChilds(); uint8_t scrollbar_max = LCDML.MENU_getChilds();
uint8_t scrollbar_cur_pos = LCDML.MENU_getCursorPosAbs(); 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 // display rows
for (uint8_t n = 0; n < n_max; n++) for (uint8_t n = 0; n < n_max; n++)
{ {
//set cursor //set cursor
lcd.setCursor(0, n); lcd.setCursor(0, (n+_LCDML_DSIP_use_header));
//set cursor char //set cursor char
if (n == LCDML.MENU_getCursorPos()) { if (n == LCDML.MENU_getCursorPos()) {
@ -92,11 +111,11 @@ void lcdml_menu_display()
// delete or reset scrollbar // delete or reset scrollbar
if (_LCDML_DISP_cfg_scrollbar == 1) { if (_LCDML_DISP_cfg_scrollbar == 1) {
if (scrollbar_max > n_max) { 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); lcd.write((uint8_t)0);
} }
else { else {
lcd.setCursor((_LCDML_DISP_cols - 1), n); lcd.setCursor((_LCDML_DISP_cols - 1), (n+_LCDML_DSIP_use_header));
lcd.print(' '); lcd.print(' ');
} }
} }
@ -108,15 +127,15 @@ void lcdml_menu_display()
//set scroll position //set scroll position
if (scrollbar_cur_pos == scrollbar_min) { if (scrollbar_cur_pos == scrollbar_min) {
// min pos // 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); lcd.write((uint8_t)1);
} else if (scrollbar_cur_pos == (scrollbar_max - 1)) { } else if (scrollbar_cur_pos == (scrollbar_max - 1)) {
// max pos // 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); lcd.write((uint8_t)4);
} else { } else {
// between // 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); 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); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

@ -249,7 +249,7 @@ void lcdml_menu_control(void)
Encoder ENCODER(encoder_A_pin, encoder_B_pin); 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; bool g_LCDML_CONTROL_button_prev = HIGH;
// ********************************************************************* // *********************************************************************

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

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

@ -52,8 +52,6 @@ LCDMenuLib2::LCDMenuLib2(LCDMenuLib2_menu &p_r, const uint8_t p_rows, const uint
callback_contentUpdate = contentUpdate; // callback update content callback_contentUpdate = contentUpdate; // callback update content
callback_contentClear = contentClear; // callback clear content callback_contentClear = contentClear; // callback clear content
callback_menuControl = menuControl; // callback buttons 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 // init some variables
@ -80,6 +78,8 @@ void LCDMenuLib2::init()
menu_timer = 0; menu_timer = 0;
menu_default_time = 100000000; menu_default_time = 100000000;
maxElements = p_maxElements;
// reset all buttons // reset all buttons
BT_resetAll(); BT_resetAll();
@ -299,6 +299,9 @@ void LCDMenuLib2::loop_menu(void)
// ============================================ // ============================================
if(bitRead(REG_special, _LCDML_REG_special_jumpTo_enabled)) 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(); MENU_enScroll();
bitClear(REG_special, _LCDML_REG_special_jumpTo_enabled); bitClear(REG_special, _LCDML_REG_special_jumpTo_enabled);
@ -310,6 +313,9 @@ void LCDMenuLib2::loop_menu(void)
// got to root // got to root
if(activMenu != NULL) 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) // this function called be recursive (only once)
// set this bit to call the FUNC_close function when the goRoot function is called // 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);
@ -332,16 +338,22 @@ void LCDMenuLib2::loop_menu(void)
bitClear(REG_MenuFunction, _LCDML_REG_MenuFunction_setup); bitClear(REG_MenuFunction, _LCDML_REG_MenuFunction_setup);
bitClear(REG_special, _LCDML_REG_special_disable_screensaver); bitClear(REG_special, _LCDML_REG_special_disable_screensaver);
} }
else else
{ {
// do nothing // 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 // set the menu to root
MENU_goRoot(); MENU_goRoot();
// debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpTo.. / LCDML.OTHER_setCursorTo... - searching element"));
// search element // search element
switch(jT_mode) switch(jT_mode)
{ {
@ -359,17 +371,60 @@ void LCDMenuLib2::loop_menu(void)
// error // error
break; break;
} }
//maxElements;
/*
New Search function
(only id based)
*/
//tmp
// check element handling // check element handling
if(found == true) 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 // get element to to open
tmp = curMenu->getChild(cursor_obj_pos); tmp = curMenu->getChild(cursor_obj_pos);
// reset the search action to do some normal handlings // reset the search action to do some normal handlings
bitClear(REG_control, _LCDML_REG_control_search_display); bitClear(REG_control, _LCDML_REG_control_search_display);
switch(jT_mode) switch(jT_mode)
{ {
case 0: // jumpToFunc case 0: // jumpToFunc
@ -462,6 +517,8 @@ void LCDMenuLib2::loop_menu(void)
else else
{ {
// do nothing // 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); bitClear(REG_control, _LCDML_REG_control_search_display);
@ -513,6 +570,9 @@ void LCDMenuLib2::loop_menu(void)
activMenu = NULL; activMenu = NULL;
// reset the custom parameter
jT_param = 0;
bitClear(REG_MenuFunction, _LCDML_REG_MenuFunction_close_active); bitClear(REG_MenuFunction, _LCDML_REG_MenuFunction_close_active);
bitClear(REG_special, _LCDML_REG_special_disable_screensaver); bitClear(REG_special, _LCDML_REG_special_disable_screensaver);
bitClear(REG_MenuFunction, _LCDML_REG_MenuFunction_end); bitClear(REG_MenuFunction, _LCDML_REG_MenuFunction_end);
@ -1047,7 +1107,7 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
rollover = true; 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 // rollover the menu
if((tmp = curMenu->getChild(0)) != NULL) if((tmp = curMenu->getChild(0)) != NULL)
@ -1135,7 +1195,7 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
rollover = true; 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_obj_pos = 0;
cursor_pos_abs = 0; cursor_pos_abs = 0;
@ -1571,7 +1631,11 @@ void LCDMenuLib2::FUNC_call(void)
if(activMenu != NULL) if(activMenu != NULL)
{ {
if(jT_param > 0) if(jT_paramOld > 0)
{
activMenu->callback(jT_paramOld);
}
else if(jT_param > 0)
{ {
activMenu->callback(jT_param); activMenu->callback(jT_param);
} }
@ -2124,58 +2188,135 @@ boolean LCDMenuLib2::OTHER_searchFunction(LCDMenuLib2_menu &p_m, uint8_t mod
/* ******************************************************************** */ /* ******************************************************************** */
void LCDMenuLib2::OTHER_jumpToFunc(LCDML_FuncPtr_pu8 p_search, uint8_t p_para) void LCDMenuLib2::OTHER_jumpToFunc(LCDML_FuncPtr_pu8 p_search, uint8_t p_para)
/* ******************************************************************** */ /* ******************************************************************** */
{
if(bitRead(REG_special, _LCDML_REG_special_jumpTo_enabled) == true)
{ {
// debug information // debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToFunc")); 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); bitSet(REG_special, _LCDML_REG_special_jumpTo_enabled);
jT_mode = 0; jT_mode = 0;
jT_id = 0; jT_id = 0;
if(activMenu != NULL)
{
jT_paramOld = jT_param;
}
else
{
jT_paramOld = 0;
}
jT_param = p_para; jT_param = p_para;
jT_function = p_search; jT_function = p_search;
} }
}
/* ******************************************************************** */ /* ******************************************************************** */
void LCDMenuLib2::OTHER_jumpToID(uint8_t p_id, uint8_t p_para) void LCDMenuLib2::OTHER_jumpToID(uint8_t p_id, uint8_t p_para)
/* ******************************************************************** */ /* ******************************************************************** */
{
if(bitRead(REG_special, _LCDML_REG_special_jumpTo_enabled) == true)
{ {
// debug information // debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToID")); 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); bitSet(REG_special, _LCDML_REG_special_jumpTo_enabled);
jT_mode = 1; jT_mode = 1;
jT_id = p_id; jT_id = p_id;
if(activMenu != NULL)
{
jT_paramOld = jT_param;
}
else
{
jT_paramOld = 0;
}
jT_param = p_para; jT_param = p_para;
jT_function = NULL; jT_function = NULL;
} }
}
/* ******************************************************************** */ /* ******************************************************************** */
void LCDMenuLib2::OTHER_setCursorToFunc(LCDML_FuncPtr_pu8 p_search) void LCDMenuLib2::OTHER_setCursorToFunc(LCDML_FuncPtr_pu8 p_search)
/* ******************************************************************** */ /* ******************************************************************** */
{
if(bitRead(REG_special, _LCDML_REG_special_jumpTo_enabled) == true)
{ {
// debug information // debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_setCursorToFunc")); 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); bitSet(REG_special, _LCDML_REG_special_jumpTo_enabled);
jT_mode = 2; jT_mode = 2;
jT_id = 0; jT_id = 0;
if(activMenu != NULL)
{
jT_paramOld = jT_param;
}
else
{
jT_paramOld = 0;
}
jT_param = 0; jT_param = 0;
jT_function = p_search; jT_function = p_search;
} }
}
/* ******************************************************************** */ /* ******************************************************************** */
void LCDMenuLib2::OTHER_setCursorToID(uint8_t p_id) void LCDMenuLib2::OTHER_setCursorToID(uint8_t p_id)
/* ******************************************************************** */ /* ******************************************************************** */
{
if(bitRead(REG_special, _LCDML_REG_special_jumpTo_enabled) == true)
{ {
// debug information // debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_setCursorToID")); 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); bitSet(REG_special, _LCDML_REG_special_jumpTo_enabled);
jT_mode = 3; jT_mode = 3;
jT_id = p_id; jT_id = p_id;
if(activMenu != NULL)
{
jT_paramOld = jT_param;
}
else
{
jT_paramOld = 0;
}
jT_param = 0; jT_param = 0;
jT_function = NULL; jT_function = NULL;
} }
}
/* ******************************************************************** */ /* ******************************************************************** */

@ -70,13 +70,15 @@
#ifdef LCDML_DBG #ifdef LCDML_DBG
#define DBG_print(enable, str) if(enable == 1) { Serial.print(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_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 #else
#define DBG_print(enable, str) #define DBG_print(enable, str)
#define DBG_println(enable, str) #define DBG_println(enable, str)
#define DBG_printstrln(enable, str, val, form)
#endif #endif
// Version // Version
#define _LCDML_VERSION "LCDML2 v2.1.0" #define _LCDML_VERSION "LCDML2 v2.1.2"
// Include Arduino ios // Include Arduino ios
#include "Arduino.h" #include "Arduino.h"
@ -200,8 +202,11 @@
uint8_t jT_mode; // contains the jumpTo Mode uint8_t jT_mode; // contains the jumpTo Mode
uint8_t jT_id; // contains the jumpTo id uint8_t jT_id; // contains the jumpTo id
uint8_t jT_param; // contains the jumpTo param 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 LCDML_FuncPtr_pu8 jT_function; // contains the jumpTo function
uint8_t maxElements;
// menu intern values // menu intern values
uint8_t window_rows; // the maximum rows of the current windows (1 is the minium) uint8_t window_rows; // the maximum rows of the current windows (1 is the minium)
uint8_t window_start; // the window start 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); 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 // 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 // loop methods
void loop(void); // call the loop_menu and the loop_control function void loop(void); // call the loop_menu and the loop_control function

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

Loading…
Cancel
Save