From 926968bbd71b07e1916814d7c7d2d51a9b49ff3f Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sat, 1 Aug 2020 00:35:22 +0200 Subject: [PATCH] Function toggle but F2 --- DCC.cpp | 37 ++++++++++++++++++++++++------------- WiThrottle.cpp | 5 +++-- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/DCC.cpp b/DCC.cpp index ecc11af..c4c167f 100644 --- a/DCC.cpp +++ b/DCC.cpp @@ -1,5 +1,6 @@ /* * © 2020, Chris Harlow. All rights reserved. + * © 2020, Harald Barth * * This file is part of Asbelos DCC API * @@ -94,22 +95,32 @@ bool DCC::getThrottleDirection(int cab) { return (speedTable[reg].speedCode & 0x80) !=0; } - void DCC::setFn( int cab, byte functionNumber, bool on) { +void DCC::setFn( int cab, byte functionNumber, bool pressed) { if (cab<=0 || functionNumber>28) return; int reg = lookupSpeedTable(cab); if (reg<0) return; - // set the function on/off in the functions and set the group flag to - // say we have touched the particular group. - // A group will be reminded only if it has been touched. - if (on) speedTable[reg].functions |= (1L<