-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(rmt): Solve neopixel issue #9906
Conversation
if neopixelWrite() is used from different tasks/isr_callbacks, it may result in a concurrency problem and many detach/attach calls in sequence, but not in synch. This commit avoids initializing the neopixel GPIO again.
👋 Hello SuGlider, we appreciate your contribution to this project! Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 56 files 56 suites 5m 18s ⏱️ Results for commit 75ba8bb. ♻️ This comment has been updated with latest results. |
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
|
@@ -491,14 +503,15 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_ | |||
while (xSemaphoreTake(g_rmt_block_lock, portMAX_DELAY) != pdPASS) {} | |||
|
|||
// allocate the rmt bus object and sets all fields to NULL | |||
rmt_bus_handle_t bus = (rmt_bus_handle_t)heap_caps_calloc(1, sizeof(struct rmt_obj_s), MALLOC_CAP_DEFAULT); | |||
bus = (rmt_bus_handle_t)heap_caps_calloc(1, sizeof(struct rmt_obj_s), MALLOC_CAP_DEFAULT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if bus was not NULL, would you not leak it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No... It was already released by detach.
Description of Change
If
neopixelWrite()
is used from different tasks / isr_callbacks, it may result in a concurrency problem because of many detach/attach calls in sequence, but not in synch.This commit avoids initializing the neopixel GPIO again, after a first use.
It also improves a lot the response time of
neopixelWrite()
.It still allows to change RMT pin configuration or pin function correctly.
Tests scenarios
Tested using ESP32-S3. Please check the code from #9903
Related links
Fix #9903