Fix for Issue #4266

This commit is contained in:
root 2021-05-25 16:06:00 -05:00
parent d79d68705b
commit 24e641a834
2 changed files with 1 additions and 5 deletions

View File

@ -368,7 +368,6 @@ bool audio_dma_get_playing(audio_dma_t *dma) {
} }
if (!dma_channel_is_busy(dma->channel[0]) && if (!dma_channel_is_busy(dma->channel[0]) &&
!dma_channel_is_busy(dma->channel[1])) { !dma_channel_is_busy(dma->channel[1])) {
audio_dma_stop(dma);
return false; return false;
} }

View File

@ -126,18 +126,15 @@ void common_hal_audiopwmio_pwmaudioout_deinit(audiopwmio_pwmaudioout_obj_t *self
} }
void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t *self, mp_obj_t sample, bool loop) { void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t *self, mp_obj_t sample, bool loop) {
if (common_hal_audiopwmio_pwmaudioout_get_playing(self)) {
common_hal_audiopwmio_pwmaudioout_stop(self);
}
// TODO: Share pacing timers based on frequency. // TODO: Share pacing timers based on frequency.
size_t pacing_timer = NUM_DMA_TIMERS; size_t pacing_timer = NUM_DMA_TIMERS;
for (size_t i = 0; i < NUM_DMA_TIMERS; i++) { for (size_t i = 0; i < NUM_DMA_TIMERS; i++) {
if (dma_hw->timer[i] == 0) { if (dma_hw->timer[i] == 0) {
pacing_timer = i; pacing_timer = i;
}
break; break;
} }
}
if (pacing_timer == NUM_DMA_TIMERS) { if (pacing_timer == NUM_DMA_TIMERS) {
mp_raise_RuntimeError(translate("No DMA pacing timer found")); mp_raise_RuntimeError(translate("No DMA pacing timer found"));
} }