diff --git a/DCC.cpp b/DCC.cpp index b969a8c..aec1662 100644 --- a/DCC.cpp +++ b/DCC.cpp @@ -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<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) diff --git a/version.h b/version.h index 8fd1185..3b96de1 100644 --- a/version.h +++ b/version.h @@ -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