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 Issues: Pixel and Status Pixel #708

Merged
merged 5 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ lib_deps =

; Common build environment for ESP32 platform
[common:esp32]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.07/platform-espressif32.zip
platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.13/platform-espressif32.zip
; This is needed for occasional new features and bug fixes
; platform = https://github.com/pioarduino/platform-espressif32#develop
lib_ignore = WiFiNINA, WiFi101, OneWire
Expand Down Expand Up @@ -166,7 +166,7 @@ board = adafruit_feather_esp32c6
build_flags =
-DARDUINO_ADAFRUIT_FEATHER_ESP32C6
-DARDUINO_USB_CDC_ON_BOOT=1
-DCORE_DEBUG_LEVEL=3
-DCORE_DEBUG_LEVEL=5
board_build.filesystem = littlefs
board_build.partitions = min_spiffs.csv

Expand Down
2 changes: 1 addition & 1 deletion src/Wippersnapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
#endif

#define WS_VERSION \
"1.0.0-beta.97" ///< WipperSnapper app. version (semver-formatted)
"1.0.0-beta.98" ///< WipperSnapper app. version (semver-formatted)

// Reserved Adafruit IO MQTT topics
#define TOPIC_IO_THROTTLE "/throttle" ///< Adafruit IO Throttle MQTT Topic
Expand Down
14 changes: 11 additions & 3 deletions src/components/pixels/ws_pixels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,19 @@ int16_t ws_pixels::allocateStrand() {
*/
/**************************************************************************/
void ws_pixels::deallocateStrand(int16_t strandIdx) {

// delete the pixel object
if (strands[strandIdx].neoPixelPtr != nullptr)
if (strands[strandIdx].neoPixelPtr != nullptr) {
// Fill with "off"
strands[strandIdx].neoPixelPtr->clear();
strands[strandIdx].neoPixelPtr->show();
// Delete the NeoPixel object
delete strands[strandIdx].neoPixelPtr;
if ((strands[strandIdx].dotStarPtr != nullptr))
} else if ((strands[strandIdx].dotStarPtr != nullptr)) {
// Fill with "off"
strands[strandIdx].dotStarPtr->clear();
strands[strandIdx].dotStarPtr->show();
delete strands[strandIdx].dotStarPtr;
}

// re-initialize status pixel (if pixel was prvsly used)
if (strands[strandIdx].pinNeoPixel == getStatusNeoPixelPin() ||
Expand Down Expand Up @@ -243,6 +250,7 @@ bool ws_pixels::addStrand(
releaseStatusLED(); // release it!

// Create a new strand of NeoPixels
WS_DEBUG_PRINTLN("Setting up new NeoPixel Strand...");
strands[strandIdx].neoPixelPtr = new Adafruit_NeoPixel(
pixelsCreateReqMsg->pixels_num, strands[strandIdx].pinNeoPixel,
getNeoPixelStrandOrder(pixelsCreateReqMsg->pixels_ordering));
Expand Down
10 changes: 7 additions & 3 deletions src/components/statusLED/Wippersnapper_StatusLED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void initStatusLED() {
statusPixel = new Adafruit_NeoPixel(
STATUS_NEOPIXEL_NUM, STATUS_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
statusPixel->begin();
statusPixel->clear();
statusPixel->show(); // turn OFF all pixels
WS.lockStatusNeoPixel = true;
}
Expand All @@ -69,6 +70,7 @@ void initStatusLED() {
STATUS_DOTSTAR_PIN_CLK, STATUS_DOTSTAR_COLOR_ORDER)
#endif
statusPixelDotStar->begin();
statusPixelDotStar->clear();
statusPixelDotStar->show(); // turn OFF all pixels
WS.lockStatusDotStar = true;
}
Expand Down Expand Up @@ -99,10 +101,12 @@ void initStatusLED() {
*/
/****************************************************************************/
void releaseStatusLED() {
WS_DEBUG_PRINTLN("Releasing status LED");
#ifdef USE_STATUS_NEOPIXEL
delete statusPixel; // Deallocate Adafruit_NeoPixel object, set data pin back
// to INPUT.
WS.lockStatusNeoPixel = false; // unlock
// Deallocate Adafruit_NeoPixel object, set data pin back to INPUT,
// and unlock pixel for use by pixels component
delete statusPixel;
WS.lockStatusNeoPixel = false;
#endif

#ifdef USE_STATUS_DOTSTAR
Expand Down
Loading