41 #include <LiquidCrystal.h> 45 #include "serial_debugging.h" 47 #ifndef LiquidCrystal_h 48 #warning "LiquidCrystal library is required!" 59 BOOL = 1, BOOLEAN = 1,
61 UINT8_T = 9, BYTE = 9,
66 FLOAT = 50, DOUBLE = 50,
78 RIGHT = 1, NORMAL = 1,
197 : _row(row), _column(column), _focusRow(row - 1),
198 _focusColumn(column - 1), _focusPosition(
Position::NORMAL),
199 _variableCount(0), _focusable(false) {
201 _variable[i] =
nullptr;
202 _variableType[i] = DataType::NOT_USED;
215 template <
typename A>
218 add_variable(variableA);
230 template <
typename A,
typename B>
232 A &variableA, B &variableB)
234 add_variable(variableB);
247 template <
typename A,
typename B,
typename C>
249 A &variableA, B &variableB, C &variableC)
250 :
LiquidLine(column, row, variableA, variableB) {
251 add_variable(variableC);
265 template <
typename A,
typename B,
typename C,
typename D>
267 A &variableA, B &variableB, C &variableC, D &variableD)
268 :
LiquidLine(column, row, variableA, variableB, variableC) {
269 add_variable(variableD);
292 template <
typename T>
296 _variable[_variableCount] = (
void*)&variable;
298 DEBUG(F(
"Added variable '")); DEBUG(variable); DEBUGLN(F(
"'"));
302 DEBUG(F(
"Adding variable ")); DEBUG(variable);
303 DEBUGLN(F(
" failed, edit LiquidMenu_config.h to allow for more variables"));
326 bool attach_function(uint8_t number,
void (*
function)(
void));
346 uint8_t column = 0, uint8_t row = 0);
358 bool set_asGlyph(uint8_t number);
371 void print(LiquidCrystal *p_liquidCrystal,
bool isFocused);
381 void print_variable(LiquidCrystal *p_liquidCrystal, uint8_t number);
392 bool call_function(uint8_t number)
const;
394 uint8_t _row, _column, _focusRow, _focusColumn;
396 uint8_t _variableCount;
507 void hide(
bool hide);
518 void print(LiquidCrystal *p_liquidCrystal)
const;
575 LiquidMenu(LiquidCrystal &liquidCrystal, uint8_t startingScreen = 1);
585 uint8_t startingScreen = 1);
596 LiquidScreen &liquidScreen2, uint8_t startingScreen = 1);
609 uint8_t startingScreen = 1);
623 LiquidScreen &liquidScreen4, uint8_t startingScreen = 1);
778 LiquidCrystal *_p_liquidCrystal;
780 uint8_t _screenCount;
781 uint8_t _currentScreen;
817 uint8_t startingMenu = 1);
827 LiquidMenu &liquidMenu3, uint8_t startingMenu = 1);
839 uint8_t startingMenu = 1);
880 void operator++(
int);
883 void previous_screen();
895 void operator--(
int);
910 bool change_screen(uint8_t number);
925 bool operator=(uint8_t number);
934 void switch_focus(
bool forward =
true);
951 bool set_focusPosition(
Position position);
981 bool call_function(uint8_t number)
const;
996 void softUpdate()
const;
1003 uint8_t _currentMenu;
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC)
Constructor for three variables/constants.
Definition: LiquidMenu.h:248
void operator--()
Switches to the previous screen.
Definition: LiquidSystem.cpp:97
bool operator=(LiquidScreen &p_liquidScreen)
Switches to the specified screen.
Definition: LiquidSystem.cpp:117
Represents a collection of menus forming a menu system.
Definition: LiquidMenu.h:796
void softUpdate() const
Prints the current screen to the display (without clearing).
Definition: LiquidSystem.cpp:144
Represents the individual lines printed on the display.
Definition: LiquidMenu.h:182
void switch_focus(bool forward=true)
Switches the focus.
Definition: LiquidSystem.cpp:121
bool add_variable(T &variable)
Adds a variable to the line.
Definition: LiquidMenu.h:293
void previous_screen()
Switches to the previous screen.
Definition: LiquidSystem.cpp:93
bool set_focusPosition(Position position)
Sets the focus position for the whole menu at once.
Definition: LiquidSystem.cpp:125
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB)
Constructor for two variables/constants.
Definition: LiquidMenu.h:231
Represents a screen shown on the display.
Definition: LiquidMenu.h:413
bool set_focusSymbol(Position position, uint8_t symbol[8])
Changes the focus indicator's symbol.
Definition: LiquidSystem.cpp:129
bool change_screen(LiquidScreen &p_liquidScreen)
Switches to the specified screen.
Definition: LiquidSystem.cpp:109
LiquidLine(uint8_t column, uint8_t row)
The main constructor.
Definition: LiquidMenu.h:196
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC, D &variableD)
Constructor for four variables/constants.
Definition: LiquidMenu.h:266
void update() const
Prints the current screen to the display.
Definition: LiquidSystem.cpp:140
void next_screen()
Switches to the next screen.
Definition: LiquidSystem.cpp:81
LiquidLine(uint8_t column, uint8_t row, A &variableA)
Constructor for one variable/constant.
Definition: LiquidMenu.h:216
bool call_function(uint8_t number) const
Calls an attached function specified by the number.
Definition: LiquidSystem.cpp:133
void operator++()
Switches to the next screen.
Definition: LiquidSystem.cpp:85
bool set_focusPosition(Position position)
Sets the focus position for the whole screen at once.
Definition: LiquidScreen.cpp:66