Skip to content

Commit

Permalink
Cleanup of DCC Class reminders
Browse files Browse the repository at this point in the history
  • Loading branch information
Asbelos committed Jul 22, 2024
1 parent 002ec5f commit a081953
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 130 deletions.
10 changes: 7 additions & 3 deletions CommandDistributor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,13 @@ int16_t CommandDistributor::retClockTime() {
return lastclocktime;
}

void CommandDistributor::broadcastLoco(byte slot) {
DCC::LOCO * sp=&DCC::speedTable[slot];
broadcastReply(COMMAND_TYPE, F("<l %d %d %d %l>\n"), sp->loco,slot,sp->targetSpeed,sp->functions);
void CommandDistributor::broadcastLoco(DCC::LOCO* sp) {
if (!sp) {
broadcastReply(COMMAND_TYPE,F("<l 0 -1 128 0>\n"));
return;
}
broadcastReply(COMMAND_TYPE, F("<l %d 0 %d %l>\n"),
sp->loco,sp->targetSpeed,sp->functions);
#ifdef SABERTOOTH
if (Serial2 && sp->loco == SABERTOOTH) {
static uint8_t rampingmode = 0;
Expand Down
3 changes: 2 additions & 1 deletion CommandDistributor.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "StringBuffer.h"
#include "defines.h"
#include "EXRAIL2.h"
#include "DCC.h"

#if WIFI_ON | ETHERNET_ON
// Command Distributor must handle a RingStream of clients
Expand All @@ -46,7 +47,7 @@ class CommandDistributor {
#endif
public :
static void parse(byte clientId,byte* buffer, RingStream * ring);
static void broadcastLoco(byte slot);
static void broadcastLoco(DCC::LOCO * slot);
static void broadcastForgetLoco(int16_t loco);
static void broadcastSensor(int16_t id, bool value);
static void broadcastTurnout(int16_t id, bool isClosed);
Expand Down
Loading

0 comments on commit a081953

Please sign in to comment.