mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 21:21:24 +01:00
Descriptions available
This commit is contained in:
parent
1f5f7754c1
commit
21ce87eb3e
@ -702,6 +702,7 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||
if (tto->isHidden()) continue;
|
||||
StringFormatter::send(stream, F(" %d"),tto->getId());
|
||||
}
|
||||
StringFormatter::send(stream, F(">\n"));
|
||||
} else { // <JO id>
|
||||
Turntable *tto=Turntable::get(id);
|
||||
if (!tto || tto->isHidden()) {
|
||||
@ -711,19 +712,25 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||
uint8_t type = tto->isEXTT();
|
||||
uint8_t posCount = tto->getPositionCount();
|
||||
const FSH *todesc = NULL;
|
||||
const FSH *tpdesc = NULL;
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
todesc = RMFT2::getTurntableDescription(id);
|
||||
#endif
|
||||
if (todesc == NULL) todesc = F("");
|
||||
StringFormatter::send(stream, F(" %d %d %d"), id, type, pos, todesc);
|
||||
StringFormatter::send(stream, F(" %d %d %d %d \"%S\">\n"), id, type, pos, posCount, todesc);
|
||||
|
||||
for (uint8_t p = 0; p < posCount; p++) {
|
||||
StringFormatter::send(stream, F("jO>"));
|
||||
int16_t value = tto->getPositionValue(p);
|
||||
StringFormatter::send(stream, F(" %d"), value);
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
tpdesc = RMFT2::getTurntablePositionDescription(id, p);
|
||||
#endif
|
||||
if (tpdesc == NULL) todesc = F("");
|
||||
StringFormatter::send(stream, F(" %d \"%S\""), value, tpdesc);
|
||||
StringFormatter::send(stream, F(">\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
StringFormatter::send(stream, F(">\n"));
|
||||
return;
|
||||
#endif
|
||||
default: break;
|
||||
|
@ -54,6 +54,8 @@
|
||||
|
||||
// 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 turntable descriptions, creates NULL for missing description
|
||||
#define T_DESC(tid,pid,desc) if(turntableId==tid && positionId==pid) return ("" desc)[0]?F("" desc):NULL;
|
||||
// helper macro for turnout description as HIDDEN
|
||||
#define HIDDEN "\x01"
|
||||
|
||||
@ -203,17 +205,14 @@ const FSH * RMFT2::getTurntableDescription(int16_t turntableId) {
|
||||
}
|
||||
|
||||
// Pass to get turntable position descriptions (optional)
|
||||
// #include "EXRAIL2MacroReset.h"
|
||||
// #undef TT_ADDPOSITION
|
||||
// #define TT_ADDPOSITION(turntable_id,value,description...) O_DESC(turntable_id,description)
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
#undef TT_ADDPOSITION
|
||||
#define TT_ADDPOSITION(turntable_id,position,value,description...) T_DESC(turntable_id,position,description)
|
||||
|
||||
// const FSH * RMFT2::getTurntablePositionDescription(int16_t turntableId, uint8_t positionId) {
|
||||
// switch (turntableId) {
|
||||
// #include "myAutomation.h"
|
||||
// default:break;
|
||||
// }
|
||||
// return NULL;
|
||||
// }
|
||||
const FSH * RMFT2::getTurntablePositionDescription(int16_t turntableId, uint8_t positionId) {
|
||||
#include "myAutomation.h"
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Pass 6: Roster IDs (count)
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
|
Loading…
Reference in New Issue
Block a user