1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 17:46:14 +01:00

Update MotorDriver.cpp

Remove unnecessary and undesirable interrupt disable/enable when writing to HAL driver.
This commit is contained in:
Neil McKechnie 2023-01-14 17:10:45 +00:00
parent a6ae1a48a2
commit 79437bbf37

View File

@ -144,16 +144,12 @@ bool MotorDriver::isPWMCapable() {
void MotorDriver::setPower(POWERMODE mode) { void MotorDriver::setPower(POWERMODE mode) {
bool on=mode==POWERMODE::ON; bool on=mode==POWERMODE::ON;
if (on) { if (on) {
noInterrupts();
IODevice::write(powerPin,invertPower ? LOW : HIGH); IODevice::write(powerPin,invertPower ? LOW : HIGH);
interrupts();
if (isProgTrack) if (isProgTrack)
DCCWaveform::progTrack.clearResets(); DCCWaveform::progTrack.clearResets();
} }
else { else {
noInterrupts();
IODevice::write(powerPin,invertPower ? HIGH : LOW); IODevice::write(powerPin,invertPower ? HIGH : LOW);
interrupts();
} }
powerMode=mode; powerMode=mode;
} }