1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-22 15: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

@ -566,21 +566,21 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
StringFormatter::send(stream, F("<jT"));
if (params==1) { // <JT>
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 { // <JT id>
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;

View File

@ -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;

View File

@ -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"

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">```
(T=thrown, C=closed)
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.
(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.
```<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
```<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>```
```<s>```
```<c>```

View File

@ -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"),