Skip to content

Commit 300a683

Browse files
committed
AnalogDriverESP32V1 support for multiple restart
1 parent 6f2d956 commit 300a683

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/AudioTools/CoreAudio/AudioAnalog/AnalogDriverESP32V1.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,14 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
626626
return ok;
627627
}
628628

629+
#ifdef ARDUINO
630+
// dummy detach: w/o this it's failing
631+
static bool adcDetachBus(void *bus) {
632+
LOGD("===> adcDetachBus: %d", bus);
633+
return true;
634+
}
635+
#endif
636+
629637
/// Cleanup Analog to Digital Converter
630638
bool cleanup_rx() {
631639
if (adc_handle==nullptr) return true;
@@ -648,8 +656,9 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
648656
fifo_buffers = nullptr;
649657
}
650658

651-
#ifdef ARDUINO
659+
#ifdef ARDUINO
652660
// Set all used pins/channels to INIT state
661+
perimanSetBusDeinit(ESP32_BUS_TYPE_ADC_CONT, adcDetachBus);
653662
for (int i = 0; i < cfg.channels; i++) {
654663
adc_channel_t adc_channel = cfg.adc_channels[i];
655664
int io_pin;
@@ -660,7 +669,7 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
660669
}
661670
}
662671
}
663-
#endif
672+
#endif
664673
adc_handle = nullptr;
665674
return true; // Return true to indicate successful cleanup
666675
}

0 commit comments

Comments
 (0)