Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CommandStation-EX.ino
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ void loop()
#if defined(LCN_SERIAL)
LCN::loop();
#endif


#ifndef NO_LCD_USED
LCDDisplay::loop(); // ignored if LCD not in use

#endif

// Handle/update IO devices.
IODevice::loop();

Expand Down
12 changes: 8 additions & 4 deletions LCD_Implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@

#ifndef LCD_Implementation_h
#define LCD_Implementation_h
#include "LCDDisplay.h"
#include "SSD1306Ascii.h"
#include "LiquidCrystal_I2C.h"

#if !defined(OLED_DRIVER) && !defined(LCD_DRIVER)
#include "DisplayInterface.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.
// The DisplayInterface class implements a displayy handler with no code (null device);
Expand Down
4 changes: 3 additions & 1 deletion StringFormatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
Print * StringFormatter::diagSerial=&Serial;
#endif

#include "LCDDisplay.h"
#include "LCD_Implementation.h"

bool Diag::ACK=false;
bool Diag::CMD=false;
Expand All @@ -47,6 +47,7 @@ void StringFormatter::diag( const FSH* input...) {
}

void StringFormatter::lcd(byte row, const FSH* input...) {
#ifndef NO_LCD_USED
va_list args;

// Issue the LCD as a diag first
Expand All @@ -59,6 +60,7 @@ void StringFormatter::lcd(byte row, const FSH* input...) {
LCDDisplay::lcdDisplay->setRow(row);
va_start(args, input);
send2(LCDDisplay::lcdDisplay,input,args);
#endif
}

void StringFormatter::send(Print * stream, const FSH* input...) {
Expand Down
1 change: 0 additions & 1 deletion StringFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <cstdarg>
#endif

#include "LCDDisplay.h"
class Diag {
public:
static bool ACK;
Expand Down