mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-27 01:56:14 +01:00
add turnout, sensor and output states to 's'tatus message (#108)
* add support for FireBox_Mk1, reduce heartbeat, separate eStop time * make match master * make match master * Update defines.h * FIX: return WiThrottle speedstep, not DCC speedstep, in response to speed change request. Should close #104 * use int, not byte for witSpeed * add turnout, sensor and output states to 's'tatus message
This commit is contained in:
parent
5f21716055
commit
9d92fd9451
|
@ -445,8 +445,10 @@ void DCCEXParser::parse(Print *stream, byte *com, bool blocking)
|
||||||
case 's': // <s>
|
case 's': // <s>
|
||||||
StringFormatter::send(stream, F("<p%d>"), DCCWaveform::mainTrack.getPowerMode() == POWERMODE::ON);
|
StringFormatter::send(stream, F("<p%d>"), DCCWaveform::mainTrack.getPowerMode() == POWERMODE::ON);
|
||||||
StringFormatter::send(stream, F("<iDCC-EX V-%S / %S / %S G-%S>"), F(VERSION), F(ARDUINO_TYPE), DCC::getMotorShieldName(), F(GITHUB_SHA));
|
StringFormatter::send(stream, F("<iDCC-EX V-%S / %S / %S G-%S>"), 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 stats of speed reminders table
|
||||||
// TODO send status of turnouts etc etc
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 'E': // STORE EPROM <E>
|
case 'E': // STORE EPROM <E>
|
||||||
|
@ -589,7 +591,7 @@ bool DCCEXParser::parseT(Print *stream, int params, int p[])
|
||||||
{
|
{
|
||||||
switch (params)
|
switch (params)
|
||||||
{
|
{
|
||||||
case 0: // <T> show all turnouts
|
case 0: // <T> list all turnout states
|
||||||
{
|
{
|
||||||
bool gotOne = false;
|
bool gotOne = false;
|
||||||
for (Turnout *tt = Turnout::firstTurnout; tt != NULL; tt = tt->nextTurnout)
|
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("<O>"));
|
StringFormatter::send(stream, F("<O>"));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 0: // <S> lit sensor states
|
case 0: // <S> list sensor states
|
||||||
if (Sensor::firstSensor == NULL)
|
if (Sensor::firstSensor == NULL)
|
||||||
return false;
|
return false;
|
||||||
for (Sensor *tt = Sensor::firstSensor; tt != NULL; tt = tt->nextSensor)
|
for (Sensor *tt = Sensor::firstSensor; tt != NULL; tt = tt->nextSensor)
|
||||||
|
|
|
@ -83,7 +83,13 @@ the state of any outputs being monitored or controlled by a separate interface o
|
||||||
|
|
||||||
#include "Outputs.h"
|
#include "Outputs.h"
|
||||||
#include "EEStore.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("<Y %d %d>"), tt->data.id, tt->data.oStatus);
|
||||||
|
} // Output::printAll
|
||||||
|
|
||||||
void Output::activate(int s){
|
void Output::activate(int s){
|
||||||
data.oStatus=(s>0); // if s>0, set status to active, else inactive
|
data.oStatus=(s>0); // if s>0, set status to active, else inactive
|
||||||
|
|
|
@ -39,6 +39,7 @@ class Output{
|
||||||
static Output *firstOutput;
|
static Output *firstOutput;
|
||||||
struct OutputData data;
|
struct OutputData data;
|
||||||
Output *nextOutput;
|
Output *nextOutput;
|
||||||
|
static void printAll(Print *);
|
||||||
private:
|
private:
|
||||||
int num; // Chris has no idea what this is all about!
|
int num; // Chris has no idea what this is all about!
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user