From 79a318b4554d410f52ca5ff49e37d36885b1048c Mon Sep 17 00:00:00 2001 From: mstevetodd Date: Mon, 8 Mar 2021 21:46:08 -0500 Subject: [PATCH] fix initial fn strings, return value of F16-F28 (#132) * Committing a SHA * fix initial fn strings, return value of F16-F28 --- DCC.cpp | 4 ++-- WiThrottle.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DCC.cpp b/DCC.cpp index 1ff28f1..6fe07c1 100644 --- a/DCC.cpp +++ b/DCC.cpp @@ -155,9 +155,9 @@ int DCC::changeFn( int cab, byte functionNumber, bool pressed) { } else { // toggle function on press, ignore release if (pressed) { - speedTable[reg].functions ^= funcmask; + speedTable[reg].functions ^= funcmask; } - funcstate = speedTable[reg].functions & funcmask; + funcstate = (speedTable[reg].functions & funcmask)? 1 : 0; } updateGroupflags(speedTable[reg].groupFlags, functionNumber); return funcstate; diff --git a/WiThrottle.cpp b/WiThrottle.cpp index 62b638d..e3c817a 100644 --- a/WiThrottle.cpp +++ b/WiThrottle.cpp @@ -236,7 +236,7 @@ void WiThrottle::multithrottle(RingStream * stream, byte * cmd){ //Get known Fn states from DCC for(int fKey=0; fKey<=28; fKey++) { int fstate=DCC::getFn(locoid,fKey); - if (fstate>=0) StringFormatter::send(stream,F("M%cA%c<;>F%d%d\n"),throttleChar,cmd[3],fstate,fKey); + if (fstate>=0) StringFormatter::send(stream,F("M%cA%c%d<;>F%d%d\n"),throttleChar,cmd[3],locoid,fstate,fKey); } StringFormatter::send(stream, F("M%cA%c%d<;>V%d\n"), throttleChar, cmd[3], locoid, DCCToWiTSpeed(DCC::getThrottleSpeed(locoid))); StringFormatter::send(stream, F("M%cA%c%d<;>R%d\n"), throttleChar, cmd[3], locoid, DCC::getThrottleDirection(locoid));