Skip to content

Commit 70da590

Browse files
authored
catch second type of error
1 parent 8d5e093 commit 70da590

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ports/espressif/common-hal/pulseio/PulseIn.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu
7676
uint16_t maxlen, bool idle_state) {
7777

7878
// Only use dma when necessary, since dma-rmt might not be available.
79-
// If dma is not available, this will raise an error below.
79+
// If dma is necessary but not available, this will raise an error below.
8080
bool use_dma = maxlen > 128;
8181

8282
self->buffer = (uint16_t *)m_malloc_without_collect(maxlen * sizeof(uint16_t));
@@ -122,7 +122,8 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu
122122
esp_err_t result = rmt_new_rx_channel(&config, &self->channel);
123123
if (result != ESP_OK) {
124124
port_free(self->raw_symbols);
125-
if (result == ESP_ERR_NOT_SUPPORTED) {
125+
if (result == ESP_ERR_NOT_SUPPORTED || result == ESP_ERR_NOT_FOUND) {
126+
// DMA not available, cannot record long pulse sequences.
126127
mp_raise_ValueError_varg(MP_ERROR_TEXT("Invalid %q"), MP_QSTR_maxlen);
127128
} else {
128129
raise_esp_error(result);

0 commit comments

Comments
 (0)