mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
Make <s> output turnout state rather than full turnout definition.
<s> command currently prints the current states for outputs and for sensors, but prints the full configuration of turnouts. This change makes the turnout output consistent, i.e. just <H id state> is output for each turnout. The <T> command still outputs the full turnout definition.
This commit is contained in:
parent
133c65bc42
commit
d8366f33c8
|
@ -194,9 +194,7 @@
|
|||
// Display, on the specified stream, the current state of the turnout (1 or 0).
|
||||
void Turnout::printState(uint16_t id, Print *stream) {
|
||||
Turnout *tt = get(id);
|
||||
if (!tt)
|
||||
StringFormatter::send(stream, F("<H %d %d>\n"),
|
||||
id, tt->_turnoutData.closed ^ useLegacyTurnoutBehaviour);
|
||||
if (!tt) tt->printState(stream);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -119,6 +119,10 @@ public:
|
|||
inline bool isType(uint8_t type) { return _turnoutData.turnoutType == type; }
|
||||
inline uint16_t getId() { return _turnoutData.id; }
|
||||
inline Turnout *next() { return _nextTurnout; }
|
||||
inline void printState(Print *stream) {
|
||||
StringFormatter::send(stream, F("<H %d %d>\n"),
|
||||
_turnoutData.id, _turnoutData.closed ^ useLegacyTurnoutBehaviour);
|
||||
}
|
||||
/*
|
||||
* Virtual functions
|
||||
*/
|
||||
|
@ -170,7 +174,7 @@ public:
|
|||
|
||||
static void printAll(Print *stream) {
|
||||
for (Turnout *tt = _firstTurnout; tt != 0; tt = tt->_nextTurnout)
|
||||
tt->print(stream);
|
||||
tt->printState(stream);
|
||||
}
|
||||
|
||||
static void printState(uint16_t id, Print *stream);
|
||||
|
|
Loading…
Reference in New Issue
Block a user