diff --git a/src/AnalogOutputFirmata.h b/src/AnalogOutputFirmata.h index e582fff..dfd2758 100644 --- a/src/AnalogOutputFirmata.h +++ b/src/AnalogOutputFirmata.h @@ -30,9 +30,6 @@ class AnalogOutputFirmata: public FirmataFeature void analogWriteInternal(byte pin, uint32_t value); private: void setupPwmPin(byte pin); -#if ESP32 - void internalReset(); -#endif boolean handleSysex(byte command, byte argc, byte* argv) { if (command == EXTENDED_ANALOG) diff --git a/src/AnalogOutputFirmataEsp32.cpp b/src/AnalogOutputFirmataEsp32.cpp index 486afb8..9e05e21 100644 --- a/src/AnalogOutputFirmataEsp32.cpp +++ b/src/AnalogOutputFirmataEsp32.cpp @@ -30,7 +30,13 @@ AnalogOutputFirmata::AnalogOutputFirmata() void AnalogOutputFirmata::reset() { - internalReset(); + for (int i = 0; i < TOTAL_PINS; i++) + { + if (Firmata.getPinMode(i) == PIN_MODE_PWM) + { + ledcDetach(i); + } + } } @@ -50,17 +56,6 @@ void AnalogOutputFirmata::setupPwmPin(byte pin) { ledcWrite(pin, 0); } -void AnalogOutputFirmata::internalReset() -{ - for (int i = 0; i < TOTAL_PINS; i++) - { - if (Firmata.getPinMode(i) == PIN_MODE_PWM) - { - ledcDetach(i); - } - } -} - boolean AnalogOutputFirmata::handlePinMode(byte pin, int mode) { if (mode == PIN_MODE_PWM && FIRMATA_IS_PIN_PWM(pin)) {