1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-30 03:26:13 +01:00

DC via power pin 3rd part

This commit is contained in:
Harald Barth 2023-02-13 20:48:48 +01:00
parent 0e36b3b997
commit 802f9c96b4
2 changed files with 9 additions and 2 deletions

View File

@ -1 +1 @@
#define GITHUB_SHA "devel-202302122239Z" #define GITHUB_SHA "devel-202302131946Z"

View File

@ -155,6 +155,13 @@ void MotorDriver::setPower(POWERMODE mode) {
noInterrupts(); noInterrupts();
IODevice::write(powerPin,invertPower ? HIGH : LOW); IODevice::write(powerPin,invertPower ? HIGH : LOW);
interrupts(); interrupts();
if (DCinuse) {
// remember current (DC) speed
// but set PWM to zero/stop
byte s = curSpeedCode;
setDCSignal(128);
curSpeedCode = s;
}
} }
powerMode=mode; powerMode=mode;
} }
@ -239,7 +246,7 @@ void MotorDriver::startCurrentFromHW() {
#if defined(ARDUINO_ARCH_ESP32) #if defined(ARDUINO_ARCH_ESP32)
uint16_t taurustones[28] = { 165, 175, 196, 220, uint16_t taurustones[28] = { 165, 175, 196, 220,
247, 262, 294, 330, 247, 262, 294, 330,
249, 392, 440, 494, 349, 392, 440, 494,
523, 587, 659, 698, 523, 587, 659, 698,
494, 440, 392, 249, 494, 440, 392, 249,
330, 284, 262, 247, 330, 284, 262, 247,