Skip to content

Commit 3e2ec19

Browse files
committed
Update
Resolves #30
1 parent cc17cb2 commit 3e2ec19

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"keywords": "pwm, servo, tone, esp32, analogWrite, esp32-s2, esp32-s3, esp32-c3, ledc",
44
"description": "ESP32 PWM, Servo, Easing and Tone. Smart GPIO pin management and advanced control features.",
55
"license": "MIT",
6-
"version": "4.3.0",
6+
"version": "4.3.1",
77
"frameworks": "arduino",
88
"platforms": "espressif32",
99
"repository": {

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ESP32 ESP32S2 AnalogWrite
2-
version=4.3.0
2+
version=4.3.1
33
author=David Lloyd
44
maintainer=David Lloyd <dlloydev@testcor.ca>
55
sentence=ESP32 PWM, Servo, Easing and Tone.

src/pwmWrite.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************
2-
ESP32 PWM, SERVO and TONE Library, Version 4.3.0
2+
ESP32 PWM, SERVO and TONE Library, Version 4.3.1
33
by dlloydev https://github.com/Dlloydev/ESP32-ESP32S2-AnalogWrite
44
This Library is licensed under the MIT License
55
*******************************************************************/
@@ -94,7 +94,7 @@ void Pwm::tone(uint8_t pin, uint32_t frequency, uint16_t duration, uint16_t inte
9494
write(pin, 127, frequency, 8);
9595
resume(ch);
9696
}
97-
if (duration && ((ms - mem[ch].startMs) > duration) || (duration == 0)) {
97+
if ((duration && ((ms - mem[ch].startMs) > duration)) || (duration == 0)) {
9898
mem[ch].startMs = ms;
9999
durDone = true;
100100
if (duration < 0xffff) pause(ch);
@@ -183,7 +183,7 @@ uint8_t Pwm::attached(uint8_t pin) {
183183
if (mem[ch].pin == pin) return ch;
184184
if (mem[ch].pin == 255) freeCh = true; // free channel(s) exist
185185
}
186-
return (free) ? 253 : 255; // free : not attached
186+
return (freeCh) ? 253 : 255; // freeCh : not attached
187187
}
188188

189189
uint8_t Pwm::attachedPin(uint8_t ch) {

src/pwmWrite.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,22 @@ class Pwm {
5656
} mem_t;
5757

5858
mem_t mem[16] = { // channel data (see above)
59-
{255, 1000, 0, 8, 0, 0, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
60-
{255, 1000, 0, 8, 0, 0, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
61-
{255, 1000, 0, 8, 0, 1, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
62-
{255, 1000, 0, 8, 0, 1, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
63-
{255, 1000, 0, 8, 0, 2, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
64-
{255, 1000, 0, 8, 0, 2, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
65-
{255, 1000, 0, 8, 0, 3, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
66-
{255, 1000, 0, 8, 0, 3, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
67-
{255, 1000, 0, 8, 1, 0, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
68-
{255, 1000, 0, 8, 1, 0, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
69-
{255, 1000, 0, 8, 1, 1, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
70-
{255, 1000, 0, 8, 1, 1, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
71-
{255, 1000, 0, 8, 1, 2, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
72-
{255, 1000, 0, 8, 1, 2, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
73-
{255, 1000, 0, 8, 1, 3, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
74-
{255, 1000, 0, 8, 1, 3, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 }
59+
{255, 1000, 0, 8, 0, 0, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
60+
{255, 1000, 0, 8, 0, 0, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
61+
{255, 1000, 0, 8, 0, 1, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
62+
{255, 1000, 0, 8, 0, 1, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
63+
{255, 1000, 0, 8, 0, 2, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
64+
{255, 1000, 0, 8, 0, 2, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
65+
{255, 1000, 0, 8, 0, 3, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
66+
{255, 1000, 0, 8, 0, 3, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
67+
{255, 1000, 0, 8, 1, 0, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
68+
{255, 1000, 0, 8, 1, 0, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
69+
{255, 1000, 0, 8, 1, 1, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
70+
{255, 1000, 0, 8, 1, 1, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
71+
{255, 1000, 0, 8, 1, 2, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
72+
{255, 1000, 0, 8, 1, 2, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
73+
{255, 1000, 0, 8, 1, 3, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 },
74+
{255, 1000, 0, 8, 1, 3, 0, 544, 1472, 2400, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0 }
7575
};
7676

7777
// pwm

0 commit comments

Comments
 (0)