From 28a44060446a59907f9f30408358698dab754a70 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Tue, 12 Apr 2022 23:10:29 +0100 Subject: [PATCH] Subtle corrections --- DCCEXParser.cpp | 16 ++++++++-------- EXRAIL2.cpp | 4 ++-- EXRAILMacros.h | 2 +- Release_Notes/ThrottleAssists.md | 11 +++++++---- WiThrottle.cpp | 9 +++++---- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 11a91d2..9d0cf5c 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -566,21 +566,21 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream) StringFormatter::send(stream, F(" for ( Turnout * t=Turnout::first(); t; t=t->next()) { - if (t->isHidden()) continue; - StringFormatter::send(stream, F(" %d"),t->getId()); + if (t->isHidden()) continue; + StringFormatter::send(stream, F(" %d"),t->getId()); } } else { // Turnout * t=Turnout::get(id); - if (t && !t->isHidden()) - StringFormatter::send(stream, F(" %d %c \"%S\""), - id,t->isThrown()?'T':'C', + if (!t || t->isHidden()) StringFormatter::send(stream, F(" %d X"),id); + else StringFormatter::send(stream, F(" %d %c \"%S\""), + id,t->isThrown()?'T':'C', #ifdef EXRAIL_ACTIVE - RMFT2::getTurnoutDescription(id) + RMFT2::getTurnoutDescription(id) #else - F("") + F("") #endif - ); + ); } StringFormatter::send(stream, F(">\n")); return; diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 55be05a..dbbb038 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -262,12 +262,12 @@ void RMFT2::setTurnoutHiddenState(Turnout * t) { } char RMFT2::getRouteType(int16_t id) { - for (int16_t i=0;;i+=2) { + for (int16_t i=0;;i++) { int16_t rid= GETFLASHW(routeIdList+i); if (rid==id) return 'R'; if (rid==0) break; } - for (int16_t i=0;;i+=2) { + for (int16_t i=0;;i++) { int16_t rid= GETFLASHW(automationIdList+i); if (rid==id) return 'A'; if (rid==0) break; diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 075a69c..8cdbf41 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -53,7 +53,7 @@ // helper macro for turnout descriptions, creates NULL for missing description #define O_DESC(id, desc) case id: return ("" desc)[0]?F("" desc):NULL; // helper macro for turnout description as HIDDEN -#define HIDDEN "\0x01" +#define HIDDEN "\x01" // Pass 1 Implements aliases #include "EXRAIL2MacroReset.h" diff --git a/Release_Notes/ThrottleAssists.md b/Release_Notes/ThrottleAssists.md index 2d32979..9d979c9 100644 --- a/Release_Notes/ThrottleAssists.md +++ b/Release_Notes/ThrottleAssists.md @@ -16,7 +16,7 @@ e.g. response `````` e.g. response `````` or `````` (T=thrown, C=closed) or `````` indicating turnout description not given. -or `````` indicating turnout unknown. +or `````` indicating turnout unknown (or possibly hidden.) Note: It is still the throttles responsibility to monitor the status broadcasts. (TBD I'm thinking that the existing broadcast is messy and needs cleaning up) @@ -57,16 +57,19 @@ Note: It is still the throttles responsibility to monitor the status broadcasts. Refer to EXRAIL ROSTER command for function map format. - TODO: + Obtaining throttle status. `````` Requests a deliberate update on the cab speed/functions in the same format as the cab broadcast. + `````` + Note that a slot of -1 indicates that the cab is not in the reminders table and this comand will not reserve a slot until such time as the cab is throttled. + COMMANDS TO AVOID `````` Use `````` - `````` + `````` Just drop the slot number `````` other than `````` `````` `````` - + diff --git a/WiThrottle.cpp b/WiThrottle.cpp index 7459a9c..29a8c3a 100644 --- a/WiThrottle.cpp +++ b/WiThrottle.cpp @@ -119,6 +119,7 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) { if (turnoutListHash != Turnout::turnoutlistHash) { StringFormatter::send(stream,F("PTL")); for(Turnout *tt=Turnout::first();tt!=NULL;tt=tt->next()){ + if (tt->isHidden()) continue; int id=tt->getId(); const FSH * tdesc=NULL; #ifdef EXRAIL_ACTIVE @@ -127,7 +128,7 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) { char tchar=Turnout::isClosed(id)?'2':'4'; if (tdesc==NULL) // turnout with no description StringFormatter::send(stream,F("]\\[%d}|{T%d}|{T%c"), id,id,tchar); - else if (GETFLASH(tdesc)!='*') // ignore hidden turnouts + else StringFormatter::send(stream,F("]\\[%d}|{%S}|{%c"), id,tdesc,tchar); } StringFormatter::send(stream,F("\n")); @@ -140,9 +141,9 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) { #ifdef EXRAIL_ACTIVE StringFormatter::send(stream,F("PRT]\\[Routes}|{Route]\\[Set}|{2]\\[Handoff}|{4\nPRL")); for (byte pass=0;pass<2;pass++) { - - for (int ix=0;;ix+=2) { - int16_t id=GETFLASHW((pass?RMFT2::routeIdList:RMFT2::automationIdList)+ix); + // first pass automations, second pass routes. + for (int ix=0;;ix++) { + int16_t id=GETFLASHW((pass?RMFT2::automationIdList:RMFT2::routeIdList)+ix); if (id==0) break; const FSH * desc=RMFT2::getRouteDescription(id); StringFormatter::send(stream,F("]\\[%c%d}|{%S}|{%c"),