From 802f9c96b490a2b5f881bf0288dd25983977a1d1 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 13 Feb 2023 20:48:48 +0100 Subject: [PATCH] DC via power pin 3rd part --- GITHUB_SHA.h | 2 +- MotorDriver.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index 71f19e4..1ddaac7 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "devel-202302122239Z" +#define GITHUB_SHA "devel-202302131946Z" diff --git a/MotorDriver.cpp b/MotorDriver.cpp index 7e4a9a3..51e1a85 100644 --- a/MotorDriver.cpp +++ b/MotorDriver.cpp @@ -155,6 +155,13 @@ void MotorDriver::setPower(POWERMODE mode) { noInterrupts(); IODevice::write(powerPin,invertPower ? HIGH : LOW); interrupts(); + if (DCinuse) { + // remember current (DC) speed + // but set PWM to zero/stop + byte s = curSpeedCode; + setDCSignal(128); + curSpeedCode = s; + } } powerMode=mode; } @@ -239,7 +246,7 @@ void MotorDriver::startCurrentFromHW() { #if defined(ARDUINO_ARCH_ESP32) uint16_t taurustones[28] = { 165, 175, 196, 220, 247, 262, 294, 330, - 249, 392, 440, 494, + 349, 392, 440, 494, 523, 587, 659, 698, 494, 440, 392, 249, 330, 284, 262, 247,