1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-25 13:41:23 +01:00

Descriptions available

This commit is contained in:
peteGSX 2023-09-07 05:33:26 +10:00
parent 1f5f7754c1
commit 21ce87eb3e
2 changed files with 19 additions and 13 deletions

View File

@ -702,6 +702,7 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
if (tto->isHidden()) continue; if (tto->isHidden()) continue;
StringFormatter::send(stream, F(" %d"),tto->getId()); StringFormatter::send(stream, F(" %d"),tto->getId());
} }
StringFormatter::send(stream, F(">\n"));
} else { // <JO id> } else { // <JO id>
Turntable *tto=Turntable::get(id); Turntable *tto=Turntable::get(id);
if (!tto || tto->isHidden()) { if (!tto || tto->isHidden()) {
@ -711,19 +712,25 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
uint8_t type = tto->isEXTT(); uint8_t type = tto->isEXTT();
uint8_t posCount = tto->getPositionCount(); uint8_t posCount = tto->getPositionCount();
const FSH *todesc = NULL; const FSH *todesc = NULL;
const FSH *tpdesc = NULL;
#ifdef EXRAIL_ACTIVE #ifdef EXRAIL_ACTIVE
todesc = RMFT2::getTurntableDescription(id); todesc = RMFT2::getTurntableDescription(id);
#endif #endif
if (todesc == NULL) todesc = F(""); 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++) { for (uint8_t p = 0; p < posCount; p++) {
StringFormatter::send(stream, F("jO>"));
int16_t value = tto->getPositionValue(p); 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; return;
#endif #endif
default: break; default: break;

View File

@ -54,6 +54,8 @@
// 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 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 // helper macro for turnout description as HIDDEN
#define HIDDEN "\x01" #define HIDDEN "\x01"
@ -203,17 +205,14 @@ const FSH * RMFT2::getTurntableDescription(int16_t turntableId) {
} }
// Pass to get turntable position descriptions (optional) // Pass to get turntable position descriptions (optional)
// #include "EXRAIL2MacroReset.h" #include "EXRAIL2MacroReset.h"
// #undef TT_ADDPOSITION #undef TT_ADDPOSITION
// #define TT_ADDPOSITION(turntable_id,value,description...) O_DESC(turntable_id,description) #define TT_ADDPOSITION(turntable_id,position,value,description...) T_DESC(turntable_id,position,description)
// const FSH * RMFT2::getTurntablePositionDescription(int16_t turntableId, uint8_t positionId) { const FSH * RMFT2::getTurntablePositionDescription(int16_t turntableId, uint8_t positionId) {
// switch (turntableId) { #include "myAutomation.h"
// #include "myAutomation.h" return NULL;
// default:break; }
// }
// return NULL;
// }
// Pass 6: Roster IDs (count) // Pass 6: Roster IDs (count)
#include "EXRAIL2MacroReset.h" #include "EXRAIL2MacroReset.h"