1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-01-28 21:23:06 +01:00

changeFn fix

This commit is contained in:
Asbelos 2025-01-21 10:18:09 +00:00
parent 2f1d5b993c
commit fb6070784e
2 changed files with 5 additions and 9 deletions

11
DCC.cpp
View File

@ -268,14 +268,9 @@ bool DCC::setFn( int cab, int16_t functionNumber, bool on) {
// Flip function state (used from withrottle protocol)
void DCC::changeFn( int cab, int16_t functionNumber) {
if (cab<=0 || functionNumber>31) return;
auto slot=lookupSpeedTable(cab);
unsigned long funcmask = (1UL<<functionNumber);
slot->functions ^= funcmask;
if (functionNumber <= 28) {
updateGroupflags(slot->groupFlags, functionNumber);
}
CommandDistributor::broadcastLoco(slot);
auto currentValue=getFn(cab,functionNumber);
if (currentValue<0) return; // function not valid for change
setFn(cab,functionNumber, currentValue?false:true);
}
// Report function state (used from withrottle protocol)

View File

@ -3,7 +3,8 @@
#include "StringFormatter.h"
#define VERSION "5.5.8"
#define VERSION "5.5.9"
// 5.5.9 = (5.4.3) fix changeFn for functions 29..31
// 5.5.8 - EXSensorCam clean up to match other filters and
// - avoid need for config.h settings
// - Test: IO_I2CDFPlayer.h inserted 10mS deleay in Init_SC16IS752() just after soft-reset for board with 1.8432 Mhz xtal