1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-22 15:46:14 +01:00

Rename LCDDisplay class to Display; renameEXRAIL LCD2 macro to SCREEN

This commit is contained in:
Neil McKechnie 2023-02-11 23:37:09 +00:00
parent 65f7a4917f
commit 35f3cca9b3
13 changed files with 40 additions and 40 deletions

View File

@ -40,7 +40,7 @@
#if ETHERNET_ON == true #if ETHERNET_ON == true
#include "EthernetInterface.h" #include "EthernetInterface.h"
#endif #endif
#include "LCD_Implementation.h" #include "Display_Implementation.h"
#include "LCN.h" #include "LCN.h"
#include "IODevice.h" #include "IODevice.h"
#include "Turnouts.h" #include "Turnouts.h"

2
DIAG.h
View File

@ -24,5 +24,5 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define DIAG StringFormatter::diag #define DIAG StringFormatter::diag
#define LCD StringFormatter::lcd #define LCD StringFormatter::lcd
#define LCD2 StringFormatter::lcd2 #define SCREEN StringFormatter::lcd2
#endif #endif

View File

@ -45,20 +45,20 @@
*/ */
#include "LCDDisplay.h" #include "Display.h"
void LCDDisplay::clear() { void Display::clear() {
clearNative(); clearNative();
for (byte row = 0; row < MAX_LCD_ROWS; row++) rowBuffer[row][0] = '\0'; for (byte row = 0; row < MAX_LCD_ROWS; row++) rowBuffer[row][0] = '\0';
topRow = -1; // loop2 will fill from row 0 topRow = -1; // loop2 will fill from row 0
} }
void LCDDisplay::setRow(byte line) { void Display::setRow(byte line) {
hotRow = line; hotRow = line;
hotCol = 0; 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; if (hotRow >= MAX_LCD_ROWS || hotCol >= MAX_LCD_COLS) return -1;
rowBuffer[hotRow][hotCol] = b; rowBuffer[hotRow][hotCol] = b;
hotCol++; hotCol++;
@ -66,12 +66,12 @@ size_t LCDDisplay::write(uint8_t b) {
return 1; return 1;
} }
void LCDDisplay::loop() { void Display::loop() {
if (!lcdDisplay) return; if (!lcdDisplay) return;
lcdDisplay->loop2(false); lcdDisplay->loop2(false);
} }
LCDDisplay *LCDDisplay::loop2(bool force) { Display *Display::loop2(bool force) {
if (!lcdDisplay) return NULL; if (!lcdDisplay) return NULL;
// If output device is busy, don't do anything on this loop // If output device is busy, don't do anything on this loop
@ -150,7 +150,7 @@ LCDDisplay *LCDDisplay::loop2(bool force) {
return NULL; return NULL;
} }
void LCDDisplay::moveToNextRow() { void Display::moveToNextRow() {
rowNext = (rowNext + 1) % MAX_LCD_ROWS; rowNext = (rowNext + 1) % MAX_LCD_ROWS;
#if SCROLLMODE == 1 #if SCROLLMODE == 1
// Finished if we've looped back to row 0 // Finished if we've looped back to row 0
@ -161,7 +161,7 @@ void LCDDisplay::moveToNextRow() {
#endif #endif
} }
void LCDDisplay::skipBlankRows() { void Display::skipBlankRows() {
while (!done && rowBuffer[rowNext][0] == 0) while (!done && rowBuffer[rowNext][0] == 0)
moveToNextRow(); moveToNextRow();
} }

View File

@ -34,16 +34,16 @@
// This class is created in LCDisplay_Implementation.h // This class is created in LCDisplay_Implementation.h
class LCDDisplay : public DisplayInterface { class Display : public DisplayInterface {
public: public:
LCDDisplay() {}; Display() {};
static const int MAX_LCD_ROWS = 8; static const int MAX_LCD_ROWS = 8;
static const int MAX_LCD_COLS = MAX_MSG_SIZE; static const int MAX_LCD_COLS = MAX_MSG_SIZE;
static const long LCD_SCROLL_TIME = 3000; // 3 seconds static const long LCD_SCROLL_TIME = 3000; // 3 seconds
// Internally handled functions // Internally handled functions
static void loop(); static void loop();
LCDDisplay* loop2(bool force) override; Display* loop2(bool force) override;
void setRow(byte line) override; void setRow(byte line) override;
void clear() override; void clear() override;

View File

@ -27,15 +27,15 @@
#ifndef LCD_Implementation_h #ifndef LCD_Implementation_h
#define LCD_Implementation_h #define LCD_Implementation_h
#include "LCDDisplay.h" #include "Display.h"
#include "SSD1306Ascii.h" #include "SSD1306Ascii.h"
#include "LiquidCrystal_I2C.h" #include "LiquidCrystal_I2C.h"
// Implement the LCDDisplay shim class as a singleton. // Implement the Display shim class as a singleton.
// The DisplayInterface class implements a displayy handler with no code (null device); // The DisplayInterface class implements a display handler with no code (null device);
// The LCDDisplay class sub-classes DisplayInterface to provide the common display code; // The Display class sub-classes DisplayInterface to provide the common display code;
// Then LCDDisplay class is subclassed to the specific device type classes: // Then Display class is subclassed to the specific device type classes:
// SSD1306AsciiWire for I2C OLED driver with SSD1306 or SH1106 controllers; // SSD1306AsciiWire for I2C OLED driver with SSD1306 or SH1106 controllers;
// LiquidCrystal_I2C for I2C LCD driver for HD44780 with PCF8574 'backpack'. // LiquidCrystal_I2C for I2C LCD driver for HD44780 with PCF8574 'backpack'.

View File

@ -1247,7 +1247,7 @@ void RMFT2::thrungeString(uint32_t strfar, thrunger mode, byte id) {
break; break;
default: // thrunge_lcd+1, ... default: // thrunge_lcd+1, ...
if (mode > thrunge_lcd) 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; break;
} }
} }

View File

@ -80,7 +80,7 @@
#undef KILLALL #undef KILLALL
#undef LATCH #undef LATCH
#undef LCD #undef LCD
#undef LCD2 #undef SCREEN
#undef LCN #undef LCN
#undef MOVETT #undef MOVETT
#undef ONACTIVATE #undef ONACTIVATE
@ -200,7 +200,7 @@
#define KILLALL #define KILLALL
#define LATCH(sensor_id) #define LATCH(sensor_id)
#define LCD(row,msg) #define LCD(row,msg)
#define LCD2(display,row,msg) #define SCREEN(display,row,msg)
#define LCN(msg) #define LCN(msg)
#define MOVETT(id,steps,activity) #define MOVETT(id,steps,activity)
#define ONACTIVATE(addr,subaddr) #define ONACTIVATE(addr,subaddr)

View File

@ -45,7 +45,7 @@
// Descriptive texts for routes and animations are created in a sepaerate function which // 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. // 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. // a getMessageText(id) function.
// CAUTION: The macros below are multiple passed over myAutomation.h // CAUTION: The macros below are multiple passed over myAutomation.h
@ -143,8 +143,8 @@ const int StringMacroTracker1=__COUNTER__;
lcdid=id;\ lcdid=id;\
break;\ break;\
} }
#undef LCD2 #undef SCREEN
#define LCD2(display,id,msg) \ #define SCREEN(display,id,msg) \
case (__COUNTER__ - StringMacroTracker1) : {\ case (__COUNTER__ - StringMacroTracker1) : {\
static const char HIGHFLASH thrunge[]=msg;\ static const char HIGHFLASH thrunge[]=msg;\
strfar=(uint32_t)GETFARPTR(thrunge);\ strfar=(uint32_t)GETFARPTR(thrunge);\
@ -307,7 +307,7 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = {
#define KILLALL OPCODE_KILLALL,0,0, #define KILLALL OPCODE_KILLALL,0,0,
#define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id), #define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id),
#define LCD(id,msg) PRINT(msg) #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 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 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), #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 // Restore normal code LCD & SERIAL macro
#undef LCD #undef LCD
#define LCD StringFormatter::lcd #define LCD StringFormatter::lcd
#undef LCD2 #undef SCREEN
#define LCD2 StringFormatter::lcd2 #define SCREEN StringFormatter::lcd2
#undef SERIAL #undef SERIAL
#define SERIAL 0x0 #define SERIAL 0x0
#endif #endif

View File

@ -191,7 +191,7 @@ protected:
_selectedDisplayNo = displayNo; _selectedDisplayNo = displayNo;
if (displayNo == _displayNo) { if (displayNo == _displayNo) {
if (line == 255) { 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 // scroll the contents of the buffer and put the new line
// at the bottom of the screen // at the bottom of the screen
for (int row=1; row<_numRows; row++) { for (int row=1; row<_numRows; row++) {

View File

@ -22,7 +22,7 @@
#define LiquidCrystal_I2C_h #define LiquidCrystal_I2C_h
#include <Arduino.h> #include <Arduino.h>
#include "LCDDisplay.h" #include "Display.h"
#include "I2CManager.h" #include "I2CManager.h"
// commands // commands
@ -62,7 +62,7 @@
#define Rw (1 << BACKPACK_Rw_BIT) // Read/Write bit #define Rw (1 << BACKPACK_Rw_BIT) // Read/Write bit
#define Rs (1 << BACKPACK_Rs_BIT) // Register select bit #define Rs (1 << BACKPACK_Rs_BIT) // Register select bit
class LiquidCrystal_I2C : public LCDDisplay { class LiquidCrystal_I2C : public Display {
public: public:
LiquidCrystal_I2C(I2CAddress lcd_Addr,uint8_t lcd_cols,uint8_t lcd_rows); LiquidCrystal_I2C(I2CAddress lcd_Addr,uint8_t lcd_cols,uint8_t lcd_rows);
void begin(); void begin();

View File

@ -23,7 +23,7 @@
#include "Arduino.h" #include "Arduino.h"
#include "FSH.h" #include "FSH.h"
#include "LCDDisplay.h" #include "Display.h"
#include "I2CManager.h" #include "I2CManager.h"
#include "DIAG.h" #include "DIAG.h"
@ -33,7 +33,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Constructor // Constructor
class SSD1306AsciiWire : public LCDDisplay { class SSD1306AsciiWire : public Display {
public: public:
// Constructors // Constructors

View File

@ -18,7 +18,7 @@
*/ */
#include "StringFormatter.h" #include "StringFormatter.h"
#include <stdarg.h> #include <stdarg.h>
#include "LCDDisplay.h" #include "Display.h"
bool Diag::ACK=false; bool Diag::ACK=false;
bool Diag::CMD=false; bool Diag::CMD=false;
@ -45,19 +45,19 @@ void StringFormatter::lcd(byte row, const FSH* input...) {
send2(&USB_SERIAL,input,args); send2(&USB_SERIAL,input,args);
send(&USB_SERIAL,F(" *>\n")); send(&USB_SERIAL,F(" *>\n"));
if (!LCDDisplay::lcdDisplay) return; if (!Display::lcdDisplay) return;
LCDDisplay::lcdDisplay->setRow(row); Display::lcdDisplay->setRow(row);
va_start(args, input); 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...) { void StringFormatter::lcd2(uint8_t display, byte row, const FSH* input...) {
va_list args; va_list args;
if (!LCDDisplay::lcdDisplay) return; if (!Display::lcdDisplay) return;
LCDDisplay::lcdDisplay->setRow(display, row); Display::lcdDisplay->setRow(display, row);
va_start(args, input); va_start(args, input);
send2(LCDDisplay::lcdDisplay,input,args); send2(Display::lcdDisplay,input,args);
} }
void StringFormatter::send(Print * stream, const FSH* input...) { void StringFormatter::send(Print * stream, const FSH* input...) {

View File

@ -21,7 +21,7 @@
#include <Arduino.h> #include <Arduino.h>
#include "FSH.h" #include "FSH.h"
#include "RingStream.h" #include "RingStream.h"
#include "LCDDisplay.h" #include "Display.h"
class Diag { class Diag {
public: public:
static bool ACK; static bool ACK;