Skip to content

Commit

Permalink
5.4.2 bugfix fn31 flip
Browse files Browse the repository at this point in the history
  • Loading branch information
Asbelos committed Jan 20, 2025
1 parent 830de85 commit 2115ada
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
12 changes: 3 additions & 9 deletions DCC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,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;
int reg = lookupSpeedTable(cab);
if (reg<0) return;
unsigned long funcmask = (1UL<<functionNumber);
speedTable[reg].functions ^= funcmask;
if (functionNumber <= 28) {
updateGroupflags(speedTable[reg].groupFlags, functionNumber);
}
CommandDistributor::broadcastLoco(reg);
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)
Expand Down
3 changes: 2 additions & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

#include "StringFormatter.h"

#define VERSION "5.4.1"
#define VERSION "5.4.2"
// 5.4.2 - Bugfix function flip >28
// 5.4.1 - ESP32 bugfix packet buffer race
// 5.4.0 - New version on master
// 5.2.96 - EXRAIL additions XFWD() and XREV()
Expand Down

0 comments on commit 2115ada

Please sign in to comment.