Skip to content

Commit

Permalink
AnalogDriverESP32V1 release calibration only when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
pschatzmann committed Nov 13, 2023
1 parent 244c78e commit bee406c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/AudioAnalog/AnalogAudioESP32V1.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
if (active_rx) {
adc_continuous_stop(adc_handle);
adc_continuous_deinit(adc_handle);
// free up resources from calibration
if (cfg.adc_calibration_active) {
#if ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED
adc_cali_delete_scheme_curve_fitting(adc_cali_handle);
adc_cali_delete_scheme_curve_fitting(adc_cali_handle);
#elif !defined(CONFIG_IDF_TARGET_ESP32H2)
adc_cali_delete_scheme_line_fitting(adc_cali_handle);
adc_cali_delete_scheme_line_fitting(adc_cali_handle);
#endif
}
}
converter.end();
active_tx = false;
Expand All @@ -100,8 +103,8 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
int available() override { return active_rx ? DEFAULT_BUFFER_SIZE : 0; }

protected:
adc_continuous_handle_t adc_handle;
adc_cali_handle_t adc_cali_handle;
adc_continuous_handle_t adc_handle = nullptr;
adc_cali_handle_t adc_cali_handle = nullptr;
AnalogConfigESP32V1 cfg;
bool active = false;
bool active_tx = false;
Expand Down

0 comments on commit bee406c

Please sign in to comment.