1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-02-17 06:29:15 +01:00

Broadcast if group changed

This commit is contained in:
Asbelos 2021-12-14 11:50:59 +00:00
parent 985f0e777c
commit 96933ed516

10
DCC.cpp
View File

@ -179,15 +179,17 @@ void DCC::setFn( int cab, int16_t functionNumber, bool on) {
// Take care of functions: // Take care of functions:
// Set state of function // Set state of function
unsigned long previous=speedTable[reg].functions;
unsigned long funcmask = (1UL<<functionNumber); unsigned long funcmask = (1UL<<functionNumber);
if (on) { if (on) {
speedTable[reg].functions |= funcmask; speedTable[reg].functions |= funcmask;
} else { } else {
speedTable[reg].functions &= ~funcmask; speedTable[reg].functions &= ~funcmask;
} }
updateGroupflags(speedTable[reg].groupFlags, functionNumber); if (speedTable[reg].functions != previous) {
CommandDistributor::broadcastLoco(reg); updateGroupflags(speedTable[reg].groupFlags, functionNumber);
return; CommandDistributor::broadcastLoco(reg);
}
} }
// Change function according to how button was pressed, // Change function according to how button was pressed,