Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Commit 18250af

Browse files
authored
v1.5.0 fixes doubling time bug
### Releases v1.5.0 1. Fix doubled time for `ESP32_C3, ESP32_S2 and ESP32_S3`. Check [Error in the value defined by TIMER0_INTERVAL_MS #28](https://github.com/khoih-prog/ESP32_ISR_Servo/issues/28) 2. Modify examples to avoid using `LED_BUILTIN` / `GPIO2` and `GPIO2` as they can cause crash in some boards, such as `ESP32_C3` 3. Use `allman astyle` and add `utils`
1 parent 4437e6c commit 18250af

18 files changed

+991
-822
lines changed

CONTRIBUTING.md

+30-6
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
1515
Please ensure to specify the following:
1616

1717
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
18-
* `ESP32` Core Version (e.g. ESP32 core v2.0.4)
18+
* `ESP32` Core Version (e.g. ESP32 core v2.0.5)
1919
* `ESP32` Board type (e.g. ESP32_DEV Module, etc.)
2020
* `ESP32-S2` Board type (e.g. ESP32S2_DEV Module, ESP32_S2_Saola, etc.)
2121
* `ESP32_S3` Board type (e.g. ESP32S3_DEV, ESP32_S3_BOX, UM TINYS3, UM PROS3, UM FEATHERS3, etc.)
22-
* `ESP32-C3` Board type (e.g. ESP32C3_DEV Module, etc.)
22+
* `ESP32-C3` Board type (e.g. ESP32C3_DEV Module, LOLIN_C3_MINI, DFROBOT_BEETLE_ESP32_C3, ADAFRUIT_QTPY_ESP32C3, AirM2M_CORE_ESP32C3, XIAO_ESP32C3, etc.)
2323
* Contextual information (e.g. what you were trying to achieve)
2424
* Simplest possible steps to reproduce
2525
* Anything that might be relevant in your opinion, such as:
@@ -31,27 +31,51 @@ Please ensure to specify the following:
3131

3232
```
3333
Arduino IDE version: 1.8.19
34-
ESP32 core v2.0.4
34+
ESP32 core v2.0.5
3535
ESP32S3_DEV Module
3636
OS: Ubuntu 20.04 LTS
37-
Linux xy-Inspiron-3593 5.15.0-41-generic #44~20.04.1-Ubuntu SMP Fri Jun 24 13:27:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
37+
Linux xy-Inspiron-3593 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
3838
3939
Context:
40-
I encountered a crash while trying to use the Timer Interrupt.
41-
40+
I encountered a crash while using this library
4241
Steps to reproduce:
4342
1. ...
4443
2. ...
4544
3. ...
4645
4. ...
4746
```
47+
48+
### Additional context
49+
50+
Add any other context about the problem here.
51+
52+
---
53+
4854
### Sending Feature Requests
4955

5056
Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.
5157

5258
There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/ESP32_ISR_Servo/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
5359

60+
---
61+
5462
### Sending Pull Requests
5563

5664
Pull Requests with changes and fixes are also welcome!
5765

66+
Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux)
67+
68+
1. Change directory to the library GitHub
69+
70+
```
71+
xy@xy-Inspiron-3593:~$ cd Arduino/xy/ESP32_ISR_Servo_GitHub/
72+
xy@xy-Inspiron-3593:~/Arduino/xy/ESP32_ISR_Servo_GitHub$
73+
```
74+
75+
2. Issue astyle command
76+
77+
```
78+
xy@xy-Inspiron-3593:~/Arduino/xy/ESP32_ISR_Servo_GitHub$ bash utils/restyle.sh
79+
```
80+
81+

README.md

