-
Notifications
You must be signed in to change notification settings - Fork 1.3k
WIP: try (re)using the buffer in neopixel_write (BROKEN) #2449
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
Conversation
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.
Thank you! Why is PewPew also being update?
|
||
pattern_on_heap = true; | ||
if (!pattern_on_heap || pixels_pattern_heap_size < pattern_size) { | ||
if (pattern_on_heap) { |
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 (pattern_on_heap) { | |
if (pixels_pattern_heap_size < pattern_size) { |
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.
Fixed the submodule and addressed this review.
@@ -116,6 +116,8 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout | |||
|
|||
uint32_t pattern_size = PATTERN_SIZE(numBytes); | |||
uint16_t* pixels_pattern = NULL; | |||
static uint16_t* pixels_pattern_heap = NULL; |
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.
Please make sure that this is reset to NULL when the heap is reset otherwise it'll break after a reload.
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.
@tannewt where can I find the heap reset code?
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.
I'd add a neopixel_write_reset
and add it here: https://github.com/adafruit/circuitpython/blob/master/main.c#L190
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.
I added the neopixel_write_reset to the port only, as this is only for nrf. I called it from reset_port().
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.
Feel free to stub it into other ports if that is simpler. I wouldn't be surprised if others needed it in the future.
ed288d9
to
bf184d8
Compare
bf184d8
to
4e040b0
Compare
The board seems to be resetting on me after this change - hold tight for more testing. |
@rhooper I am going to try to finish this off, since we should fix #2442 for 5.0.0. When you say:
|
@rhooper I am going to try to finish this off, since we should fix #2442 for 5.0.0. When you say:
|
@dhalbert the old version of this PR (34c9e00) didn't clean up on reset. so I tried to do so like @tannewt requested in later commits. That resulted in crashes - I don't quit recall when. To test for the soft reset without the patch, the simplest approach was to have large neopixel_write intermixed and other code. For example the stuff the tree code did with AggregatePixels in adafruit/Adafruit_CircuitPython_LED_Animation#10 . No pixels needed to be attached. The tree code triggered it faster by fragmenting memory. |
This might address #2442
I'll leave it running overnight.