From 6c3d275342d8d4717d9373a43f481d5b120b0b92 Mon Sep 17 00:00:00 2001 From: Chen Jichang Date: Thu, 7 Aug 2025 13:09:00 +0800 Subject: [PATCH] fix(rmt): treat loop once as no loop --- components/esp_driver_rmt/src/rmt_tx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/esp_driver_rmt/src/rmt_tx.c b/components/esp_driver_rmt/src/rmt_tx.c index 6e8649d2c6..5e432ad079 100644 --- a/components/esp_driver_rmt/src/rmt_tx.c +++ b/components/esp_driver_rmt/src/rmt_tx.c @@ -521,7 +521,7 @@ esp_err_t rmt_transmit(rmt_channel_handle_t channel, rmt_encoder_t *encoder, con ESP_RETURN_ON_FALSE(channel && encoder && payload && payload_bytes && config, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); ESP_RETURN_ON_FALSE(channel->direction == RMT_CHANNEL_DIRECTION_TX, ESP_ERR_INVALID_ARG, TAG, "invalid channel direction"); #if !SOC_RMT_SUPPORT_TX_LOOP_COUNT - ESP_RETURN_ON_FALSE(config->loop_count <= 0, ESP_ERR_NOT_SUPPORTED, TAG, "loop count is not supported"); + ESP_RETURN_ON_FALSE(config->loop_count <= 1, ESP_ERR_NOT_SUPPORTED, TAG, "loop count is not supported"); #endif // !SOC_RMT_SUPPORT_TX_LOOP_COUNT #if CONFIG_RMT_TX_ISR_CACHE_SAFE // payload is retrieved by the encoder, we should make sure it's still accessible even when the cache is disabled @@ -546,7 +546,8 @@ esp_err_t rmt_transmit(rmt_channel_handle_t channel, rmt_encoder_t *encoder, con t->encoder = encoder; t->payload = payload; t->payload_bytes = payload_bytes; - t->loop_count = config->loop_count; + // treat loop_count == 1 as no loop + t->loop_count = config->loop_count == 1 ? 0 : config->loop_count; t->remain_loop_count = t->loop_count; t->flags.eot_level = config->flags.eot_level;