Skip to content
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

Fix: ESP32 espShow() doesn't de-init RMT #424

Merged
merged 6 commits into from
Mar 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Adafruit_NeoPixel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ Adafruit_NeoPixel::Adafruit_NeoPixel()
@brief Deallocate Adafruit_NeoPixel object, set data pin back to INPUT.
*/
Adafruit_NeoPixel::~Adafruit_NeoPixel() {
#ifdef ARDUINO_ARCH_ESP32
// Release RMT resources (RMT channels and led_data)
// by indirectly calling into espShow()
memset(pixels, 0, numBytes);
numLEDs = numBytes = 0;
show();
#endif
Comment on lines +125 to +131
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems OK to me. It still seems a little round-about, but I assume there are use cases for adjusting the number of LEDs on the fly and we support that.

free(pixels);
if (pin >= 0)
pinMode(pin, INPUT);
Expand Down