Skip to content

Commit 5d41c41

Browse files
committed
AnalogDriverESP32V1 end()
1 parent f748f0a commit 5d41c41

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

src/AudioTools/CoreAudio/AudioAnalog/AnalogDriverESP32V1.h

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
3838
/// Start the Analog driver
3939
/// ----------------------------------------------------------
4040
bool begin(AnalogConfigESP32V1 cfg) {
41-
// TRACEI();
41+
TRACEI();
4242
bool result = true;
4343
this->cfg = cfg;
4444

@@ -68,12 +68,10 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
6868
/// Stop and uninstalls the driver
6969
/// ----------------------------------------------------------
7070
void end() override {
71-
// TRACEI();
72-
#ifdef HAS_ESP32_DAC
71+
TRACEI();
7372
if (active_tx) {
74-
dac_continuous_del_channels(dac_handle);
73+
cleanup_tx();
7574
}
76-
#endif
7775
if (active_rx) {
7876
cleanup_rx();
7977
}
@@ -612,8 +610,23 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
612610
return true;
613611
}
614612

615-
// Cleanup Analog to Digital Converter
616-
// ----------------------------------------------------------
613+
/// Cleanup dac
614+
bool cleanup_tx() {
615+
bool ok = true;
616+
#ifdef HAS_ESP32_DAC
617+
if (dac_continuous_disable(dac_handle) != ESP_OK){
618+
ok = false;
619+
LOGE("dac_continuous_disable failed");
620+
}
621+
if (dac_continuous_del_channels(dac_handle) != ESP_OK){
622+
ok = false;
623+
LOGE("dac_continuous_del_channels failed");
624+
}
625+
#endif
626+
return ok;
627+
}
628+
629+
/// Cleanup Analog to Digital Converter
617630
bool cleanup_rx() {
618631

619632
adc_continuous_stop(adc_handle);

0 commit comments

Comments
 (0)