From 2ba5adc8b42bfd5323e09f4bf2b6585321129a8e Mon Sep 17 00:00:00 2001 From: Asbelos Date: Fri, 17 Nov 2023 10:45:36 +0000 Subject: [PATCH] 5.2.3 @ and ROUTE_DISABLED --- DCCEXParser.cpp | 4 ++++ EXRAIL2.cpp | 3 +++ EXRAIL2.h | 1 + EXRAIL2MacroReset.h | 2 ++ EXRAILMacros.h | 3 +++ StringFormatter.cpp | 15 +++++++++------ version.h | 2 ++ 7 files changed, 24 insertions(+), 6 deletions(-) diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 4ceedea..aed185b 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -115,6 +115,7 @@ Once a new OPCODE is decided upon, update this list. #include "DCCTimer.h" #include "EXRAIL2.h" #include "Turntables.h" +#include "version.h" // This macro can't be created easily as a portable function because the // flashlist requires a far pointer for high flash access. @@ -841,6 +842,9 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream) case '@': // JMRI saying "give me virtual LCD msgs" CommandDistributor::setVirtualLCDSerial(stream); + StringFormatter::send(stream, + F("<@ 0 0 \"DCC-EX v" VERSION "\">\n" + "<@ 0 1 \"Lic GPLv3\">\n")); return; default: //anything else will diagnose and drop out to diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index ccd4d9e..6f0a835 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -932,6 +932,9 @@ void RMFT2::loop2() { case OPCODE_ROUTE_ACTIVE: manageRouteState(operand,1); break; + case OPCODE_ROUTE_DISABLED: + manageRouteState(operand,4); + break; case OPCODE_ROUTE: case OPCODE_AUTOMATION: diff --git a/EXRAIL2.h b/EXRAIL2.h index a4c0e5f..8f777f4 100644 --- a/EXRAIL2.h +++ b/EXRAIL2.h @@ -69,6 +69,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, OPCODE_LCC,OPCODE_LCCX,OPCODE_ONLCC, OPCODE_ONOVERLOAD, OPCODE_ROUTE_ACTIVE,OPCODE_ROUTE_INACTIVE,OPCODE_ROUTE_HIDDEN, + OPCODE_ROUTE_DISABLED, // OPcodes below this point are skip-nesting IF operations // placed here so that they may be skipped as a group diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index ff8dc8d..ee240ed 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -129,6 +129,7 @@ #undef ROUTE_ACTIVE #undef ROUTE_INACTIVE #undef ROUTE_HIDDEN +#undef ROUTE_DISABLED #undef ROUTE_CAPTION #undef SENDLOCO #undef SEQUENCE @@ -274,6 +275,7 @@ #define ROUTE_ACTIVE(id) #define ROUTE_INACTIVE(id) #define ROUTE_HIDDEN(id) +#define ROUTE_DISABLED(id) #define ROUTE_CAPTION(id,caption) #define SENDLOCO(cab,route) #define SEQUENCE(id) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 3c58699..6024290 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -108,6 +108,8 @@ void exrailHalSetup() { #define ROUTE_INACTIVE(id) | FEATURE_ROUTESTATE #undef ROUTE_HIDDEN #define ROUTE_HIDDEN(id) | FEATURE_ROUTESTATE +#undef ROUTE_DISABLED +#define ROUTE_DISABLED(id) | FEATURE_ROUTESTATE #undef ROUTE_CAPTION #define ROUTE_CAPTION(id,caption) | FEATURE_ROUTESTATE @@ -457,6 +459,7 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup]; #define ROUTE_ACTIVE(id) OPCODE_ROUTE_ACTIVE,V(id), #define ROUTE_INACTIVE(id) OPCODE_ROUTE_INACTIVE,V(id), #define ROUTE_HIDDEN(id) OPCODE_ROUTE_HIDDEN,V(id), +#define ROUTE_DISABLED(id) OPCODE_ROUTE_DISABLED,V(id), #define ROUTE_CAPTION(id,caption) PRINT(caption) #define SENDLOCO(cab,route) OPCODE_SENDLOCO,V(cab),OPCODE_PAD,V(route), #define SEQUENCE(id) OPCODE_SEQUENCE, V(id), diff --git a/StringFormatter.cpp b/StringFormatter.cpp index 218e617..13b5825 100644 --- a/StringFormatter.cpp +++ b/StringFormatter.cpp @@ -39,15 +39,18 @@ void StringFormatter::diag( const FSH* input...) { void StringFormatter::lcd(byte row, const FSH* input...) { va_list args; - + Print * virtualLCD=CommandDistributor::getVirtualLCDSerial(0,row); + // Issue the LCD as a diag first - send(&USB_SERIAL,F("<* LCD%d:"),row); - va_start(args, input); - send2(&USB_SERIAL,input,args); - send(&USB_SERIAL,F(" *>\n")); + // Unless the same serial is asking for the virtual @ respomnse + if (virtualLCD!=&USB_SERIAL) { + send(&USB_SERIAL,F("<* LCD%d:"),row); + va_start(args, input); + send2(&USB_SERIAL,input,args); + send(&USB_SERIAL,F(" *>\n")); + } // send to virtual LCD collector (if any) - Print * virtualLCD=CommandDistributor::getVirtualLCDSerial(0,row); if (virtualLCD) { va_start(args, input); send2(virtualLCD,input,args); diff --git a/version.h b/version.h index c14d2b0..57d154a 100644 --- a/version.h +++ b/version.h @@ -4,6 +4,8 @@ #include "StringFormatter.h" #define VERSION "5.2.3" +// 5.2.4 - LCD macro will not do diag if that duplicates @ to same target. +// - Added ROUTE_DISABLED macro in EXRAIL // 5.2.3 - Bugfix: Catch stange input to parser // 5.2.2 - Added option to allow MAX_CHARACTER_ROWS to be defined in config.h // 5.2.1 - Trackmanager rework for simpler structure