From 399030d8ae7a88e3334ab6ba49d4e4e926999bbb Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 25 Jul 2023 12:51:23 +0200 Subject: [PATCH] make variable frequency a compile option --- MotorDriver.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MotorDriver.cpp b/MotorDriver.cpp index 444d502..5b51778 100644 --- a/MotorDriver.cpp +++ b/MotorDriver.cpp @@ -278,6 +278,7 @@ void MotorDriver::startCurrentFromHW() { #endif //ANALOG_READ_INTERRUPT #if defined(ARDUINO_ARCH_ESP32) +#ifdef VARIABLE_TONES uint16_t taurustones[28] = { 165, 175, 196, 220, 247, 262, 294, 330, 349, 392, 440, 494, @@ -286,6 +287,7 @@ uint16_t taurustones[28] = { 165, 175, 196, 220, 330, 284, 262, 247, 220, 196, 175, 165 }; #endif +#endif void MotorDriver::setDCSignal(byte speedcode) { if (brakePin == UNUSED_PIN) return; @@ -304,11 +306,13 @@ void MotorDriver::setDCSignal(byte speedcode) { #if defined(ARDUINO_ARCH_ESP32) { int f = 131; +#ifdef VARIABLE_TONES if (tSpeed > 2) { if (tSpeed <= 58) { f = taurustones[ (tSpeed-2)/2 ] ; } } +#endif DCCTimer::DCCEXanalogWriteFrequency(brakePin, f); // set DC PWM frequency to 100Hz XXX May move to setup } #endif