1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-24 08:36:14 +01:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Harald Barth
ebaf1b984e version tag 2023-11-23 22:15:03 +01:00
Harald Barth
697f228a05 Save progmem with DISABLE_VDPY on Uno 2023-11-23 22:14:24 +01:00
Harald Barth
c8e307db7a remove unused TrackManager::reportPowerChange(...) 2023-11-23 22:11:00 +01:00
7 changed files with 28 additions and 20 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

@ -1 +1 @@
#define GITHUB_SHA "devel-202311230948Z" #define GITHUB_SHA "devel-202311232114Z"

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

@ -532,15 +532,6 @@ void TrackManager::setTrackPower(POWERMODE powermode, byte t) {
driver->setPower(powermode); driver->setPower(powermode);
} }
void TrackManager::reportPowerChange(Print* stream, byte thistrack) {
// This function is for backward JMRI compatibility only
// It reports the first track only, as main, regardless of track settings.
// <c MeterName value C/V unit min max res warn>
int maxCurrent=track[0]->raw2mA(track[0]->getRawCurrentTripValue());
StringFormatter::send(stream, F("<c CurrentMAIN %d C Milli 0 %d 1 %d>\n"),
track[0]->raw2mA(track[0]->getCurrentRaw(false)), maxCurrent, maxCurrent);
}
// returns state of the one and only prog track // returns state of the one and only prog track
POWERMODE TrackManager::getProgPower() { POWERMODE TrackManager::getProgPower() {
FOR_EACH_TRACK(t) FOR_EACH_TRACK(t)

View File

@ -88,7 +88,6 @@ class TrackManager {
static void sampleCurrent(); static void sampleCurrent();
static void reportGauges(Print* stream); static void reportGauges(Print* stream);
static void reportCurrent(Print* stream); static void reportCurrent(Print* stream);
static void reportPowerChange(Print* stream, byte thistrack);
static void reportObsoleteCurrent(Print* stream); static void reportObsoleteCurrent(Print* stream);
static void streamTrackState(Print* stream, byte t); static void streamTrackState(Print* stream, byte t);
static bool isPowerOn(byte t); static bool isPowerOn(byte t);

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