fix: ESP-HI audio sampling problem #1207
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


This pull request introduces enhancements to the
AdcPdmAudioCodecclass for improved audio output control and stability, particularly by integrating a timer-based mechanism to automatically disable output after a period of inactivity. Additionally, it adds configuration flexibility for PDM upsampling, and includes some minor improvements to display and configuration files.Audio output control and stability improvements:
esp_timer-based mechanism toAdcPdmAudioCodecthat starts a timer when audio output is enabled or data is written; the timer disables output after a 120ms timeout to prevent unwanted continuous audio output. Timer is properly created, started, stopped, and deleted as needed. (adc_pdm_audio_codec.cc,adc_pdm_audio_codec.h) [1] [2] [3] [4] [5]up_sample_fsparameter is always set according to board configuration, overriding third-party library defaults, for consistent audio performance. (adc_pdm_audio_codec.cc) [1] [2]Configuration and flexibility:
AUDIO_PDM_UPSAMPLE_FSmacro inconfig.hto allow easy adjustment of the PDM upsampling factor, improving device compatibility and audio quality. (config.h)config.hinadc_pdm_audio_codec.ccto access new configuration macros.Minor improvements:
emoji_display.cc)SetChatMessageinEmojiWidgetfor interface completeness. (emoji_display.h)config.jsonfor cleanup. (config.json)esp_hi.ccthat previously toggled audio output, likely superseded by the new timer-based approach. (esp_hi.cc)