electricimp / reference

Electric Imp Reference Code
MIT License
94 stars 65 forks source link

Looking good, except for frame clears #7

Closed kirasglimmer closed 10 years ago

kirasglimmer commented 10 years ago

The new code works well - driving the neopixels without issue. I have found a bug where the clear frame does not do a seek before writing out to the blob. I think it's overrunning and expanding the blob. I fixed it by:

// clears the frame buffer
// but does not write it to the pixel strip
function clearFrame()
{
    fillFrame(clearString);
}

// fills the frame with a specific color    
function fillFrame(color)
{
    frame.seek(0, 'b');  // clear from start of frame
    for (local p = 0; p < numpixels; p++)
       writePixel(p, color);
    frame.writen(0x00,'c');
}

Any chance of getting this into master?

cat-haines commented 10 years ago

Good catch with the memory leak. Fixed in commit fa620b715d.

I also added an optimized version of the fillFrame. It's implemented as an optional RGB color array for the clearFrame function.

kirasglimmer commented 10 years ago

Awesome, thanks!