DCC-EX / CommandStation-EX

EX-CommandStation firmware from DCC-EX. Includes support for WiFi and a standalone WiThrottle server. A complete re-write of the original DCC++.
https://dcc-ex.github.io/
GNU General Public License v3.0
154 stars 104 forks source link

Allow throttles to request the current track power status. #257

Closed alex-code closed 1 year ago

alex-code commented 1 year ago

Allow a throttle to request the current track power status. The <*> command will run CommandDistributor::broadcastPower();.

@DCC-EX/developers Is the overhead of CommandDistributor::broadcastPower(); worth breaking out the code a bit more so only the requester receives the result instead of a broadcast?

habazut commented 1 year ago

I'd rather implement commands like status power status cabs status ... as extension to <s> Harald.

alex-code commented 1 year ago

So something a bit like?

// DCCEXParser::parseOne
case 's': // <s>
  parseLowerS(stream, params, p);
  return;
// ...

void parseLowerS(Print *stream, int16_t params, int16_t p[]) {
  switch (p[0]) {
    case 'T':
      Turnout::printAll(stream);
      return;
    case 'O':
      Output::printAll(stream);
      return;
    case 'S':
      Sensor::printAll(stream);
      return;
  }
}
habazut commented 1 year ago

Yes, with <s X> you get detail X and with <s> only you get all of it. At least an idea. Sounds useful?

Harald.

PS: I will never learn to quote < in this markdown