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:
parent
65f7a4917f
commit
35f3cca9b3
2
DCCEX.h
2
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"
|
||||
|
|
2
DIAG.h
2
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
|
||||
|
|
|
@ -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();
|
||||
}
|
|
@ -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;
|
||||
|
|
@ -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'.
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#define LiquidCrystal_I2C_h
|
||||
|
||||
#include <Arduino.h>
|
||||
#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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
#include "StringFormatter.h"
|
||||
#include <stdarg.h>
|
||||
#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...) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <Arduino.h>
|
||||
#include "FSH.h"
|
||||
#include "RingStream.h"
|
||||
#include "LCDDisplay.h"
|
||||
#include "Display.h"
|
||||
class Diag {
|
||||
public:
|
||||
static bool ACK;
|
||||
|
|
Loading…
Reference in New Issue
Block a user