diff --git a/Display.cpp b/Display.cpp index c85d7f4..5af85b8 100644 --- a/Display.cpp +++ b/Display.cpp @@ -67,12 +67,12 @@ size_t Display::write(uint8_t b) { } void Display::loop() { - if (!lcdDisplay) return; - lcdDisplay->loop2(false); + if (!displayHandler) return; + displayHandler->loop2(false); } Display *Display::loop2(bool force) { - if (!lcdDisplay) return NULL; + if (!displayHandler) return NULL; // If output device is busy, don't do anything on this loop // This avoids blocking while waiting for the device to complete. diff --git a/DisplayInterface.cpp b/DisplayInterface.cpp index 8fe45d3..6ef13a4 100644 --- a/DisplayInterface.cpp +++ b/DisplayInterface.cpp @@ -21,4 +21,4 @@ #include "DisplayInterface.h" -DisplayInterface *DisplayInterface::lcdDisplay = 0; +DisplayInterface *DisplayInterface::displayHandler = 0; diff --git a/DisplayInterface.h b/DisplayInterface.h index d9afdc4..82b38d6 100644 --- a/DisplayInterface.h +++ b/DisplayInterface.h @@ -41,7 +41,7 @@ public: if (!displayNo) clear(); } - static DisplayInterface *lcdDisplay; + static DisplayInterface *displayHandler; }; #endif diff --git a/Display_Implementation.h b/Display_Implementation.h index 4c90dd9..f04b7d2 100644 --- a/Display_Implementation.h +++ b/Display_Implementation.h @@ -40,14 +40,14 @@ // LiquidCrystal_I2C for I2C LCD driver for HD44780 with PCF8574 'backpack'. #if defined(OLED_DRIVER) - #define CONDITIONAL_LCD_START for (DisplayInterface * dummy=new SSD1306AsciiWire(OLED_DRIVER);dummy!=NULL; dummy=dummy->loop2(true)) + #define CONDITIONAL_DISPLAY_START for (DisplayInterface * dummy=new SSD1306AsciiWire(OLED_DRIVER);dummy!=NULL; dummy=dummy->loop2(true)) #elif defined(LCD_DRIVER) - #define CONDITIONAL_LCD_START for (DisplayInterface * dummy=new LiquidCrystal_I2C(LCD_DRIVER);dummy!=NULL; dummy=dummy->loop2(true)) + #define CONDITIONAL_DISPLAY_START for (DisplayInterface * dummy=new LiquidCrystal_I2C(LCD_DRIVER);dummy!=NULL; dummy=dummy->loop2(true)) #else - // Create null display handler just in case someone calls lcdDisplay->something without checking if lcdDisplay is NULL! - #define CONDITIONAL_LCD_START { new DisplayInterface(); } + // Create null display handler just in case someone calls displayHandler->something without checking if displayHandler is NULL! + #define CONDITIONAL_DISPLAY_START { new DisplayInterface(); } #endif #endif // LCD_Implementation_h diff --git a/IO_OLEDDisplay.h b/IO_OLEDDisplay.h index b381bd8..12b571f 100644 --- a/IO_OLEDDisplay.h +++ b/IO_OLEDDisplay.h @@ -110,11 +110,11 @@ protected: oled = new SSD1306AsciiWire(); // Store pointer to this object into CS display hook, so that we - // will intercept any subsequent calls to lcdDisplay methods. + // will intercept any subsequent calls to displayHandler methods. // Make a note of the existing display reference, to that we can // pass on anything we're not interested in. - _nextDisplay = DisplayInterface::lcdDisplay; - DisplayInterface::lcdDisplay = this; + _nextDisplay = DisplayInterface::displayHandler; + DisplayInterface::displayHandler = this; addDevice(this); } diff --git a/LiquidCrystal_I2C.cpp b/LiquidCrystal_I2C.cpp index a5c2e16..c9d8113 100644 --- a/LiquidCrystal_I2C.cpp +++ b/LiquidCrystal_I2C.cpp @@ -57,7 +57,7 @@ LiquidCrystal_I2C::LiquidCrystal_I2C(I2CAddress lcd_Addr, uint8_t lcd_cols, _displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS; begin(); backlight(); - lcdDisplay = this; + displayHandler = this; } } diff --git a/SSD1306Ascii.cpp b/SSD1306Ascii.cpp index deae5ac..5e24c7a 100644 --- a/SSD1306Ascii.cpp +++ b/SSD1306Ascii.cpp @@ -160,7 +160,7 @@ SSD1306AsciiWire::SSD1306AsciiWire(int width, int height) { if (I2CManager.exists(address)) { begin(address, width, height); // Set singleton Address so CS is able to call it. - lcdDisplay = this; + displayHandler = this; return; } } diff --git a/StringFormatter.cpp b/StringFormatter.cpp index 4054b1e..a659fc4 100644 --- a/StringFormatter.cpp +++ b/StringFormatter.cpp @@ -45,19 +45,19 @@ void StringFormatter::lcd(byte row, const FSH* input...) { send2(&USB_SERIAL,input,args); send(&USB_SERIAL,F(" *>\n")); - if (!Display::lcdDisplay) return; - Display::lcdDisplay->setRow(row); + if (!Display::displayHandler) return; + Display::displayHandler->setRow(row); va_start(args, input); - send2(Display::lcdDisplay,input,args); + send2(Display::displayHandler,input,args); } void StringFormatter::lcd2(uint8_t display, byte row, const FSH* input...) { va_list args; - if (!Display::lcdDisplay) return; - Display::lcdDisplay->setRow(display, row); + if (!Display::displayHandler) return; + Display::displayHandler->setRow(display, row); va_start(args, input); - send2(Display::lcdDisplay,input,args); + send2(Display::displayHandler,input,args); } void StringFormatter::send(Print * stream, const FSH* input...) { diff --git a/version.h b/version.h index 0a263b7..2e6d81b 100644 --- a/version.h +++ b/version.h @@ -13,7 +13,8 @@ // PCF8575 I2C GPIO driver added. // EX-RAIL ANOUT function for triggering analogue // HAL drivers (e.g. analogue outputs, DFPlayer, PWM). -// Installable HAL OLED Display Driver. +// Installable HAL OLED Display Driver, with +// support for multiple displays. // Layered HAL Drivers PCA9685pwm and Servo added for // (1) native PWM on PCA9685 module and // (2) animations of servo movement via PCA9685pwm.