+26-21
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
77
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/ESP32_ISR_Servo.svg)](http://github.com/khoih-prog/ESP32_ISR_Servo/issues)
88

9+
910
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a>
1011
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a>
12+
<a href="https://profile-counter.glitch.me/khoih-prog/count.svg" title="Total khoih-prog Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog/count.svg" style="height: 30px;width: 200px;"></a>
13+
<a href="https://profile-counter.glitch.me/khoih-prog-ESP32_ISR_Servo/count.svg" title="ESP32_ISR_Servo Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-ESP32_ISR_Servo/count.svg" style="height: 30px;width: 200px;"></a>
1114

1215
---
1316
---
@@ -92,6 +95,7 @@ Functions using normal software timers, relying on loop() and calling millis(),
9295

9396
This library enables you to use `1 Hardware Timer` on an ESP32, ESP32_S2, ESP32_C3-based board to control up to `16 independent servo motors`.
9497

98+
---
9599

96100
#### Important Notes about using ISR
97101

@@ -105,6 +109,7 @@ This library enables you to use `1 Hardware Timer` on an ESP32, ESP32_S2, ESP32_
105109

106110
[HOWTO Attach Interrupt](https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/)
107111

112+
---
108113

109114
#### Currently supported Boards
110115

@@ -121,7 +126,7 @@ This [**ESP32_ISR_Servo** library](https://github.com/khoih-prog/ESP32_ISR_Servo
121126
## Prerequisites
122127

123128
1. [`Arduino IDE 1.8.19+` for Arduino](https://github.com/arduino/Arduino). [![GitHub release](https://img.shields.io/github/release/arduino/Arduino.svg)](https://github.com/arduino/Arduino/releases/latest)
124-
2. [`ESP32 Core 2.0.4+`](https://github.com/espressif/arduino-esp32) for ESP32-based boards. [![Latest release](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/)
129+
2. [`ESP32 Core 2.0.5+`](https://github.com/espressif/arduino-esp32) for ESP32-based boards. [![Latest release](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/)
125130

126131
---
127132
---
@@ -159,14 +164,14 @@ The current library implementation, using `xyz-Impl.h` instead of standard `xyz.
159164

160165
You can include this `.hpp` file
161166

162-
```
167+
```cpp
163168
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
164169
#include "ESP32_ISR_Servo.hpp" //https://github.com/khoih-prog/ESP32_ISR_Servo
165170
```
166171

167172
in many files. But be sure to use the following `.h` file **in just 1 `.h`, `.cpp` or `.ino` file**, which must **not be included in any other file**, to avoid `Multiple Definitions` Linker Error
168173

169-
```
174+
```cpp
170175
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
171176
#include "ESP32_ISR_Servo.h" //https://github.com/khoih-prog/ESP32_ISR_Servo
172177
```
@@ -188,33 +193,33 @@ Please have a look at [**ESP_WiFiManager Issue 39: Not able to read analog port
188193

189194
#### 2. ESP32 ADCs functions
190195

191-
- ADC1 controls ADC function for pins **GPIO32-GPIO39**
192-
- ADC2 controls ADC function for pins **GPIO0, 2, 4, 12-15, 25-27**
196+
- `ADC1` controls ADC function for pins **GPIO32-GPIO39**
197+
- `ADC2` controls ADC function for pins **GPIO0, 2, 4, 12-15, 25-27**
193198

194199
#### 3.. ESP32 WiFi uses ADC2 for WiFi functions
195200

196-
Look in file [**adc_common.c**](https://github.com/espressif/esp-idf/blob/master/components/driver/adc_common.c#L61)
201+
Look in file [**adc_common.c**](https://github.com/espressif/esp-idf/blob/master/components/driver/adc_common.c)
197202

198-
> In ADC2, there're two locks used for different cases:
203+
> In `ADC2`, there're two locks used for different cases:
199204
> 1. lock shared with app and Wi-Fi:
200205
> ESP32:
201-
> When Wi-Fi using the ADC2, we assume it will never stop, so app checks the lock and returns immediately if failed.
206+
> When Wi-Fi using the `ADC2`, we assume it will never stop, so app checks the lock and returns immediately if failed.
202207
> ESP32S2:
203208
> The controller's control over the ADC is determined by the arbiter. There is no need to control by lock.
204209
>
205210
> 2. lock shared between tasks:
206-
> when several tasks sharing the ADC2, we want to guarantee
211+
> when several tasks sharing the `ADC2`, we want to guarantee
207212
> all the requests will be handled.
208213
> Since conversions are short (about 31us), app returns the lock very soon,
209214
> we use a spinlock to stand there waiting to do conversions one by one.
210215
>
211216
> adc2_spinlock should be acquired first, then adc2_wifi_lock or rtc_spinlock.
212217
213218

214-
- In order to use ADC2 for other functions, we have to **acquire complicated firmware locks and very difficult to do**
215-
- So, it's not advisable to use ADC2 with WiFi/BlueTooth (BT/BLE).
216-
- Use ADC1, and pins GPIO32-GPIO39
217-
- If somehow it's a must to use those pins serviced by ADC2 (**GPIO0, 2, 4, 12, 13, 14, 15, 25, 26 and 27**), use the **fix mentioned at the end** of [**ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example**](https://github.com/khoih-prog/ESP_WiFiManager/issues/39) to work with ESP32 WiFi/BlueTooth (BT/BLE).
219+
- In order to use `ADC2` for other functions, we have to **acquire complicated firmware locks and very difficult to do**
220+
- So, it's not advisable to use `ADC2` with WiFi/BlueTooth (BT/BLE).
221+
- Use `ADC1`, and pins `GPIO32-GPIO39`
222+
- If somehow it's a must to use those pins serviced by `ADC2` (**GPIO0, 2, 4, 12, 13, 14, 15, 25, 26 and 27**), use the **fix mentioned at the end** of [**ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example**](https://github.com/khoih-prog/ESP_WiFiManager/issues/39) to work with ESP32 WiFi/BlueTooth (BT/BLE).
218223

219224
---
220225
---
@@ -232,7 +237,7 @@ Look in file [**adc_common.c**](https://github.com/espressif/esp-idf/blob/master
232237

233238
### New functions
234239

235-
```
240+
```cpp
236241
// returns last position in degrees if success, or -1 on wrong servoIndex
237242
int getPosition(unsigned servoIndex);
238243

@@ -262,7 +267,7 @@ You'll see blynkTimer Software is blocked while system is connecting to WiFi / I
262267
263268
How to use:
264269
265-
```
270+
```cpp
266271
#ifndef ESP32
267272
#error This code is designed to run on ESP32 platform, not Arduino nor ESP8266! Please check your Tools->Board setting.
268273
#endif
@@ -403,7 +408,7 @@ https://github.com/khoih-prog/ESP32_ISR_Servo/blob/f85c83625eaefcc27d89511e2d8ba
403408

404409
```
405410
Starting ESP32_MultipleRandomServos on ESP32_DEV
406-
ESP32_ISR_Servo v1.4.0
411+
ESP32_ISR_Servo v1.5.0
407412
Setup OK Servo index = 0
408413
Setup OK Servo index = 1
409414
Setup OK Servo index = 2
@@ -465,7 +470,7 @@ Servos idx = 5, act. pos. (deg) = 180, pulseWidth (us) = 2450
465470

466471
```
467472
Starting ESP32_ISR_MultiServos on ESP32_DEV
468-
ESP32_ISR_Servo v1.4.0
473+
ESP32_ISR_Servo v1.5.0
469474
Setup Servo1 OK
470475
Setup Servo2 OK
471476
Servo1 pos = 0, Servo2 pos = 180
@@ -510,7 +515,7 @@ Servo1 pos = 150, Servo2 pos = 30
510515

511516
```
512517
Starting MultipleRandomServos on ESP32S3_DEV
513-
ESP32_ISR_Servo v1.4.0
518+
ESP32_ISR_Servo v1.5.0
514519
[ISR_SERVO] ESP32_S3_TimerInterrupt: _timerNo = 3 , _fre = 1000000
515520
[ISR_SERVO] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
516521
[ISR_SERVO] _timerIndex = 1 , _timerGroup = 1
@@ -604,7 +609,7 @@ Servos idx = 3, act. pos. (deg) = [ISR_SERVO] Idx = 3
604609

605610
```
606611
Starting ESP32_ISR_MultiServos on ESP32S2_DEV
607-
ESP32_ISR_Servo v1.4.0
612+
ESP32_ISR_Servo v1.5.0
608613
[ISR_SERVO] ESP32_S2_TimerInterrupt: _timerNo = 3 , _fre = 1000000
609614
[ISR_SERVO] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
610615
[ISR_SERVO] _timerIndex = 1 , _timerGroup = 1
@@ -691,7 +696,7 @@ Submit issues to: [ESP32_ISR_Servo issues](https://github.com/khoih-prog/ESP32_I
691696
11. Add example [multiFileProject](examples/multiFileProject) to demo for multiple-file project
692697
12. Fix breaking issue caused by **ESP32 core v2.0.1+** by increasing `TIMER_INTERVAL_MICRO` to `12uS` from `10uS`
693698
13. Suppress errors and warnings for new ESP32 core v2.0.4
694-
699+
14. Use `allman astyle` and add `utils`
695700

696701
---
697702
---
@@ -729,5 +734,5 @@ If you want to contribute to this project:
729734

730735
## Copyright
731736

732-
Copyright 2019- Khoi Hoang
737+
Copyright (C) 2019- Khoi Hoang
733738

changelog.md

+13
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@
66
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
77
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/ESP32_ISR_Servo.svg)](http://github.com/khoih-prog/ESP32_ISR_Servo/issues)
88

9+
10+
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a>
11+
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a>
12+
<a href="https://profile-counter.glitch.me/khoih-prog/count.svg" title="Total khoih-prog Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog/count.svg" style="height: 30px;width: 200px;"></a>
13+
<a href="https://profile-counter.glitch.me/khoih-prog-ESP32_ISR_Servo/count.svg" title="ESP32_ISR_Servo Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-ESP32_ISR_Servo/count.svg" style="height: 30px;width: 200px;"></a>
14+
915
---
1016
---
1117

1218
## Table of Contents
1319

1420
* [Changelog](#changelog)
21+
* [Releases v1.5.0](#releases-v150)
1522
* [Releases v1.4.0](#releases-v140)
1623
* [Releases v1.3.0](#releases-v130)
1724
* [Releases v1.2.1](#releases-v121)
@@ -25,6 +32,12 @@
2532

2633
## Changelog
2734

35+
### Releases v1.5.0
36+
37+
1. Fix doubled time for `ESP32_C3, ESP32_S2 and ESP32_S3`. Check [Error in the value defined by TIMER0_INTERVAL_MS #28](https://github.com/khoih-prog/ESP32_ISR_Servo/issues/28)
38+
2. Modify examples to avoid using `LED_BUILTIN` / `GPIO2` and `GPIO2` as they can cause crash in some boards, such as `ESP32_C3`
39+
3. Use `allman astyle` and add `utils`
40+
2841
### Releases v1.4.0
2942

3043
1. Suppress errors and warnings for new ESP32 core v2.0.4+

0 commit comments

Comments
 (0)