From 2f860e594c4371e2af89bc35807e084a9bbdb7c0 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 16 Mar 2021 23:20:30 +0100 Subject: [PATCH] clearer binary arith. --- DCC.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DCC.cpp b/DCC.cpp index b676331..d8284f6 100644 --- a/DCC.cpp +++ b/DCC.cpp @@ -101,7 +101,7 @@ void DCC::setThrottle2( uint16_t cab, byte speedCode) { } // Construct command byte from: // command speed direction - b[nB++] = 0b01000000 | code28 | (0b00100000 * (speedCode & 0x80)); + b[nB++] = 0b01000000 | code28 | ((speedCode & 0x80) ? 0b00100000 : 0); } else { // 128 speedsteps