diff --git a/src/LiquidLine.cpp b/src/LiquidLine.cpp index 6805026..3e9a54c 100644 --- a/src/LiquidLine.cpp +++ b/src/LiquidLine.cpp @@ -26,7 +26,7 @@ SOFTWARE. //const char NOTHING[] = " "; ///< 20 spaces, used to clear the display. -void print_me(uint16_t address) { +void print_me(uintptr_t address) { DEBUG(F("Line (0x")); DEBUG2(address, OCT); DEBUG(F("): ")); return; address = address; @@ -34,7 +34,7 @@ void print_me(uint16_t address) { bool LiquidLine::attach_function(uint8_t number, void (*function)(void)) { - print_me((uint16_t)this); + print_me((uintptr_t)this); if (number <= MAX_FUNCTIONS) { _function[number - 1] = function; DEBUG(F("Attached function ")); DEBUGLN(number); @@ -48,7 +48,7 @@ bool LiquidLine::attach_function(uint8_t number, void (*function)(void)) { } bool LiquidLine::set_focusPosition(Position position, uint8_t column, uint8_t row) { - print_me((uint16_t)this); + print_me((uintptr_t)this); if (position <= Position::CUSTOM) { _focusPosition = position; _focusColumn = column; diff --git a/src/LiquidMenu.cpp b/src/LiquidMenu.cpp index eba9780..d5f6148 100644 --- a/src/LiquidMenu.cpp +++ b/src/LiquidMenu.cpp @@ -63,7 +63,7 @@ LiquidMenu::LiquidMenu(LiquidCrystal &liquidCrystal, LiquidScreen &liquidScreen1 } bool LiquidMenu::add_screen(LiquidScreen &liquidScreen) { - print_me((uint16_t)this); + print_me((uintptr_t)this); if (_screenCount < MAX_SCREENS) { _p_liquidScreen[_screenCount] = &liquidScreen; DEBUG(F("Added a new screen (")); DEBUG(_screenCount); DEBUGLN(F(")")); @@ -136,7 +136,7 @@ bool LiquidMenu::change_screen(LiquidScreen &p_liquidScreen) { // _p_liquidMenu[_currentMenu]->_p_liquidCrystal->clear(); for (uint8_t s = 0; s < _screenCount; s++) { _p_liquidCrystal->clear(); - if ((uint16_t)&p_liquidScreen == (uint16_t) & (*_p_liquidScreen[s])) { + if ((uintptr_t)&p_liquidScreen == (uintptr_t) & (*_p_liquidScreen[s])) { _currentScreen = s; update(); DEBUG(F("Switched to screen (")); @@ -145,7 +145,7 @@ bool LiquidMenu::change_screen(LiquidScreen &p_liquidScreen) { return true; } } - DEBUG(F("Invalid request for screen change to ")); DEBUGLN((uint16_t)&p_liquidScreen); + DEBUG(F("Invalid request for screen change to ")); DEBUGLN((uintptr_t)&p_liquidScreen); return false; } @@ -164,7 +164,7 @@ void LiquidMenu::switch_focus(bool forward) { } bool LiquidMenu::set_focusPosition(Position position) { - print_me((uint16_t)this); + print_me((uintptr_t)this); if (position == Position::CUSTOM) { DEBUGLN(F("Can't set a custom focus position for the whole menu at once")); return false; diff --git a/src/LiquidMenu.h b/src/LiquidMenu.h index 7439dac..a4f81a5 100644 --- a/src/LiquidMenu.h +++ b/src/LiquidMenu.h @@ -168,7 +168,7 @@ Used for convenience when printing the class's address for indentification. @param address - number to be printed */ -void print_me(uint16_t address); +void print_me(uintptr_t address); /// Represents the individual lines printed on the display. @@ -291,7 +291,7 @@ class LiquidLine { */ template bool add_variable(T &variable) { - print_me((uint16_t)this); + print_me((uintptr_t)this); if (_variableCount < MAX_VARIABLES) { _variable[_variableCount] = (void*)&variable; _variableType[_variableCount] = recognizeType(variable); diff --git a/src/LiquidScreen.cpp b/src/LiquidScreen.cpp index 7693ca5..b36f261 100644 --- a/src/LiquidScreen.cpp +++ b/src/LiquidScreen.cpp @@ -50,7 +50,7 @@ LiquidScreen::LiquidScreen(LiquidLine &liquidLine1, LiquidLine &liquidLine2, } bool LiquidScreen::add_line(LiquidLine &liquidLine) { - print_me((uint16_t)this); + print_me((uintptr_t)this); if (_lineCount < MAX_LINES) { _p_liquidLine[_lineCount] = &liquidLine; DEBUG(F("Added a new line (")); DEBUG(_lineCount); DEBUGLN(F(")")); @@ -64,7 +64,7 @@ bool LiquidScreen::add_line(LiquidLine &liquidLine) { } bool LiquidScreen::set_focusPosition(Position position) { - print_me((uint16_t)this); + print_me((uintptr_t)this); if (position == Position::CUSTOM) { DEBUGLN(F("Can't set focus position to 'CUSTOM' for the whole screen at once")); return false; @@ -96,7 +96,7 @@ void LiquidScreen::print(LiquidCrystal *p_liquidCrystal) const { } void LiquidScreen::switch_focus(bool forward) { - print_me((uint16_t)this); + print_me((uintptr_t)this); do { if (forward) { if (_focus < _lineCount) { diff --git a/src/LiquidSystem.cpp b/src/LiquidSystem.cpp index 04ef82f..32daf67 100644 --- a/src/LiquidSystem.cpp +++ b/src/LiquidSystem.cpp @@ -51,7 +51,7 @@ LiquidSystem::LiquidSystem(LiquidMenu &liquidMenu1, LiquidMenu &liquidMenu2, bool LiquidSystem::add_menu(LiquidMenu &liquidMenu) { - print_me((uint16_t)this); + print_me((uintptr_t)this); if (_menuCount < MAX_MENUS) { _p_liquidMenu[_menuCount] = &liquidMenu; DEBUG(F("Added a new menu (")); DEBUG(_menuCount); DEBUGLN(F(")")); @@ -67,14 +67,14 @@ bool LiquidSystem::add_menu(LiquidMenu &liquidMenu) { bool LiquidSystem::change_menu(LiquidMenu &p_liquidMenu) { // _p_liquidMenu[_currentMenu]->_p_liquidCrystal->clear(); for (uint8_t m = 0; m < _menuCount; m++) { - if ((uint16_t)&p_liquidMenu == (uint16_t) & (*_p_liquidMenu[m])) { + if ((uintptr_t)&p_liquidMenu == (uintptr_t) & (*_p_liquidMenu[m])) { _currentMenu = m; DEBUG(F("Menu changed to ")); DEBUGLN(_currentMenu); update(); return true; } } - DEBUG(F("Invalid request for menu change to ")); DEBUGLN((uint16_t)&p_liquidMenu); + DEBUG(F("Invalid request for menu change to ")); DEBUGLN((uintptr_t)&p_liquidMenu); return false; }