@@ -64,12 +64,19 @@ int16_t ws_pixels::allocateStrand() {
6464*/
6565/* *************************************************************************/
6666void ws_pixels::deallocateStrand (int16_t strandIdx) {
67-
6867 // delete the pixel object
69- if (strands[strandIdx].neoPixelPtr != nullptr )
68+ if (strands[strandIdx].neoPixelPtr != nullptr ) {
69+ // Fill with "off"
70+ strands[strandIdx].neoPixelPtr ->clear ();
71+ strands[strandIdx].neoPixelPtr ->show ();
72+ // Delete the NeoPixel object
7073 delete strands[strandIdx].neoPixelPtr ;
71- if ((strands[strandIdx].dotStarPtr != nullptr ))
74+ } else if ((strands[strandIdx].dotStarPtr != nullptr )) {
75+ // Fill with "off"
76+ strands[strandIdx].dotStarPtr ->clear ();
77+ strands[strandIdx].dotStarPtr ->show ();
7278 delete strands[strandIdx].dotStarPtr ;
79+ }
7380
7481 // re-initialize status pixel (if pixel was prvsly used)
7582 if (strands[strandIdx].pinNeoPixel == getStatusNeoPixelPin () ||
@@ -243,6 +250,7 @@ bool ws_pixels::addStrand(
243250 releaseStatusLED (); // release it!
244251
245252 // Create a new strand of NeoPixels
253+ WS_DEBUG_PRINTLN (" Setting up new NeoPixel Strand..." );
246254 strands[strandIdx].neoPixelPtr = new Adafruit_NeoPixel (
247255 pixelsCreateReqMsg->pixels_num , strands[strandIdx].pinNeoPixel ,
248256 getNeoPixelStrandOrder (pixelsCreateReqMsg->pixels_ordering ));
0 commit comments