From 79ef114c0d78bd487f3a7a4c1dfdb1c15fec1830 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sat, 21 May 2022 09:51:38 +0200 Subject: [PATCH] protect from setting unused pin --- MotorDriver.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MotorDriver.cpp b/MotorDriver.cpp index 30dd1be..701816a 100644 --- a/MotorDriver.cpp +++ b/MotorDriver.cpp @@ -160,6 +160,8 @@ int MotorDriver::getCurrentRaw() { } void MotorDriver::setDCSignal(byte speedcode) { + if (brakePin == UNUSED_PIN) + return; // spedcoode is a dcc speed /direction byte tSpeed=speedcode & 0x7F; // DCC Speed with 0,1 stop and speed steps 2 to 127