mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 17:46:14 +01:00
Fixing broadcast
This commit is contained in:
parent
b8293d07f2
commit
18695888dd
|
@ -69,12 +69,7 @@ void CommandDistributor::broadcast() {
|
|||
for (byte clientId=0; clientId<sizeof(clients); clientId++) {
|
||||
if (clients[clientId]==NONE_TYPE) continue;
|
||||
ring->mark(clientId);
|
||||
|
||||
if (clients[clientId]==COMMAND_TYPE) broadcastBufferWriter->printBuffer(ring);
|
||||
else if (clients[clientId]==WITHROTTLE_TYPE) {
|
||||
// TODO... withrottle broadcasts?
|
||||
}
|
||||
|
||||
broadcastBufferWriter->printBuffer(ring);
|
||||
ring->commit();
|
||||
}
|
||||
if (ringClient!=NO_CLIENT) ring->mark(ringClient);
|
||||
|
@ -90,7 +85,10 @@ void CommandDistributor::broadcastSensor(int16_t id, bool on ) {
|
|||
|
||||
void CommandDistributor::broadcastTurnout(int16_t id, bool isClosed ) {
|
||||
// For DCC++ classic compatibility, state reported to JMRI is 1 for thrown and 0 for closed;
|
||||
StringFormatter::send(broadcastBufferWriter,F("<H %d %d>\n"),id, !isClosed);
|
||||
// The string below contains serial and Withrottle protocols which should
|
||||
// be safe for both types.
|
||||
StringFormatter::send(broadcastBufferWriter,
|
||||
F("<H %d %d>\nPTA%c%d\n"),id, !isClosed, isClosed?'2':'4', id);
|
||||
broadcast();
|
||||
}
|
||||
|
||||
|
|
|
@ -229,6 +229,7 @@ void DCCEXParser::setAtCommandCallback(AT_COMMAND_CALLBACK callback)
|
|||
|
||||
// Parse an F() string
|
||||
void DCCEXParser::parse(const FSH * cmd) {
|
||||
DIAG(F("SETUP(\"%S\")"),cmd);
|
||||
int size=strlen_P((char *)cmd)+1;
|
||||
char buffer[size];
|
||||
strcpy_P(buffer,(char *)cmd);
|
||||
|
|
|
@ -44,14 +44,14 @@ void SerialManager::init() {
|
|||
}
|
||||
|
||||
void SerialManager::broadcast(RingStream * ring) {
|
||||
for (SerialManager * s;s;s=s->next) s->broadcast2(ring);
|
||||
for (SerialManager * s=first;s;s=s->next) s->broadcast2(ring);
|
||||
}
|
||||
void SerialManager::broadcast2(RingStream * ring) {
|
||||
ring->printBuffer(serial);
|
||||
}
|
||||
|
||||
void SerialManager::loop() {
|
||||
for (SerialManager * s;s;s=s->next) s->loop2();
|
||||
for (SerialManager * s=first;s;s=s->next) s->loop2();
|
||||
}
|
||||
|
||||
void SerialManager::loop2() {
|
||||
|
|
|
@ -136,8 +136,7 @@
|
|||
bool ok = tt->setClosedInternal(closeFlag);
|
||||
|
||||
if (ok) {
|
||||
turnoutlistHash++; // let withrottle know something changed
|
||||
|
||||
|
||||
#ifndef DISABLE_EEPROM
|
||||
// Write byte containing new closed/thrown state to EEPROM if required. Note that eepromAddress
|
||||
// is always zero for LCN turnouts.
|
||||
|
|
Loading…
Reference in New Issue
Block a user