1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-30 03:26:13 +01:00

Reduce flash size usage when no LCD is used. -648 Bytes

This commit is contained in:
Jeanette Schlosser 2022-11-14 13:39:44 +01:00
parent 7e16ec7088
commit f99aab3254
4 changed files with 15 additions and 8 deletions

View File

@ -136,9 +136,11 @@ void loop()
#if defined(LCN_SERIAL) #if defined(LCN_SERIAL)
LCN::loop(); LCN::loop();
#endif #endif
#ifndef NO_LCD_USED
LCDDisplay::loop(); // ignored if LCD not in use LCDDisplay::loop(); // ignored if LCD not in use
#endif
// Handle/update IO devices. // Handle/update IO devices.
IODevice::loop(); IODevice::loop();

View File

@ -27,10 +27,14 @@
#ifndef LCD_Implementation_h #ifndef LCD_Implementation_h
#define LCD_Implementation_h #define LCD_Implementation_h
#include "LCDDisplay.h" #if !defined(OLED_DRIVER) && !defined(LCD_DRIVER)
#include "SSD1306Ascii.h" #include "DisplayInterface.h"
#include "LiquidCrystal_I2C.h" #define NO_LCD_USED
#else
#include "LCDDisplay.h"
#include "SSD1306Ascii.h"
#include "LiquidCrystal_I2C.h"
#endif
// Implement the LCDDisplay shim class as a singleton. // Implement the LCDDisplay shim class as a singleton.
// The DisplayInterface class implements a displayy handler with no code (null device); // The DisplayInterface class implements a displayy handler with no code (null device);

View File

@ -27,7 +27,7 @@
Print * StringFormatter::diagSerial=&Serial; Print * StringFormatter::diagSerial=&Serial;
#endif #endif
#include "LCDDisplay.h" #include "LCD_Implementation.h"
bool Diag::ACK=false; bool Diag::ACK=false;
bool Diag::CMD=false; bool Diag::CMD=false;
@ -47,6 +47,7 @@ void StringFormatter::diag( const FSH* input...) {
} }
void StringFormatter::lcd(byte row, const FSH* input...) { void StringFormatter::lcd(byte row, const FSH* input...) {
#ifndef NO_LCD_USED
va_list args; va_list args;
// Issue the LCD as a diag first // Issue the LCD as a diag first
@ -59,6 +60,7 @@ void StringFormatter::lcd(byte row, const FSH* input...) {
LCDDisplay::lcdDisplay->setRow(row); LCDDisplay::lcdDisplay->setRow(row);
va_start(args, input); va_start(args, input);
send2(LCDDisplay::lcdDisplay,input,args); send2(LCDDisplay::lcdDisplay,input,args);
#endif
} }
void StringFormatter::send(Print * stream, const FSH* input...) { void StringFormatter::send(Print * stream, const FSH* input...) {

View File

@ -25,7 +25,6 @@
#include <cstdarg> #include <cstdarg>
#endif #endif
#include "LCDDisplay.h"
class Diag { class Diag {
public: public:
static bool ACK; static bool ACK;