41 #include <LiquidCrystal.h> 43 #include <avr/pgmspace.h> 49 #include "serial_debugging.h" 51 #ifndef LiquidCrystal_h 52 #warning "LiquidCrystal library is required!" 63 BOOL = 1, BOOLEAN = 1,
65 UINT8_T = 9, BYTE = 9,
70 FLOAT = 50, DOUBLE = 50,
74 PROG_CONST_CHAR_PTR = 65,
83 RIGHT = 1, NORMAL = 1,
201 : _row(row), _column(column), _focusRow(row - 1),
202 _focusColumn(column - 1), _focusPosition(
Position::NORMAL),
203 _variableCount(0), _focusable(false) {
205 _variable[i] =
nullptr;
206 _variableType[i] = DataType::NOT_USED;
219 template <
typename A>
222 add_variable(variableA);
234 template <
typename A,
typename B>
236 A &variableA, B &variableB)
238 add_variable(variableB);
251 template <
typename A,
typename B,
typename C>
253 A &variableA, B &variableB, C &variableC)
254 :
LiquidLine(column, row, variableA, variableB) {
255 add_variable(variableC);
269 template <
typename A,
typename B,
typename C,
typename D>
271 A &variableA, B &variableB, C &variableC, D &variableD)
272 :
LiquidLine(column, row, variableA, variableB, variableC) {
273 add_variable(variableD);
296 template <
typename T>
300 _variable[_variableCount] = (
void*)&variable;
302 DEBUG(F(
"Added variable '")); DEBUG(variable); DEBUGLN(F(
"'"));
306 DEBUG(F(
"Adding variable ")); DEBUG(variable);
307 DEBUGLN(F(
" failed, edit LiquidMenu_config.h to allow for more variables"));
330 bool attach_function(uint8_t number,
void (*
function)(
void));
350 uint8_t column = 0, uint8_t row = 0);
362 bool set_asGlyph(uint8_t number);
373 bool set_asProgmem(uint8_t number);
386 void print(LiquidCrystal *p_liquidCrystal,
bool isFocused);
396 void print_variable(LiquidCrystal *p_liquidCrystal, uint8_t number);
407 bool call_function(uint8_t number)
const;
409 uint8_t _row, _column, _focusRow, _focusColumn;
411 uint8_t _variableCount;
522 void hide(
bool hide);
533 void print(LiquidCrystal *p_liquidCrystal)
const;
590 LiquidMenu(LiquidCrystal &liquidCrystal, uint8_t startingScreen = 1);
600 uint8_t startingScreen = 1);
611 LiquidScreen &liquidScreen2, uint8_t startingScreen = 1);
624 uint8_t startingScreen = 1);
638 LiquidScreen &liquidScreen4, uint8_t startingScreen = 1);
793 LiquidCrystal *_p_liquidCrystal;
795 uint8_t _screenCount;
796 uint8_t _currentScreen;
832 uint8_t startingMenu = 1);
842 LiquidMenu &liquidMenu3, uint8_t startingMenu = 1);
854 uint8_t startingMenu = 1);
895 void operator++(
int);
898 void previous_screen();
910 void operator--(
int);
925 bool change_screen(uint8_t number);
940 bool operator=(uint8_t number);
949 void switch_focus(
bool forward =
true);
966 bool set_focusPosition(
Position position);
996 bool call_function(uint8_t number)
const;
1002 void update()
const;
1011 void softUpdate()
const;
1018 uint8_t _currentMenu;
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC)
Constructor for three variables/constants.
Definition: LiquidMenu.h:252
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:811
Represents the individual lines printed on the display.
Definition: LiquidMenu.h:186
void update() const
Prints the current screen to the display.
Definition: LiquidSystem.cpp:140
void softUpdate() const
Prints the current screen to the display (without clearing).
Definition: LiquidSystem.cpp:144
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:297
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:235
Represents a screen shown on the display.
Definition: LiquidMenu.h:428
bool set_focusSymbol(Position position, uint8_t symbol[8])
Changes the focus indicator's symbol.
Definition: LiquidSystem.cpp:129
bool call_function(uint8_t number) const
Calls an attached function specified by the number.
Definition: LiquidSystem.cpp:133
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:200
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC, D &variableD)
Constructor for four variables/constants.
Definition: LiquidMenu.h:270
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:220
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