From 5d41c411b780c58b4844b120413b0831806570d1 Mon Sep 17 00:00:00 2001 From: pschatzmann Date: Wed, 20 Nov 2024 08:13:25 +0100 Subject: [PATCH] AnalogDriverESP32V1 end() --- .../AudioAnalog/AnalogDriverESP32V1.h | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/AudioTools/CoreAudio/AudioAnalog/AnalogDriverESP32V1.h b/src/AudioTools/CoreAudio/AudioAnalog/AnalogDriverESP32V1.h index c65232e7b..dd16d3106 100644 --- a/src/AudioTools/CoreAudio/AudioAnalog/AnalogDriverESP32V1.h +++ b/src/AudioTools/CoreAudio/AudioAnalog/AnalogDriverESP32V1.h @@ -38,7 +38,7 @@ class AnalogDriverESP32V1 : public AnalogDriverBase { /// Start the Analog driver /// ---------------------------------------------------------- bool begin(AnalogConfigESP32V1 cfg) { - // TRACEI(); + TRACEI(); bool result = true; this->cfg = cfg; @@ -68,12 +68,10 @@ class AnalogDriverESP32V1 : public AnalogDriverBase { /// Stop and uninstalls the driver /// ---------------------------------------------------------- void end() override { - // TRACEI(); - #ifdef HAS_ESP32_DAC + TRACEI(); if (active_tx) { - dac_continuous_del_channels(dac_handle); + cleanup_tx(); } - #endif if (active_rx) { cleanup_rx(); } @@ -612,8 +610,23 @@ class AnalogDriverESP32V1 : public AnalogDriverBase { return true; } - // Cleanup Analog to Digital Converter - // ---------------------------------------------------------- + /// Cleanup dac + bool cleanup_tx() { + bool ok = true; +#ifdef HAS_ESP32_DAC + if (dac_continuous_disable(dac_handle) != ESP_OK){ + ok = false; + LOGE("dac_continuous_disable failed"); + } + if (dac_continuous_del_channels(dac_handle) != ESP_OK){ + ok = false; + LOGE("dac_continuous_del_channels failed"); + } +#endif + return ok; + } + + /// Cleanup Analog to Digital Converter bool cleanup_rx() { adc_continuous_stop(adc_handle);