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

Roster list part 1

This commit is contained in:
Asbelos 2021-12-26 18:24:04 +00:00
parent 7b8fa200f2
commit b7077565b9
4 changed files with 41 additions and 3 deletions

View File

@ -44,6 +44,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
OPCODE_ONCLOSE, OPCODE_ONTHROW, OPCODE_SERVOTURNOUT, OPCODE_PINTURNOUT, OPCODE_ONCLOSE, OPCODE_ONTHROW, OPCODE_SERVOTURNOUT, OPCODE_PINTURNOUT,
OPCODE_PRINT,OPCODE_DCCACTIVATE, OPCODE_PRINT,OPCODE_DCCACTIVATE,
OPCODE_ONACTIVATE,OPCODE_ONDEACTIVATE,OPCODE_IFGTE,OPCODE_IFLT, OPCODE_ONACTIVATE,OPCODE_ONDEACTIVATE,OPCODE_IFGTE,OPCODE_IFLT,
OPCODE_ROSTER,
OPCODE_ROUTE,OPCODE_AUTOMATION,OPCODE_SEQUENCE,OPCODE_ENDTASK,OPCODE_ENDEXRAIL OPCODE_ROUTE,OPCODE_AUTOMATION,OPCODE_SEQUENCE,OPCODE_ENDTASK,OPCODE_ENDEXRAIL
}; };
@ -84,7 +85,9 @@ class LookList {
static void turnoutEvent(int16_t id, bool closed); static void turnoutEvent(int16_t id, bool closed);
static void activateEvent(int16_t addr, bool active); static void activateEvent(int16_t addr, bool active);
static void emitTurnoutDescription(Print* stream,int16_t id); static void emitTurnoutDescription(Print* stream,int16_t id);
static const byte rosterNameCount;
static void emitWithrottleRoster(Print * stream);
static const FSH * getRosterFunctions(int16_t cabid);
private: private:
static void ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]); static void ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]);
static bool parseSlash(Print * stream, byte & paramCount, int16_t p[]) ; static bool parseSlash(Print * stream, byte & paramCount, int16_t p[]) ;

View File

@ -80,6 +80,7 @@
#undef RESUME #undef RESUME
#undef RETURN #undef RETURN
#undef REV #undef REV
#undef ROSTER
#undef ROUTE #undef ROUTE
#undef SENDLOCO #undef SENDLOCO
#undef SEQUENCE #undef SEQUENCE
@ -164,6 +165,7 @@
#define RETURN #define RETURN
#define REV(speed) #define REV(speed)
#define ROUTE(id, description) #define ROUTE(id, description)
#define ROSTER(cab,name,funcmap...)
#define SENDLOCO(cab,route) #define SENDLOCO(cab,route)
#define SEQUENCE(id) #define SEQUENCE(id)
#define SERIAL(msg) #define SERIAL(msg)

View File

@ -111,7 +111,38 @@ void RMFT2::emitTurnoutDescription(Print* stream,int16_t turnoutid) {
StringFormatter::send(stream,desc,turnoutid); StringFormatter::send(stream,desc,turnoutid);
} }
// Pass 5: create main routes table // Pass 5: Roster names (count)
#include "RMFT2MacroReset.h"
#undef ROSTER
#define ROSTER(cabid,name,funcmap...) +1
const byte RMFT2::rosterNameCount=0
#include "myAutomation.h"
;
// Pass 6: Roster names emitter
#include "RMFT2MacroReset.h"
#undef ROSTER
#define ROSTER(cabid,name,funcmap...) StringFormatter::send(stream,format,F(name),cabid,cabid<128?'S':'L');
void RMFT2::emitWithrottleRoster(Print * stream) {
static const FSH * format=F("]\\[%S}|{%d}|{%c");
StringFormatter::send(stream,F("RL%d"), rosterNameCount);
#include "myAutomation.h"
stream->write('\n');
}
// Pass 7: functions getter
#include "RMFT2MacroReset.h"
#undef ROSTER
#define ROSTER(cabid,name,funcmap...) case cabid: return F("" funcmap);
const FSH * RMFT2::getRosterFunctions(int16_t cabid) {
switch(cabid) {
#include "myAutomation.h"
default: return NULL;
}
}
// Last Pass : create main routes table
// Only undef the macros, not dummy them. // Only undef the macros, not dummy them.
#define RMFT2_UNDEF_ONLY #define RMFT2_UNDEF_ONLY
#include "RMFT2MacroReset.h" #include "RMFT2MacroReset.h"
@ -180,6 +211,7 @@ void RMFT2::emitTurnoutDescription(Print* stream,int16_t turnoutid) {
#define RESUME OPCODE_RESUME,0,0, #define RESUME OPCODE_RESUME,0,0,
#define RETURN OPCODE_RETURN,0,0, #define RETURN OPCODE_RETURN,0,0,
#define REV(speed) OPCODE_REV,V(speed), #define REV(speed) OPCODE_REV,V(speed),
#define ROSTER(cabid,name,funcmap...)
#define ROUTE(id, description) OPCODE_ROUTE, V(id), #define ROUTE(id, description) OPCODE_ROUTE, V(id),
#define SENDLOCO(cab,route) OPCODE_SENDLOCO,V(cab),OPCODE_PAD,V(route), #define SENDLOCO(cab,route) OPCODE_SENDLOCO,V(cab),OPCODE_PAD,V(route),
#define SEQUENCE(id) OPCODE_SEQUENCE, V(id), #define SEQUENCE(id) OPCODE_SEQUENCE, V(id),

View File

@ -133,6 +133,7 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
exRailSent=true; exRailSent=true;
#ifdef RMFT_ACTIVE #ifdef RMFT_ACTIVE
RMFT2::emitWithrottleRouteList(stream); RMFT2::emitWithrottleRouteList(stream);
RMFT2::emitWithrottleRoster(stream);
#endif #endif
} }
} }