1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 01:56:14 +01:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Asbelos
916d3baf63 Merge branch 'devel' into devel_momentum 2024-07-19 10:14:06 +01:00
Asbelos
27dc8059d7 Broadcast loco forgets. 2024-07-19 09:29:43 +01:00
4 changed files with 12 additions and 2 deletions

View File

@ -248,6 +248,10 @@ void CommandDistributor::broadcastLoco(byte slot) {
#endif #endif
} }
void CommandDistributor::broadcastForgetLoco(int16_t loco) {
broadcastReply(COMMAND_TYPE, F("<l %d 0 1 0>\n<- %d>\n"), loco,loco);
}
void CommandDistributor::broadcastPower() { void CommandDistributor::broadcastPower() {
char pstr[] = "? x"; char pstr[] = "? x";
for(byte t=0; t<TrackManager::MAX_TRACKS; t++) for(byte t=0; t<TrackManager::MAX_TRACKS; t++)

View File

@ -47,6 +47,7 @@ private:
public : public :
static void parse(byte clientId,byte* buffer, RingStream * ring); static void parse(byte clientId,byte* buffer, RingStream * ring);
static void broadcastLoco(byte slot); static void broadcastLoco(byte slot);
static void broadcastForgetLoco(int16_t loco);
static void broadcastSensor(int16_t id, bool value); static void broadcastSensor(int16_t id, bool value);
static void broadcastTurnout(int16_t id, bool isClosed); static void broadcastTurnout(int16_t id, bool isClosed);
static void broadcastTurntable(int16_t id, uint8_t position, bool moving); static void broadcastTurntable(int16_t id, uint8_t position, bool moving);

View File

@ -755,11 +755,15 @@ void DCC::forgetLoco(int cab) { // removes any speed reminders for this loco
if (reg>=0) { if (reg>=0) {
speedTable[reg].loco=0; speedTable[reg].loco=0;
setThrottle2(cab,1); // ESTOP if this loco still on track setThrottle2(cab,1); // ESTOP if this loco still on track
CommandDistributor::broadcastForgetLoco(cab);
} }
} }
void DCC::forgetAllLocos() { // removes all speed reminders void DCC::forgetAllLocos() { // removes all speed reminders
setThrottle2(0,1); // ESTOP all locos still on track setThrottle2(0,1); // ESTOP all locos still on track
for (int i=0;i<MAX_LOCOS;i++) speedTable[i].loco=0; for (int i=0;i<MAX_LOCOS;i++) {
if (speedTable[i].loco) CommandDistributor::broadcastForgetLoco(speedTable[i].loco);
speedTable[i].loco=0;
}
} }
byte DCC::loopStatus=0; byte DCC::loopStatus=0;

View File

@ -3,7 +3,8 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "5.2.70" #define VERSION "5.2.71"
// 5.2.71 - Broadcasts of loco forgets.
// 5.2.70 - IO_RocoDriver renamed to IO_EncoderThrottle. // 5.2.70 - IO_RocoDriver renamed to IO_EncoderThrottle.
// - and included in IODEvice.h (circular dependency removed) // - and included in IODEvice.h (circular dependency removed)
// 5.2.69 - IO_RocoDriver. Direct drive train with rotary encoder hw. // 5.2.69 - IO_RocoDriver. Direct drive train with rotary encoder hw.