From 53c95ace17628cf787daada488d7faafd77ad846 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 4 Mar 2025 16:46:21 -0500 Subject: [PATCH 1/5] Look at C6 bug --- platformio.ini | 4 ++-- src/Wippersnapper.h | 2 +- src/Wippersnapper_demo.ino | 2 +- src/components/pixels/ws_pixels.cpp | 1 + src/components/statusLED/Wippersnapper_StatusLED.cpp | 7 +++++++ src/components/statusLED/Wippersnapper_StatusLED.h | 1 + 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/platformio.ini b/platformio.ini index a9bc5e7e0..7fc92150f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -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 @@ -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 diff --git a/src/Wippersnapper.h b/src/Wippersnapper.h index 7ffe02320..bf640c6f8 100644 --- a/src/Wippersnapper.h +++ b/src/Wippersnapper.h @@ -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 diff --git a/src/Wippersnapper_demo.ino b/src/Wippersnapper_demo.ino index 4327de9e4..16584390f 100644 --- a/src/Wippersnapper_demo.ino +++ b/src/Wippersnapper_demo.ino @@ -24,7 +24,7 @@ void setup() { wipper.provision(); Serial.begin(115200); - // while (!Serial) delay(10); + while (!Serial) delay(10); wipper.connect(); diff --git a/src/components/pixels/ws_pixels.cpp b/src/components/pixels/ws_pixels.cpp index a35eb6e42..773bcc92a 100644 --- a/src/components/pixels/ws_pixels.cpp +++ b/src/components/pixels/ws_pixels.cpp @@ -243,6 +243,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)); diff --git a/src/components/statusLED/Wippersnapper_StatusLED.cpp b/src/components/statusLED/Wippersnapper_StatusLED.cpp index 464e0b8ba..7266256f6 100644 --- a/src/components/statusLED/Wippersnapper_StatusLED.cpp +++ b/src/components/statusLED/Wippersnapper_StatusLED.cpp @@ -99,9 +99,16 @@ void initStatusLED() { */ /****************************************************************************/ void releaseStatusLED() { +WS_DEBUG_PRINTLN("Releasing status LED"); #ifdef USE_STATUS_NEOPIXEL + WS_DEBUG_PRINTLN("Deinit the RMT..."); + //Deinit the RMT + statusPixel->updateLength(0); + statusPixel->show(); + WS_DEBUG_PRINTLN("Deleting the statusPixel"); delete statusPixel; // Deallocate Adafruit_NeoPixel object, set data pin back // to INPUT. + statusPixel = nullptr; WS.lockStatusNeoPixel = false; // unlock #endif diff --git a/src/components/statusLED/Wippersnapper_StatusLED.h b/src/components/statusLED/Wippersnapper_StatusLED.h index 1b8dbf326..c1a6c9287 100644 --- a/src/components/statusLED/Wippersnapper_StatusLED.h +++ b/src/components/statusLED/Wippersnapper_StatusLED.h @@ -17,6 +17,7 @@ #define WIPPERSNAPPER_STATUSLED_H #include #include +#include "esp32-hal-rmt.h" // Use LEDC for ESP32 arch so we can PWM #ifdef ARDUINO_ARCH_ESP32 From fce17a3c38fa85fefada250b67189e33fc52b4fe Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 5 Mar 2025 14:53:12 -0500 Subject: [PATCH 2/5] Fix for C6 --- src/components/pixels/ws_pixels.cpp | 18 +++++++++++++++--- .../statusLED/Wippersnapper_StatusLED.cpp | 15 ++++++++------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/components/pixels/ws_pixels.cpp b/src/components/pixels/ws_pixels.cpp index 773bcc92a..769c8bd83 100644 --- a/src/components/pixels/ws_pixels.cpp +++ b/src/components/pixels/ws_pixels.cpp @@ -64,12 +64,24 @@ 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(); +#ifdef ARDUINO_ARCH_ESP32 + // Clear the pin used for RMT + strands[strandIdx].neoPixelPtr->updateLength(0); + strands[strandIdx].neoPixelPtr->show(); +#endif + // 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() || diff --git a/src/components/statusLED/Wippersnapper_StatusLED.cpp b/src/components/statusLED/Wippersnapper_StatusLED.cpp index 7266256f6..0a858b343 100644 --- a/src/components/statusLED/Wippersnapper_StatusLED.cpp +++ b/src/components/statusLED/Wippersnapper_StatusLED.cpp @@ -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; } @@ -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; } @@ -99,16 +101,15 @@ void initStatusLED() { */ /****************************************************************************/ void releaseStatusLED() { -WS_DEBUG_PRINTLN("Releasing status LED"); + WS_DEBUG_PRINTLN("Releasing status LED"); #ifdef USE_STATUS_NEOPIXEL - WS_DEBUG_PRINTLN("Deinit the RMT..."); - //Deinit the RMT +#ifdef ARDUINO_ARCH_ESP32 + // Release the rmtPin for use by other peripherals statusPixel->updateLength(0); statusPixel->show(); - WS_DEBUG_PRINTLN("Deleting the statusPixel"); - delete statusPixel; // Deallocate Adafruit_NeoPixel object, set data pin back - // to INPUT. - statusPixel = nullptr; +#endif + // Dealloc. NeoPixel object + delete statusPixel; WS.lockStatusNeoPixel = false; // unlock #endif From c6f15b5f1a839243859e9bed84b64cced75da6c5 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 5 Mar 2025 15:11:16 -0500 Subject: [PATCH 3/5] Remove RMT header --- src/components/statusLED/Wippersnapper_StatusLED.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/statusLED/Wippersnapper_StatusLED.h b/src/components/statusLED/Wippersnapper_StatusLED.h index c1a6c9287..1b8dbf326 100644 --- a/src/components/statusLED/Wippersnapper_StatusLED.h +++ b/src/components/statusLED/Wippersnapper_StatusLED.h @@ -17,7 +17,6 @@ #define WIPPERSNAPPER_STATUSLED_H #include #include -#include "esp32-hal-rmt.h" // Use LEDC for ESP32 arch so we can PWM #ifdef ARDUINO_ARCH_ESP32 From 393fffa145841e44657b71cb07737b8fe9c229fa Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 6 Mar 2025 15:01:50 -0500 Subject: [PATCH 4/5] Reflect using dtor instead --- src/components/pixels/ws_pixels.cpp | 5 ----- src/components/statusLED/Wippersnapper_StatusLED.cpp | 10 +++------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/components/pixels/ws_pixels.cpp b/src/components/pixels/ws_pixels.cpp index 769c8bd83..2d3b52237 100644 --- a/src/components/pixels/ws_pixels.cpp +++ b/src/components/pixels/ws_pixels.cpp @@ -69,11 +69,6 @@ void ws_pixels::deallocateStrand(int16_t strandIdx) { // Fill with "off" strands[strandIdx].neoPixelPtr->clear(); strands[strandIdx].neoPixelPtr->show(); -#ifdef ARDUINO_ARCH_ESP32 - // Clear the pin used for RMT - strands[strandIdx].neoPixelPtr->updateLength(0); - strands[strandIdx].neoPixelPtr->show(); -#endif // Delete the NeoPixel object delete strands[strandIdx].neoPixelPtr; } else if ((strands[strandIdx].dotStarPtr != nullptr)) { diff --git a/src/components/statusLED/Wippersnapper_StatusLED.cpp b/src/components/statusLED/Wippersnapper_StatusLED.cpp index 0a858b343..4cbdd4c85 100644 --- a/src/components/statusLED/Wippersnapper_StatusLED.cpp +++ b/src/components/statusLED/Wippersnapper_StatusLED.cpp @@ -103,14 +103,10 @@ void initStatusLED() { void releaseStatusLED() { WS_DEBUG_PRINTLN("Releasing status LED"); #ifdef USE_STATUS_NEOPIXEL -#ifdef ARDUINO_ARCH_ESP32 - // Release the rmtPin for use by other peripherals - statusPixel->updateLength(0); - statusPixel->show(); -#endif - // Dealloc. NeoPixel object + // Deallocate Adafruit_NeoPixel object, set data pin back to INPUT, + // and unlock pixel for use by pixels component delete statusPixel; - WS.lockStatusNeoPixel = false; // unlock + WS.lockStatusNeoPixel = false; #endif #ifdef USE_STATUS_DOTSTAR From 47f306c311975db773843ab15a794ab989604879 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 6 Mar 2025 15:03:15 -0500 Subject: [PATCH 5/5] fix ser --- src/Wippersnapper_demo.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Wippersnapper_demo.ino b/src/Wippersnapper_demo.ino index 16584390f..4327de9e4 100644 --- a/src/Wippersnapper_demo.ino +++ b/src/Wippersnapper_demo.ino @@ -24,7 +24,7 @@ void setup() { wipper.provision(); Serial.begin(115200); - while (!Serial) delay(10); + // while (!Serial) delay(10); wipper.connect();