From 93446f19eda0ca88b26ab8f92792229296f6bcb5 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sat, 1 Aug 2020 14:06:39 +0200 Subject: [PATCH] Two functions changeFn and setFn dependent on if called from WiThrottle or DCCEXparser --- DCC.cpp | 53 +++++++++++++++++++++++++++++++++++++++++--------- DCC.h | 4 +++- WiThrottle.cpp | 8 ++++++-- 3 files changed, 53 insertions(+), 12 deletions(-) diff --git a/DCC.cpp b/DCC.cpp index c4c167f..8b70e5d 100644 --- a/DCC.cpp +++ b/DCC.cpp @@ -95,32 +95,67 @@ bool DCC::getThrottleDirection(int cab) { return (speedTable[reg].speedCode & 0x80) !=0; } -void DCC::setFn( int cab, byte functionNumber, bool pressed) { +void DCC::setFn( int cab, byte functionNumber, bool on) { if (cab<=0 || functionNumber>28) return; int reg = lookupSpeedTable(cab); if (reg<0) return; + // Take care of functions: + // Set state of function + unsigned long funcmask = (1L<28) return funcstate; + int reg = lookupSpeedTable(cab); + if (reg<0) return funcstate; + // Take care of functions: // Imitate how many command stations do it: Button press is // toggle but for F2 where it is momentary + unsigned long funcmask = (1L<F%d%d\n"), throttleChar, LorS(myLocos[loco].cab), + myLocos[loco].cab, funcstate, fKey); + } } break; case 'q':