44 #include <avr/pgmspace.h> 53 #include <LiquidCrystal_I2C.h> 54 #define DisplayClass LiquidCrystal_I2C 55 #pragma message ("LiquidMenu: Configured for I2C. Edit 'LiquidMenu_config.h' file to change it.") 57 #include <LiquidCrystal.h> 58 #define DisplayClass LiquidCrystal 59 #pragma message ("LiquidMenu: Configured for Parallel. Edit 'LiquidMenu_config.h' file to change it.") 63 #warning "LiquidMenu: Debugging messages are enabled." 66 typedef bool (*boolFnPtr)();
67 typedef int8_t (*int8tFnPtr)();
68 typedef uint8_t (*uint8tFnPtr)();
69 typedef int16_t (*int16tFnPtr)();
70 typedef uint16_t (*uint16tFnPtr)();
71 typedef int32_t (*int32tFnPtr)();
72 typedef uint32_t (*uint32tFnPtr)();
73 typedef float (*floatFnPtr)();
74 typedef double (*doubleFnPtr)();
75 typedef char (*charFnPtr)();
76 typedef char * (*charPtrFnPtr)();
77 typedef const char * (*constcharPtrFnPtr)();
87 BOOL = 1, BOOLEAN = 1,
89 UINT8_T = 9, BYTE = 9,
94 FLOAT = 50, DOUBLE = 50,
98 PROG_CONST_CHAR_PTR = 65,
100 BOOL_GETTER = 201, BOOLEAN_GETTER = 201,
102 UINT8_T_GETTER = 209, BYTE_GETTER = 209,
103 INT16_T_GETTER = 216,
104 UINT16_T_GETTER = 217,
105 INT32_T_GETTER = 232,
106 UINT32_T_GETTER = 233,
107 FLOAT_GETTER = 240, DOUBLE_GETTER = 240,
109 CHAR_PTR_GETTER = 251,
110 CONST_CHAR_PTR_GETTER = 252
118 RIGHT = 1, NORMAL = 1,
320 : _row(row), _column(column), _focusRow(row - 1),
321 _focusColumn(column - 1), _focusPosition(
Position::NORMAL),
322 _variableCount(0), _focusable(false) {
324 _variable[i] =
nullptr;
325 _variableType[i] = DataType::NOT_USED;
330 _floatDecimalPlaces = 2;
339 template <
typename A>
352 template <
typename A,
typename B>
354 A &variableA, B &variableB)
367 template <
typename A,
typename B,
typename C>
369 A &variableA, B &variableB, C &variableC)
370 :
LiquidLine(column, row, variableA, variableB) {
383 template <
typename A,
typename B,
typename C,
typename D>
385 A &variableA, B &variableB, C &variableC, D &variableD)
386 :
LiquidLine(column, row, variableA, variableB, variableC) {
408 template <
typename T>
410 print_me(reinterpret_cast<uintptr_t>(
this));
412 _variable[_variableCount] = (
void*)&variable;
414 # if LIQUIDMENU_DEBUG 415 DEBUG(F(
"Added variable "));
418 if ((uint8_t)_variableType[_variableCount] < 200) {
419 DEBUG(reinterpret_cast<uintptr_t>(variable));
DEBUGLN(F(
""));
425 # if LIQUIDMENU_DEBUG 426 DEBUG(F(
"Adding variable "));
429 if ((uint8_t)_variableType[_variableCount] < 200) {
430 DEBUG(reinterpret_cast<uintptr_t>(variable));
433 DEBUGLN(F(
" failed, edit LiquidMenu_config.h to allow for more variables"));
483 uint8_t column = 0, uint8_t row = 0);
519 void print(DisplayClass *p_liquidCrystal,
bool isFocused);
529 void print_variable(DisplayClass *p_liquidCrystal, uint8_t number);
540 bool call_function(uint8_t number)
const;
542 uint8_t _row, _column, _focusRow, _focusColumn;
544 uint8_t _floatDecimalPlaces;
545 uint8_t _variableCount;
680 void print(DisplayClass *p_liquidCrystal)
const;
707 uint8_t _displayLineCount;
738 LiquidMenu(DisplayClass &liquidCrystal, uint8_t startingScreen = 1);
748 uint8_t startingScreen = 1);
759 LiquidScreen &liquidScreen2, uint8_t startingScreen = 1);
772 uint8_t startingScreen = 1);
786 LiquidScreen &liquidScreen4, uint8_t startingScreen = 1);
957 DisplayClass *_p_liquidCrystal;
959 uint8_t _screenCount;
960 uint8_t _currentScreen;
996 uint8_t startingMenu = 1);
1006 LiquidMenu &liquidMenu3, uint8_t startingMenu = 1);
1018 uint8_t startingMenu = 1);
1190 uint8_t _currentMenu;
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC)
Constructor for three variables/constants.
Definition: LiquidMenu.h:368
void operator--()
Switches to the previous screen.
Definition: LiquidSystem.cpp:109
LiquidSystem(uint8_t startingMenu=1)
The main constructor.
Definition: LiquidSystem.cpp:32
bool operator=(LiquidScreen &p_liquidScreen)
Switches to the specified screen.
Definition: LiquidSystem.cpp:129
Represents a collection of menus forming a menu system.
Definition: LiquidMenu.h:975
Represents the individual lines printed on the display.
Definition: LiquidMenu.h:305
void update() const
Prints the current screen to the display.
Definition: LiquidSystem.cpp:152
void softUpdate() const
Prints the current screen to the display (without clearing).
Definition: LiquidSystem.cpp:156
bool set_asGlyph(uint8_t number)
Converts a byte variable into a glyph index.
Definition: LiquidLine.cpp:77
bool set_asProgmem(uint8_t number)
Converts a const char pointer variable into const char pointer PROGMEM one.
Definition: LiquidLine.cpp:89
void switch_focus(bool forward=true)
Switches the focus.
Definition: LiquidSystem.cpp:133
bool add_variable(T &variable)
Adds a variable to the line.
Definition: LiquidMenu.h:409
void set_displayLineCount(uint8_t lineCount)
Specifies the line size of the display (required for scrolling).
Definition: LiquidScreen.cpp:91
void previous_screen()
Switches to the previous screen.
Definition: LiquidSystem.cpp:105
bool set_focusPosition(Position position)
Sets the focus position for the whole menu at once.
Definition: LiquidSystem.cpp:137
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB)
Constructor for two variables/constants.
Definition: LiquidMenu.h:353
Represents a screen shown on the display.
Definition: LiquidMenu.h:562
bool set_focusSymbol(Position position, uint8_t symbol[8])
Changes the focus indicator's symbol.
Definition: LiquidSystem.cpp:141
bool call_function(uint8_t number) const
Calls an attached function specified by the number.
Definition: LiquidSystem.cpp:145
bool change_screen(LiquidScreen &p_liquidScreen)
Switches to the specified screen.
Definition: LiquidSystem.cpp:121
bool add_menu(LiquidMenu &liquidMenu)
Adds a LiquidMenu object to the menu system.
Definition: LiquidSystem.cpp:58
bool add_line(LiquidLine &liquidLine)
Adds a LiquidLine object to the screen.
Definition: LiquidScreen.cpp:57
LiquidLine(uint8_t column, uint8_t row)
The main constructor.
Definition: LiquidMenu.h:319
void hide(bool hide)
Hides the screen.
Definition: LiquidScreen.cpp:96
bool change_menu(LiquidMenu &p_liquidMenu)
Switches to the specified menu.
Definition: LiquidSystem.cpp:73
LiquidScreen()
The main constructor.
Definition: LiquidScreen.cpp:32
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC, D &variableD)
Constructor for four variables/constants.
Definition: LiquidMenu.h:384
bool attach_function(uint8_t number, void(*function)(void))
Attaches a callback function to the line.
Definition: LiquidLine.cpp:39
bool set_focusPosition(Position position, uint8_t column=0, uint8_t row=0)
Configures the focus indicator position for the line.
Definition: LiquidLine.cpp:58
void set_decimalPlaces(uint8_t decimalPlaces)
Sets the decimal places for floating point variables.
Definition: LiquidLine.cpp:53
void next_screen()
Switches to the next screen.
Definition: LiquidSystem.cpp:93
LiquidScreen * get_currentScreen() const
Returns a reference to the current screen.
Definition: LiquidSystem.cpp:89
LiquidLine(uint8_t column, uint8_t row, A &variableA)
Constructor for one variable/constant.
Definition: LiquidMenu.h:340
void operator++()
Switches to the next screen.
Definition: LiquidSystem.cpp:97
bool set_focusPosition(Position position)
Sets the focus position for the whole screen at once.
Definition: LiquidScreen.cpp:77