diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index e4949ce..0a78676 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -445,9 +445,11 @@ void DCCEXParser::parse(Print *stream, byte *com, bool blocking) case 's': // StringFormatter::send(stream, F(""), DCCWaveform::mainTrack.getPowerMode() == POWERMODE::ON); StringFormatter::send(stream, F(""), F(VERSION), F(ARDUINO_TYPE), DCC::getMotorShieldName(), F(GITHUB_SHA)); + parseT(stream, 0, p); //send all Turnout states + Output::printAll(stream); //send all Output states + Sensor::printAll(stream); //send all Sensor states // TODO Send stats of speed reminders table - // TODO send status of turnouts etc etc - return; + return; case 'E': // STORE EPROM EEStore::store(); @@ -589,7 +591,7 @@ bool DCCEXParser::parseT(Print *stream, int params, int p[]) { switch (params) { - case 0: // show all turnouts + case 0: // list all turnout states { bool gotOne = false; for (Turnout *tt = Turnout::firstTurnout; tt != NULL; tt = tt->nextTurnout) @@ -644,7 +646,7 @@ bool DCCEXParser::parseS(Print *stream, int params, int p[]) StringFormatter::send(stream, F("")); return true; - case 0: // lit sensor states + case 0: // list sensor states if (Sensor::firstSensor == NULL) return false; for (Sensor *tt = Sensor::firstSensor; tt != NULL; tt = tt->nextSensor) diff --git a/Outputs.cpp b/Outputs.cpp index 84290fe..b135d0f 100644 --- a/Outputs.cpp +++ b/Outputs.cpp @@ -83,7 +83,13 @@ the state of any outputs being monitored or controlled by a separate interface o #include "Outputs.h" #include "EEStore.h" +#include "StringFormatter.h" +// print all output states to stream +void Output::printAll(Print *stream){ + for (Output *tt = Output::firstOutput; tt != NULL; tt = tt->nextOutput) + StringFormatter::send(stream, F(""), tt->data.id, tt->data.oStatus); +} // Output::printAll void Output::activate(int s){ data.oStatus=(s>0); // if s>0, set status to active, else inactive diff --git a/Outputs.h b/Outputs.h index 891cd9b..319f704 100644 --- a/Outputs.h +++ b/Outputs.h @@ -39,6 +39,7 @@ class Output{ static Output *firstOutput; struct OutputData data; Output *nextOutput; + static void printAll(Print *); private: int num; // Chris has no idea what this is all about!