1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 17:46:14 +01:00

Subtle corrections

This commit is contained in:
Asbelos 2022-04-12 23:10:29 +01:00
parent 20b12bcb7c
commit 28a4406044
5 changed files with 23 additions and 19 deletions

View File

@ -572,8 +572,8 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
} }
else { // <JT id> else { // <JT id>
Turnout * t=Turnout::get(id); Turnout * t=Turnout::get(id);
if (t && !t->isHidden()) if (!t || t->isHidden()) StringFormatter::send(stream, F(" %d X"),id);
StringFormatter::send(stream, F(" %d %c \"%S\""), else StringFormatter::send(stream, F(" %d %c \"%S\""),
id,t->isThrown()?'T':'C', id,t->isThrown()?'T':'C',
#ifdef EXRAIL_ACTIVE #ifdef EXRAIL_ACTIVE
RMFT2::getTurnoutDescription(id) RMFT2::getTurnoutDescription(id)

View File

@ -262,12 +262,12 @@ void RMFT2::setTurnoutHiddenState(Turnout * t) {
} }
char RMFT2::getRouteType(int16_t id) { 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); int16_t rid= GETFLASHW(routeIdList+i);
if (rid==id) return 'R'; if (rid==id) return 'R';
if (rid==0) break; if (rid==0) break;
} }
for (int16_t i=0;;i+=2) { for (int16_t i=0;;i++) {
int16_t rid= GETFLASHW(automationIdList+i); int16_t rid= GETFLASHW(automationIdList+i);
if (rid==id) return 'A'; if (rid==id) return 'A';
if (rid==0) break; if (rid==0) break;

View File

@ -53,7 +53,7 @@
// helper macro for turnout descriptions, creates NULL for missing description // helper macro for turnout descriptions, creates NULL for missing description
#define O_DESC(id, desc) case id: return ("" desc)[0]?F("" desc):NULL; #define O_DESC(id, desc) case id: return ("" desc)[0]?F("" desc):NULL;
// helper macro for turnout description as HIDDEN // helper macro for turnout description as HIDDEN
#define HIDDEN "\0x01" #define HIDDEN "\x01"
// Pass 1 Implements aliases // Pass 1 Implements aliases
#include "EXRAIL2MacroReset.h" #include "EXRAIL2MacroReset.h"

View File

@ -16,7 +16,7 @@ e.g. response ```<jT 1 17 22 19>```
e.g. response ```<jT 17 T "Coal yard exit">``` or ```<jT 17 C "Coal yard exit">``` e.g. response ```<jT 17 T "Coal yard exit">``` or ```<jT 17 C "Coal yard exit">```
(T=thrown, C=closed) (T=thrown, C=closed)
or ```<jT 17 C "">``` indicating turnout description not given. or ```<jT 17 C "">``` indicating turnout description not given.
or ```<jT 17 X>``` indicating turnout unknown. or ```<jT 17 X>``` indicating turnout unknown (or possibly hidden.)
Note: It is still the throttles responsibility to monitor the status broadcasts. 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) (TBD I'm thinking that the existing broadcast is messy and needs cleaning up)
@ -57,13 +57,16 @@ Note: It is still the throttles responsibility to monitor the status broadcasts.
Refer to EXRAIL ROSTER command for function map format. Refer to EXRAIL ROSTER command for function map format.
TODO: Obtaining throttle status.
```<t cabid>``` Requests a deliberate update on the cab speed/functions in the same format as the cab broadcast. ```<t cabid>``` Requests a deliberate update on the cab speed/functions in the same format as the cab broadcast.
```<l cabid slot speedbyte functionMap>```
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 COMMANDS TO AVOID
```<f cab func1 func2>``` Use ```<F cab function 1/0>``` ```<f cab func1 func2>``` Use ```<F cab function 1/0>```
```<t slot cab speed dir>``` ```<t slot cab speed dir>``` Just drop the slot number
```<T commands>``` other than ```<T id 0/1>``` ```<T commands>``` other than ```<T id 0/1>```
```<s>``` ```<s>```
```<c>``` ```<c>```

View File

@ -119,6 +119,7 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
if (turnoutListHash != Turnout::turnoutlistHash) { if (turnoutListHash != Turnout::turnoutlistHash) {
StringFormatter::send(stream,F("PTL")); StringFormatter::send(stream,F("PTL"));
for(Turnout *tt=Turnout::first();tt!=NULL;tt=tt->next()){ for(Turnout *tt=Turnout::first();tt!=NULL;tt=tt->next()){
if (tt->isHidden()) continue;
int id=tt->getId(); int id=tt->getId();
const FSH * tdesc=NULL; const FSH * tdesc=NULL;
#ifdef EXRAIL_ACTIVE #ifdef EXRAIL_ACTIVE
@ -127,7 +128,7 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
char tchar=Turnout::isClosed(id)?'2':'4'; char tchar=Turnout::isClosed(id)?'2':'4';
if (tdesc==NULL) // turnout with no description if (tdesc==NULL) // turnout with no description
StringFormatter::send(stream,F("]\\[%d}|{T%d}|{T%c"), id,id,tchar); 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("]\\[%d}|{%S}|{%c"), id,tdesc,tchar);
} }
StringFormatter::send(stream,F("\n")); StringFormatter::send(stream,F("\n"));
@ -140,9 +141,9 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
#ifdef EXRAIL_ACTIVE #ifdef EXRAIL_ACTIVE
StringFormatter::send(stream,F("PRT]\\[Routes}|{Route]\\[Set}|{2]\\[Handoff}|{4\nPRL")); StringFormatter::send(stream,F("PRT]\\[Routes}|{Route]\\[Set}|{2]\\[Handoff}|{4\nPRL"));
for (byte pass=0;pass<2;pass++) { for (byte pass=0;pass<2;pass++) {
// first pass automations, second pass routes.
for (int ix=0;;ix+=2) { for (int ix=0;;ix++) {
int16_t id=GETFLASHW((pass?RMFT2::routeIdList:RMFT2::automationIdList)+ix); int16_t id=GETFLASHW((pass?RMFT2::automationIdList:RMFT2::routeIdList)+ix);
if (id==0) break; if (id==0) break;
const FSH * desc=RMFT2::getRouteDescription(id); const FSH * desc=RMFT2::getRouteDescription(id);
StringFormatter::send(stream,F("]\\[%c%d}|{%S}|{%c"), StringFormatter::send(stream,F("]\\[%c%d}|{%S}|{%c"),