diff --git a/esp-vent-main/inc/LiquidCrystal.h b/esp-vent-main/inc/LiquidCrystal.h index 4f416e5..1223057 100644 --- a/esp-vent-main/inc/LiquidCrystal.h +++ b/esp-vent-main/inc/LiquidCrystal.h @@ -6,7 +6,6 @@ #include #include - // commands #define LCD_CLEARDISPLAY 0x01 #define LCD_RETURNHOME 0x02 @@ -75,6 +74,10 @@ public: void command (uint8_t); void print (std::string const &s); void print (const char *s); + void printOnLineOne (const char *s); + void printOnLineTwo (const char *s); + void printOnLineOne (std::string const &s); + void printOnLineTwo (std::string const &s); private: void send (uint8_t, uint8_t); diff --git a/esp-vent-main/src/LiquidCrystal.cpp b/esp-vent-main/src/LiquidCrystal.cpp index a44748b..9c4282a 100644 --- a/esp-vent-main/src/LiquidCrystal.cpp +++ b/esp-vent-main/src/LiquidCrystal.cpp @@ -187,6 +187,31 @@ LiquidCrystal::print (const char *s) } } +void +LiquidCrystal::printOnLineOne (const char *s) +{ + setCursor (0, 0); + print (s); +} +void +LiquidCrystal::printOnLineTwo (const char *s) +{ + setCursor (0, 1); + print (s); +} + +void +LiquidCrystal::printOnLineOne (std::string const &s) +{ + printOnLineOne (s.c_str ()); +} + +void +LiquidCrystal::printOnLineTwo (std::string const &s) +{ + printOnLineTwo (s.c_str ()); +} + void LiquidCrystal::setCursor (uint8_t col, uint8_t row) { diff --git a/esp-vent-main/src/StateHandler/StateHandler.cpp b/esp-vent-main/src/StateHandler/StateHandler.cpp index 7b4ef7e..10ae473 100644 --- a/esp-vent-main/src/StateHandler/StateHandler.cpp +++ b/esp-vent-main/src/StateHandler/StateHandler.cpp @@ -59,10 +59,8 @@ StateHandler::displaySet (size_t mode) } _lcd->clear (); - _lcd->setCursor (0, 0); - _lcd->print (line_up); - _lcd->setCursor (0, 1); - _lcd->print (line_down); + _lcd->printOnLineOne (line_up); + _lcd->printOnLineTwo (line_down); } unsigned int diff --git a/esp-vent-main/src/esp-vent-main.cpp b/esp-vent-main/src/esp-vent-main.cpp index d115ee8..705116b 100644 --- a/esp-vent-main/src/esp-vent-main.cpp +++ b/esp-vent-main/src/esp-vent-main.cpp @@ -36,8 +36,8 @@ main (void) DigitalIoPin d6 (1, 3, false, true, false); DigitalIoPin d7 (0, 0, false, true, false); LiquidCrystal lcd (&rs, &en, &d4, &d5, &d6, &d7); - lcd.setCursor (0, 0); - lcd.print ("Vent-Machine"); + lcd.clear (); + lcd.printOnLineOne (" ESP-VENT_MAIN "); /* Timers */ Timer glob_time (ONE_K_HZ, true);