From ab82347fc2b51cbcd892d0ab4ba1283db522ad7e Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 21 May 2025 17:00:32 -0400 Subject: [PATCH 1/4] Attempt to fix the AnalogWrite issue --- src/components/ledc/ws_ledc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/ledc/ws_ledc.cpp b/src/components/ledc/ws_ledc.cpp index 7416077bc..0ce6c9032 100644 --- a/src/components/ledc/ws_ledc.cpp +++ b/src/components/ledc/ws_ledc.cpp @@ -54,7 +54,8 @@ bool ws_ledc::analogWrite(uint8_t pin, int value) { // Calculate duty cycle for the `value` passed in // (assumes 12-bit resolution, 2^12) - uint32_t dutyCycle = (4095 / 255) * min(value, 255); + //uint32_t dutyCycle = (4095 / 255) * min(value, 255); + uint32_t dutyCycle =(uint32_t)(((double)12 / 255.0) * min(value, (uint32_t)255)); // Call duty cycle write return setDuty(pin, dutyCycle); From 486422c821ba23561d9ae476728e7fe02b0c9ef0 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 21 May 2025 17:03:08 -0400 Subject: [PATCH 2/4] Fix build error --- src/components/ledc/ws_ledc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ledc/ws_ledc.cpp b/src/components/ledc/ws_ledc.cpp index 0ce6c9032..9b5b599f7 100644 --- a/src/components/ledc/ws_ledc.cpp +++ b/src/components/ledc/ws_ledc.cpp @@ -55,7 +55,7 @@ bool ws_ledc::analogWrite(uint8_t pin, int value) { // Calculate duty cycle for the `value` passed in // (assumes 12-bit resolution, 2^12) //uint32_t dutyCycle = (4095 / 255) * min(value, 255); - uint32_t dutyCycle =(uint32_t)(((double)12 / 255.0) * min(value, (uint32_t)255)); + uint32_t dutyCycle =(uint32_t)(((double)4095 / 255.0) * min((uint32_t)value, (uint32_t)255)); // Call duty cycle write return setDuty(pin, dutyCycle); From bb0d40644a2be9f409b8a81165c88384c88c78af Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Fri, 23 May 2025 19:56:49 +0100 Subject: [PATCH 3/4] Clang-format PWM fix --- src/components/ledc/ws_ledc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ledc/ws_ledc.cpp b/src/components/ledc/ws_ledc.cpp index 9b5b599f7..2159e0d52 100644 --- a/src/components/ledc/ws_ledc.cpp +++ b/src/components/ledc/ws_ledc.cpp @@ -54,8 +54,8 @@ bool ws_ledc::analogWrite(uint8_t pin, int value) { // Calculate duty cycle for the `value` passed in // (assumes 12-bit resolution, 2^12) - //uint32_t dutyCycle = (4095 / 255) * min(value, 255); - uint32_t dutyCycle =(uint32_t)(((double)4095 / 255.0) * min((uint32_t)value, (uint32_t)255)); + uint32_t dutyCycle = + (uint32_t)(((double)4095 / 255.0) * min((uint32_t)value, (uint32_t)255)); // Call duty cycle write return setDuty(pin, dutyCycle); From 564191c4ebf5b8be6d495002ecb0286d1ee02849 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Fri, 23 May 2025 19:57:27 +0100 Subject: [PATCH 4/4] Bump version to 1.0.0-beta.101 --- library.properties | 2 +- src/Wippersnapper.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library.properties b/library.properties index d851b0cd6..7b31700e2 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit WipperSnapper -version=1.0.0-beta.100 +version=1.0.0-beta.101 author=Adafruit maintainer=Adafruit sentence=Arduino application for Adafruit.io WipperSnapper diff --git a/src/Wippersnapper.h b/src/Wippersnapper.h index 776eca217..b5013d6df 100644 --- a/src/Wippersnapper.h +++ b/src/Wippersnapper.h @@ -142,7 +142,7 @@ #endif #define WS_VERSION \ - "1.0.0-beta.100" ///< WipperSnapper app. version (semver-formatted) + "1.0.0-beta.101" ///< WipperSnapper app. version (semver-formatted) // Reserved Adafruit IO MQTT topics #define TOPIC_IO_THROTTLE "/throttle" ///< Adafruit IO Throttle MQTT Topic