diff --git a/DCCEX.h b/DCCEX.h index f2eee51..2dc8eb7 100644 --- a/DCCEX.h +++ b/DCCEX.h @@ -40,7 +40,7 @@ #if ETHERNET_ON == true #include "EthernetInterface.h" #endif -#include "LCD_Implementation.h" +#include "Display_Implementation.h" #include "LCN.h" #include "IODevice.h" #include "Turnouts.h" diff --git a/DIAG.h b/DIAG.h index 0595505..5aa54aa 100644 --- a/DIAG.h +++ b/DIAG.h @@ -24,5 +24,5 @@ #include "StringFormatter.h" #define DIAG StringFormatter::diag #define LCD StringFormatter::lcd -#define LCD2 StringFormatter::lcd2 +#define SCREEN StringFormatter::lcd2 #endif diff --git a/LCDDisplay.cpp b/Display.cpp similarity index 94% rename from LCDDisplay.cpp rename to Display.cpp index c6609ce..c85d7f4 100644 --- a/LCDDisplay.cpp +++ b/Display.cpp @@ -45,20 +45,20 @@ */ -#include "LCDDisplay.h" +#include "Display.h" -void LCDDisplay::clear() { +void Display::clear() { clearNative(); for (byte row = 0; row < MAX_LCD_ROWS; row++) rowBuffer[row][0] = '\0'; topRow = -1; // loop2 will fill from row 0 } -void LCDDisplay::setRow(byte line) { +void Display::setRow(byte line) { hotRow = line; hotCol = 0; } -size_t LCDDisplay::write(uint8_t b) { +size_t Display::write(uint8_t b) { if (hotRow >= MAX_LCD_ROWS || hotCol >= MAX_LCD_COLS) return -1; rowBuffer[hotRow][hotCol] = b; hotCol++; @@ -66,12 +66,12 @@ size_t LCDDisplay::write(uint8_t b) { return 1; } -void LCDDisplay::loop() { +void Display::loop() { if (!lcdDisplay) return; lcdDisplay->loop2(false); } -LCDDisplay *LCDDisplay::loop2(bool force) { +Display *Display::loop2(bool force) { if (!lcdDisplay) return NULL; // If output device is busy, don't do anything on this loop @@ -150,7 +150,7 @@ LCDDisplay *LCDDisplay::loop2(bool force) { return NULL; } -void LCDDisplay::moveToNextRow() { +void Display::moveToNextRow() { rowNext = (rowNext + 1) % MAX_LCD_ROWS; #if SCROLLMODE == 1 // Finished if we've looped back to row 0 @@ -161,7 +161,7 @@ void LCDDisplay::moveToNextRow() { #endif } -void LCDDisplay::skipBlankRows() { +void Display::skipBlankRows() { while (!done && rowBuffer[rowNext][0] == 0) moveToNextRow(); } diff --git a/LCDDisplay.h b/Display.h similarity index 95% rename from LCDDisplay.h rename to Display.h index 6e2c69d..84cdbde 100644 --- a/LCDDisplay.h +++ b/Display.h @@ -34,16 +34,16 @@ // This class is created in LCDisplay_Implementation.h -class LCDDisplay : public DisplayInterface { +class Display : public DisplayInterface { public: - LCDDisplay() {}; + Display() {}; static const int MAX_LCD_ROWS = 8; static const int MAX_LCD_COLS = MAX_MSG_SIZE; static const long LCD_SCROLL_TIME = 3000; // 3 seconds // Internally handled functions static void loop(); - LCDDisplay* loop2(bool force) override; + Display* loop2(bool force) override; void setRow(byte line) override; void clear() override; diff --git a/LCD_Implementation.h b/Display_Implementation.h similarity index 85% rename from LCD_Implementation.h rename to Display_Implementation.h index 95b0f81..4c90dd9 100644 --- a/LCD_Implementation.h +++ b/Display_Implementation.h @@ -27,15 +27,15 @@ #ifndef LCD_Implementation_h #define LCD_Implementation_h -#include "LCDDisplay.h" +#include "Display.h" #include "SSD1306Ascii.h" #include "LiquidCrystal_I2C.h" -// Implement the LCDDisplay shim class as a singleton. -// The DisplayInterface class implements a displayy handler with no code (null device); -// The LCDDisplay class sub-classes DisplayInterface to provide the common display code; -// Then LCDDisplay class is subclassed to the specific device type classes: +// Implement the Display shim class as a singleton. +// The DisplayInterface class implements a display handler with no code (null device); +// The Display class sub-classes DisplayInterface to provide the common display code; +// Then Display class is subclassed to the specific device type classes: // SSD1306AsciiWire for I2C OLED driver with SSD1306 or SH1106 controllers; // LiquidCrystal_I2C for I2C LCD driver for HD44780 with PCF8574 'backpack'. diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 11ad4a9..48f91cc 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -1247,7 +1247,7 @@ void RMFT2::thrungeString(uint32_t strfar, thrunger mode, byte id) { break; default: // thrunge_lcd+1, ... if (mode > thrunge_lcd) - LCD2(mode-thrunge_lcd, id, F("%s"),buffer->getString()); // print to other display + SCREEN(mode-thrunge_lcd, id, F("%s"),buffer->getString()); // print to other display break; } } diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index b81c86f..b4ffc6d 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -80,7 +80,7 @@ #undef KILLALL #undef LATCH #undef LCD -#undef LCD2 +#undef SCREEN #undef LCN #undef MOVETT #undef ONACTIVATE @@ -200,7 +200,7 @@ #define KILLALL #define LATCH(sensor_id) #define LCD(row,msg) -#define LCD2(display,row,msg) +#define SCREEN(display,row,msg) #define LCN(msg) #define MOVETT(id,steps,activity) #define ONACTIVATE(addr,subaddr) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 868cbc9..ee20c1f 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -45,7 +45,7 @@ // Descriptive texts for routes and animations are created in a sepaerate function which // can be called to emit a list of routes/automatuions in a form suitable for Withrottle. -// PRINT(msg), LCD(row,msg) and LCD2(display,row,msg) are implemented in a separate pass to create +// PRINT(msg), LCD(row,msg) and SCREEN(display,row,msg) are implemented in a separate pass to create // a getMessageText(id) function. // CAUTION: The macros below are multiple passed over myAutomation.h @@ -143,8 +143,8 @@ const int StringMacroTracker1=__COUNTER__; lcdid=id;\ break;\ } -#undef LCD2 -#define LCD2(display,id,msg) \ +#undef SCREEN +#define SCREEN(display,id,msg) \ case (__COUNTER__ - StringMacroTracker1) : {\ static const char HIGHFLASH thrunge[]=msg;\ strfar=(uint32_t)GETFARPTR(thrunge);\ @@ -307,7 +307,7 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = { #define KILLALL OPCODE_KILLALL,0,0, #define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id), #define LCD(id,msg) PRINT(msg) -#define LCD2(display,id,msg) PRINT(msg) +#define SCREEN(display,id,msg) PRINT(msg) #define LCN(msg) PRINT(msg) #define MOVETT(id,steps,activity) OPCODE_SERVO,V(id),OPCODE_PAD,V(steps),OPCODE_PAD,V(EXTurntable::activity),OPCODE_PAD,V(0), #define ONACTIVATE(addr,subaddr) OPCODE_ONACTIVATE,V(addr<<2|subaddr), @@ -378,8 +378,8 @@ const HIGHFLASH byte RMFT2::RouteCode[] = { // Restore normal code LCD & SERIAL macro #undef LCD #define LCD StringFormatter::lcd -#undef LCD2 -#define LCD2 StringFormatter::lcd2 +#undef SCREEN +#define SCREEN StringFormatter::lcd2 #undef SERIAL #define SERIAL 0x0 #endif diff --git a/IO_OLEDDisplay.h b/IO_OLEDDisplay.h index 307b7d7..b381bd8 100644 --- a/IO_OLEDDisplay.h +++ b/IO_OLEDDisplay.h @@ -191,7 +191,7 @@ protected: _selectedDisplayNo = displayNo; if (displayNo == _displayNo) { if (line == 255) { - // LCD(255,"xxx") or LCD2(displayNo,255, "xxx") - + // LCD(255,"xxx") or SCREEN(displayNo,255, "xxx") - // scroll the contents of the buffer and put the new line // at the bottom of the screen for (int row=1; row<_numRows; row++) { diff --git a/LiquidCrystal_I2C.h b/LiquidCrystal_I2C.h index 20dc126..5d5a741 100644 --- a/LiquidCrystal_I2C.h +++ b/LiquidCrystal_I2C.h @@ -22,7 +22,7 @@ #define LiquidCrystal_I2C_h #include -#include "LCDDisplay.h" +#include "Display.h" #include "I2CManager.h" // commands @@ -62,7 +62,7 @@ #define Rw (1 << BACKPACK_Rw_BIT) // Read/Write bit #define Rs (1 << BACKPACK_Rs_BIT) // Register select bit -class LiquidCrystal_I2C : public LCDDisplay { +class LiquidCrystal_I2C : public Display { public: LiquidCrystal_I2C(I2CAddress lcd_Addr,uint8_t lcd_cols,uint8_t lcd_rows); void begin(); diff --git a/SSD1306Ascii.h b/SSD1306Ascii.h index f4c9ba7..d40eac6 100644 --- a/SSD1306Ascii.h +++ b/SSD1306Ascii.h @@ -23,7 +23,7 @@ #include "Arduino.h" #include "FSH.h" -#include "LCDDisplay.h" +#include "Display.h" #include "I2CManager.h" #include "DIAG.h" @@ -33,7 +33,7 @@ //------------------------------------------------------------------------------ // Constructor -class SSD1306AsciiWire : public LCDDisplay { +class SSD1306AsciiWire : public Display { public: // Constructors diff --git a/StringFormatter.cpp b/StringFormatter.cpp index 2341886..4054b1e 100644 --- a/StringFormatter.cpp +++ b/StringFormatter.cpp @@ -18,7 +18,7 @@ */ #include "StringFormatter.h" #include -#include "LCDDisplay.h" +#include "Display.h" bool Diag::ACK=false; bool Diag::CMD=false; @@ -45,19 +45,19 @@ void StringFormatter::lcd(byte row, const FSH* input...) { send2(&USB_SERIAL,input,args); send(&USB_SERIAL,F(" *>\n")); - if (!LCDDisplay::lcdDisplay) return; - LCDDisplay::lcdDisplay->setRow(row); + if (!Display::lcdDisplay) return; + Display::lcdDisplay->setRow(row); va_start(args, input); - send2(LCDDisplay::lcdDisplay,input,args); + send2(Display::lcdDisplay,input,args); } void StringFormatter::lcd2(uint8_t display, byte row, const FSH* input...) { va_list args; - if (!LCDDisplay::lcdDisplay) return; - LCDDisplay::lcdDisplay->setRow(display, row); + if (!Display::lcdDisplay) return; + Display::lcdDisplay->setRow(display, row); va_start(args, input); - send2(LCDDisplay::lcdDisplay,input,args); + send2(Display::lcdDisplay,input,args); } void StringFormatter::send(Print * stream, const FSH* input...) { diff --git a/StringFormatter.h b/StringFormatter.h index 4c95ea6..6923c10 100644 --- a/StringFormatter.h +++ b/StringFormatter.h @@ -21,7 +21,7 @@ #include #include "FSH.h" #include "RingStream.h" -#include "LCDDisplay.h" +#include "Display.h" class Diag { public: static bool ACK;