1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 08:06:13 +01:00

Save progmem with DISABLE_VDPY on Uno

This commit is contained in:
Harald Barth 2023-11-23 22:14:24 +01:00
parent c8e307db7a
commit 697f228a05
4 changed files with 27 additions and 9 deletions

View File

@ -847,13 +847,14 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
case 'L': // LCC interface implemented in EXRAIL parser case 'L': // LCC interface implemented in EXRAIL parser
break; // Will <X> if not intercepted by EXRAIL break; // Will <X> if not intercepted by EXRAIL
#ifndef DISABLE_VDPY
case '@': // JMRI saying "give me virtual LCD msgs" case '@': // JMRI saying "give me virtual LCD msgs"
CommandDistributor::setVirtualLCDSerial(stream); CommandDistributor::setVirtualLCDSerial(stream);
StringFormatter::send(stream, StringFormatter::send(stream,
F("<@ 0 0 \"DCC-EX v" VERSION "\">\n" F("<@ 0 0 \"DCC-EX v" VERSION "\">\n"
"<@ 0 1 \"Lic GPLv3\">\n")); "<@ 0 1 \"Lic GPLv3\">\n"));
return; return;
#endif
default: //anything else will diagnose and drop out to <X> default: //anything else will diagnose and drop out to <X>
if (opcode >= ' ' && opcode <= '~') { if (opcode >= ' ' && opcode <= '~') {
DIAG(F("Opcode=%c params=%d"), opcode, params); DIAG(F("Opcode=%c params=%d"), opcode, params);
@ -1064,6 +1065,7 @@ bool DCCEXParser::parseS(Print *stream, int16_t params, int16_t p[])
} }
bool DCCEXParser::parseC(Print *stream, int16_t params, int16_t p[]) { bool DCCEXParser::parseC(Print *stream, int16_t params, int16_t p[]) {
(void)stream; // arg not used, maybe later?
if (params == 0) if (params == 0)
return false; return false;
switch (p[0]) switch (p[0])

View File

@ -39,8 +39,11 @@ void StringFormatter::diag( const FSH* input...) {
void StringFormatter::lcd(byte row, const FSH* input...) { void StringFormatter::lcd(byte row, const FSH* input...) {
va_list args; va_list args;
#ifndef DISABLE_VDPY
Print * virtualLCD=CommandDistributor::getVirtualLCDSerial(0,row); Print * virtualLCD=CommandDistributor::getVirtualLCDSerial(0,row);
#else
Print * virtualLCD=NULL;
#endif
// Issue the LCD as a diag first // Issue the LCD as a diag first
// Unless the same serial is asking for the virtual @ respomnse // Unless the same serial is asking for the virtual @ respomnse
if (virtualLCD!=&USB_SERIAL) { if (virtualLCD!=&USB_SERIAL) {
@ -50,13 +53,14 @@ void StringFormatter::lcd(byte row, const FSH* input...) {
send(&USB_SERIAL,F(" *>\n")); send(&USB_SERIAL,F(" *>\n"));
} }
#ifndef DISABLE_VDPY
// send to virtual LCD collector (if any) // send to virtual LCD collector (if any)
if (virtualLCD) { if (virtualLCD) {
va_start(args, input); va_start(args, input);
send2(virtualLCD,input,args); send2(virtualLCD,input,args);
CommandDistributor::commitVirtualLCDSerial(); CommandDistributor::commitVirtualLCDSerial();
} }
#endif
DisplayInterface::setRow(row); DisplayInterface::setRow(row);
va_start(args, input); va_start(args, input);
send2(DisplayInterface::getDisplayHandler(),input,args); send2(DisplayInterface::getDisplayHandler(),input,args);
@ -66,12 +70,14 @@ void StringFormatter::lcd2(uint8_t display, byte row, const FSH* input...) {
va_list args; va_list args;
// send to virtual LCD collector (if any) // send to virtual LCD collector (if any)
#ifndef DISABLE_VDPY
Print * virtualLCD=CommandDistributor::getVirtualLCDSerial(display,row); Print * virtualLCD=CommandDistributor::getVirtualLCDSerial(display,row);
if (virtualLCD) { if (virtualLCD) {
va_start(args, input); va_start(args, input);
send2(virtualLCD,input,args); send2(virtualLCD,input,args);
CommandDistributor::commitVirtualLCDSerial(); CommandDistributor::commitVirtualLCDSerial();
} }
#endif
DisplayInterface::setRow(display, row); DisplayInterface::setRow(display, row);
va_start(args, input); va_start(args, input);
@ -250,4 +256,3 @@ void StringFormatter::printHex(Print * stream,uint16_t value) {
result[4]='\0'; result[4]='\0';
stream->print(result); stream->print(result);
} }

View File

@ -199,6 +199,18 @@ The configuration file for DCC-EX Command Station
// //
// #define DISABLE_PROG // #define DISABLE_PROG
/////////////////////////////////////////////////////////////////////////////////////
// DISABLE / ENABLE VDPY
//
// The Virtual display "VDPY" feature is by default enabled everywhere
// but on Uno and Nano. If you think you can fit it (for example
// having disabled some of the features above) you can enable it with
// ENABLE_VDPY. You can even disable it on all other CPUs with
// DISABLE_VDPY
//
// #define DISABLE_VDPY
// #define ENABLE_VDPY
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
// REDEFINE WHERE SHORT/LONG ADDR break is. According to NMRA the last short address // REDEFINE WHERE SHORT/LONG ADDR break is. According to NMRA the last short address
// is 127 and the first long address is 128. There are manufacturers which have // is 127 and the first long address is 128. There are manufacturers which have

View File

@ -219,10 +219,9 @@
// The HAL is disabled by default on Nano and Uno platforms, because of limited flash space. // The HAL is disabled by default on Nano and Uno platforms, because of limited flash space.
// //
#if defined(ARDUINO_AVR_NANO) || defined(ARDUINO_AVR_UNO) #if defined(ARDUINO_AVR_NANO) || defined(ARDUINO_AVR_UNO)
#if defined(DISABLE_DIAG) && defined(DISABLE_EEPROM) && defined(DISABLE_PROG) #define IO_NO_HAL // HAL too big whatever you disable otherwise
#warning you have sacrificed DIAG for HAL #ifndef ENABLE_VDPY
#else #define DISABLE_VDPY
#define IO_NO_HAL
#endif #endif
#endif #endif