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

When sending all turnouts, keep it short

This commit is contained in:
Harald Barth 2022-11-04 23:15:29 +01:00
parent be2f3b0db7
commit c0cb643cb5
3 changed files with 9 additions and 12 deletions

View File

@ -730,15 +730,7 @@ bool DCCEXParser::parseT(Print *stream, int16_t params, int16_t p[])
switch (params)
{
case 0: // <T> list turnout definitions
{
bool gotOne = false;
for (Turnout *tt = Turnout::first(); tt != NULL; tt = tt->next())
{
gotOne = true;
tt->print(stream);
}
return gotOne; // will <X> if none found
}
return Turnout::printAll(stream); // will <X> if none found
case 1: // <T id> delete turnout
if (!Turnout::remove(p[0]))

View File

@ -1 +1 @@
#define GITHUB_SHA "devel-202211041507Z"
#define GITHUB_SHA "devel-202211042214Z"

View File

@ -171,9 +171,14 @@ public:
// Save all turnout definitions
static void store();
#endif
static void printAll(Print *stream) {
static bool printAll(Print *stream) {
bool gotOne=false;
for (Turnout *tt = _firstTurnout; tt != 0; tt = tt->_nextTurnout)
if (!tt->isHidden()) StringFormatter::send(stream, F("<H %d %d>\n"),tt->getId(), tt->isThrown());
if (!tt->isHidden()) {
gotOne=true;
StringFormatter::send(stream, F("<H %d %d>\n"),tt->getId(), tt->isThrown());
}
return gotOne;
}