mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
Assist notes draft & syntax tweaks
This commit is contained in:
parent
5846e0fe23
commit
bfb88bb30a
|
@ -519,11 +519,23 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
|||
switch(p[0]) {
|
||||
case HASH_KEYWORD_A: // <JA> returns automations/routes
|
||||
StringFormatter::send(stream, F("<jA"));
|
||||
if (params==1) {// <JA>
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
if (params==1) sendFlashList(stream,RMFT2::routeIdList);
|
||||
else StringFormatter::send(stream,F(" %d \"%S\""),
|
||||
id, RMFT2::getRouteDescription(id));
|
||||
sendFlashList(stream,RMFT2::automationIdList);
|
||||
sendFlashList(stream,RMFT2::routeIdList);
|
||||
#endif
|
||||
}
|
||||
else { // <JA id>
|
||||
StringFormatter::send(stream,F(" %d %c \"%S\""),
|
||||
id,
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
RMFT2::getRouteType(id), // A/R
|
||||
RMFT2::getRouteDescription(id)
|
||||
#else
|
||||
'X',F("")
|
||||
#endif
|
||||
);
|
||||
}
|
||||
StringFormatter::send(stream, F(">\n"));
|
||||
return;
|
||||
case HASH_KEYWORD_R: // <JR> returns rosters
|
||||
|
@ -540,15 +552,14 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
|||
if (params==1) { // <JT>
|
||||
for ( Turnout * t=Turnout::first(); t; t=t->next()) {
|
||||
if (t->isHidden()) continue;
|
||||
StringFormatter::send(stream, F(" %c%d"),
|
||||
t->isThrown()?'-':' ',t->getId());
|
||||
StringFormatter::send(stream, F(" %d"),t->getId());
|
||||
}
|
||||
}
|
||||
else { // <JT id>
|
||||
Turnout * t=Turnout::get(id);
|
||||
if (t && !t->isHidden())
|
||||
StringFormatter::send(stream, F(" %d \"%S\""),
|
||||
id,
|
||||
StringFormatter::send(stream, F(" %d %c \"%S\""),
|
||||
id,t->isThrown()?'T':'C',
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
RMFT2::getTurnoutDescription(id)
|
||||
#else
|
||||
|
|
13
EXRAIL2.cpp
13
EXRAIL2.cpp
|
@ -261,6 +261,19 @@ void RMFT2::setTurnoutHiddenState(Turnout * t) {
|
|||
t->setHidden(GETFLASH(getTurnoutDescription(t->getId()))==0x01);
|
||||
}
|
||||
|
||||
char RMFT2::getRouteType(int16_t id) {
|
||||
for (int16_t i=0;;i+=2) {
|
||||
int16_t rid= GETFLASHW(routeIdList+i);
|
||||
if (rid==id) return 'R';
|
||||
if (rid==0) break;
|
||||
}
|
||||
for (int16_t i=0;;i+=2) {
|
||||
int16_t rid= GETFLASHW(automationIdList+i);
|
||||
if (rid==id) return 'A';
|
||||
if (rid==0) break;
|
||||
}
|
||||
return 'X';
|
||||
}
|
||||
// This filter intercepts <> commands to do the following:
|
||||
// - Implement RMFT specific commands/diagnostics
|
||||
// - Reject/modify JMRI commands that would interfere with RMFT processing
|
||||
|
|
|
@ -97,8 +97,10 @@ class LookList {
|
|||
// Throttle Info Access functions built by exrail macros
|
||||
static const byte rosterNameCount;
|
||||
static const int16_t FLASH routeIdList[];
|
||||
static const int16_t FLASH automationIdList[];
|
||||
static const int16_t FLASH rosterIdList[];
|
||||
static const FSH * getRouteDescription(int16_t id);
|
||||
static char getRouteType(int16_t id);
|
||||
static const FSH * getTurnoutDescription(int16_t id);
|
||||
static const FSH * getRosterName(int16_t id);
|
||||
static const FSH * getRosterFunctions(int16_t id);
|
||||
|
|
|
@ -65,11 +65,16 @@
|
|||
#include "EXRAIL2MacroReset.h"
|
||||
#undef ROUTE
|
||||
#define ROUTE(id, description) id,
|
||||
#undef AUTOMATION
|
||||
#define AUTOMATION(id, description) -id,
|
||||
const int16_t FLASH RMFT2::routeIdList[]= {
|
||||
#include "myAutomation.h"
|
||||
0};
|
||||
// Pass 2a create throttle automation list
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
#undef AUTOMATION
|
||||
#define AUTOMATION(id, description) id,
|
||||
const int16_t FLASH RMFT2::automationIdList[]= {
|
||||
#include "myAutomation.h"
|
||||
0};
|
||||
|
||||
// Pass 3 Create route descriptions:
|
||||
#undef ROUTE
|
||||
|
|
55
Release_Notes/ThrottleAssists.md
Normal file
55
Release_Notes/ThrottleAssists.md
Normal file
|
@ -0,0 +1,55 @@
|
|||
Throttle Assist updates for versiuon 4.?
|
||||
|
||||
Chris Harlow April 2022
|
||||
|
||||
There are a number of additional throttle information commands that have been implemented to assist throttle authors to obtain information from the Command Station in order to implement turnout, route/automation and roster features which are already found in the Withrottle implementations.
|
||||
These commands are new and not overlapped with the existing commands which are probabaly due to be obsoleted as they are over complex and unfit for purpose.
|
||||
|
||||
Turnouts:
|
||||
|
||||
The conventional turnout definition commands and the ```<H>``` responses do not contain information about the turnout description which may have been provided in an EXRAIL script. A turnout description is much more user friendly than T123 and having a list helps the throttle UI build a suitable set of buttons.
|
||||
|
||||
```<JT>``` command returns a list of turnout ids. The throttle should be uninterested in the turnout technology used but needs to know the ids it can throw/close and monitor the current state.
|
||||
e.g. response ```<jT 1 17 22 19>```
|
||||
|
||||
```<JT 17>`` requests info on turnout 17.
|
||||
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.
|
||||
|
||||
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)
|
||||
However, I'm not keen on dynamically created/deleted turnouts so I have no intention of providing a command that indicates the turnout list has been updated since the throttle started.
|
||||
Also note that turnouts marked in EXRAIL with the HIDDEN keyword instead of a "description" will NOT show up in these commands.
|
||||
|
||||
|
||||
Automations/Routes
|
||||
|
||||
A throttle need to know which EXRAIL Automations and Routes it can show the user.
|
||||
|
||||
```<JA>``` Returns a list of Automations/Routes
|
||||
e.g. ```<jA 13 16 23>```
|
||||
Indicates route/automation ids.
|
||||
Information on each route needs to be obtained by
|
||||
```<JA 13>```
|
||||
returns e.g. ```<jA 13 R "description">``` for a route
|
||||
or ```<jA 13 A "description">``` for an automation.
|
||||
|
||||
Whats the difference:
|
||||
A Route is just a call to an EXRAIL ROUTE, traditionally to set some turnouts or signals but can be used to perform any kind of EXRAIL function... but its not expecting to know the loco.
|
||||
Thus a route can be triggered by sending in for example ```</START 13>```.
|
||||
|
||||
An Automation is a handoff of the last accessed loco id to an EXRAIL AUTOMATION which would typically drive the loco away.
|
||||
Thus an Automation expects a start command with a cab id
|
||||
e.g. ```</START 13 3>```
|
||||
|
||||
|
||||
Roster Information:
|
||||
The ```<JR>``` command requests a list of cab ids from the roster.
|
||||
e.g. responding ```<jR 3 200 6336>```
|
||||
or <jR> for none.
|
||||
|
||||
Each Roster entry had a name and descripotion
|
||||
|
||||
|
|
@ -139,14 +139,15 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
|
|||
exRailSent=true;
|
||||
#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(RMFT2::routeIdList+ix);
|
||||
int16_t id=GETFLASHW((pass?RMFT2::routeIdList:RMFT2::automationIdList)+ix);
|
||||
if (id==0) break;
|
||||
bool isRoute=id<0;
|
||||
if (isRoute) id=-id;
|
||||
const FSH * desc=RMFT2::getRouteDescription(id);
|
||||
StringFormatter::send(stream,F("]\\[%c%d}|{%S}|{%c"),
|
||||
isRoute?'R':'A',id,desc, isRoute?'2':'4');
|
||||
pass?'A':'R',id,desc, pass?'4':'2');
|
||||
}
|
||||
}
|
||||
StringFormatter::send(stream,F("\n"));
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user