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

Commit eb11f04

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_New_TimerInterrupt/issues/28) 2. Modify examples to avoid using `LED_BUILTIN` / `GPIO2` as it can cause crash in some boards, such as `ESP32_C3` 3. Use `allman astyle` and add `utils`
1 parent f6dc6e7 commit eb11f04

20 files changed

+1004
-809
lines changed

CONTRIBUTING.md

+27-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ 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.)
@@ -31,28 +31,50 @@ 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 using ESP32_New_TimerInterrupt.
41-
40+
I encountered a crash while using this library
4241
Steps to reproduce:
4342
1. ...
4443
2. ...
4544
3. ...
4645
4. ...
4746
```
4847

48+
### Additional context
49+
50+
Add any other context about the problem here.
51+
52+
---
53+
4954
### Sending Feature Requests
5055

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

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

60+
---
61+
5562
### Sending Pull Requests
5663

5764
Pull Requests with changes and fixes are also welcome!
5865

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_New_TimerInterrupt_GitHub/
72+
xy@xy-Inspiron-3593:~/Arduino/xy/ESP32_New_TimerInterrupt_GitHub$
73+
```
74+
75+
2. Issue astyle command
76+
77+
```
78+
xy@xy-Inspiron-3593:~/Arduino/xy/ESP32_New_TimerInterrupt_GitHub$ bash utils/restyle.sh
79+
```
80+

README.md

+31-26
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
[![arduino-library-badge](https://www.ardu-badge.com/badge/ESP32_New_TimerInterrupt.svg?)](https://www.ardu-badge.com/ESP32_New_TimerInterrupt)
44
[![GitHub release](https://img.shields.io/github/release/khoih-prog/ESP32_New_TimerInterrupt.svg)](https://github.com/khoih-prog/ESP32_New_TimerInterrupt/releases)
5-
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/khoih-prog/ESP32_New_TimerInterrupt/blob/master/LICENSE)
5+
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/khoih-prog/ESP32_New_TimerInterrupt/blob/main/LICENSE)
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_New_TimerInterrupt.svg)](http://github.com/khoih-prog/ESP32_New_TimerInterrupt/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_New_TimerInterrupt/count.svg" title="ESP32_New_TimerInterrupt Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-ESP32_New_TimerInterrupt/count.svg" style="height: 30px;width: 200px;"></a>
1114

1215
---
1316
---
@@ -133,7 +136,7 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
133136
## Prerequisites
134137

135138
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)
136-
2. [`ESP32 Core 2.0.4+`](https://github.com/espressif/arduino-esp32) for ESP32-based boards (ESP32, ESP32_S2, ESP32_S3 and ESP32_C3). [![Latest release](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/).
139+
2. [`ESP32 Core 2.0.5+`](https://github.com/espressif/arduino-esp32) for ESP32-based boards (ESP32, ESP32_S2, ESP32_S3 and ESP32_C3). [![Latest release](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/).
137140

138141
---
139142
---
@@ -152,9 +155,9 @@ You can also use this link [![arduino-library-badge](https://www.ardu-badge.com/
152155
Another way to install is to:
153156

154157
1. Navigate to [**ESP32_New_TimerInterrupt**](https://github.com/khoih-prog/ESP32_New_TimerInterrupt) page.
155-
2. Download the latest release `ESP32_New_TimerInterrupt-master.zip`.
156-
3. Extract the zip file to `ESP32_New_TimerInterrupt-master` directory
157-
4. Copy whole `ESP32_New_TimerInterrupt-master` folder to Arduino libraries' directory such as `~/Arduino/libraries/`.
158+
2. Download the latest release `ESP32_New_TimerInterrupt-main.zip`.
159+
3. Extract the zip file to `ESP32_New_TimerInterrupt-main` directory
160+
4. Copy whole `ESP32_New_TimerInterrupt-main` folder to Arduino libraries' directory such as `~/Arduino/libraries/`.
158161

159162
---
160163

@@ -176,13 +179,13 @@ The current library implementation, using `xyz-Impl.h` instead of standard `xyz.
176179

177180
You can use
178181

179-
```
182+
```cpp
180183
#include <ESP32_New_TimerInterrupt.hpp> //https://github.com/khoih-prog/ESP32_New_TimerInterrupt
181184
```
182185

183186
in many files. But be sure to use the following `#include <ESP32_New_ISR_Timer.h>` **in just 1 `.h`, `.cpp` or `.ino` file**, which must **not be included in any other file**, to avoid `Multiple Definitions` Linker Error
184187

185-
```
188+
```cpp
186189
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
187190
#include <ESP32_New_TimerInterrupt.h> //https://github.com/khoih-prog/ESP32_New_TimerInterrupt
188191
```
@@ -198,33 +201,34 @@ Please have a look at [**ESP_WiFiManager Issue 39: Not able to read analog port
198201

199202
#### 2. ESP32 ADCs functions
200203

201-
- ADC1 controls ADC function for pins **GPIO32-GPIO39**
202-
- ADC2 controls ADC function for pins **GPIO0, 2, 4, 12-15, 25-27**
204+
- `ADC1` controls ADC function for pins **GPIO32-GPIO39**
205+
- `ADC2` controls ADC function for pins **GPIO0, 2, 4, 12-15, 25-27**
203206

204207
#### 3.. ESP32 WiFi uses ADC2 for WiFi functions
205208

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

208-
> In ADC2, there're two locks used for different cases:
211+
> In `ADC2`, there're two locks used for different cases:
209212
> 1. lock shared with app and Wi-Fi:
210213
> ESP32:
211-
> When Wi-Fi using the ADC2, we assume it will never stop, so app checks the lock and returns immediately if failed.
214+
> When Wi-Fi using the `ADC2`, we assume it will never stop, so app checks the lock and returns immediately if failed.
212215
> ESP32S2:
213216
> The controller's control over the ADC is determined by the arbiter. There is no need to control by lock.
214217
>
215218
> 2. lock shared between tasks:
216-
> when several tasks sharing the ADC2, we want to guarantee
219+
> when several tasks sharing the `ADC2`, we want to guarantee
217220
> all the requests will be handled.
218221
> Since conversions are short (about 31us), app returns the lock very soon,
219222
> we use a spinlock to stand there waiting to do conversions one by one.
220223
>
221224
> adc2_spinlock should be acquired first, then adc2_wifi_lock or rtc_spinlock.
222225
223226

224-
- In order to use ADC2 for other functions, we have to **acquire complicated firmware locks and very difficult to do**
225-
- So, it's not advisable to use ADC2 with WiFi/BlueTooth (BT/BLE).
226-
- Use ADC1, and pins GPIO32-GPIO39
227-
- 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).
227+
- In order to use `ADC2` for other functions, we have to **acquire complicated firmware locks and very difficult to do**
228+
- So, it's not advisable to use `ADC2` with WiFi/BlueTooth (BT/BLE).
229+
- Use `ADC1`, and pins `GPIO32-GPIO39`
230+
- 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).
231+
228232

229233
---
230234
---
@@ -289,9 +293,8 @@ https://github.com/khoih-prog/ESP32_New_TimerInterrupt/blob/bf13ce54803b1f2cdc22
289293
The following is the sample terminal output when running example [TimerInterruptTest](examples/TimerInterruptTest) to demonstrate how to start/stop Hardware Timers.
290294

291295
```
292-
293296
Starting TimerInterruptTest on ESP32_DEV
294-
ESP32_New_TimerInterrupt v1.4.0
297+
ESP32_New_TimerInterrupt v1.5.0
295298
CPU Frequency = 240 MHz
296299
[TISR] ESP32_TimerInterrupt: _timerNo = 0 , _fre = 1000000
297300
[TISR] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
@@ -324,7 +327,7 @@ The following is the sample terminal output when running example [Change_Interva
324327

325328
```
326329
Starting Change_Interval on ESP32_DEV
327-
ESP32_New_TimerInterrupt v1.4.0
330+
ESP32_New_TimerInterrupt v1.5.0
328331
CPU Frequency = 240 MHz
329332
Starting ITimer0 OK, millis() = 136
330333
Starting ITimer1 OK, millis() = 147
@@ -353,7 +356,7 @@ The following is the sample terminal output when running example [Argument_None]
353356

354357
```
355358
Starting Argument_None on ESP32S2_DEV
356-
ESP32_New_TimerInterrupt v1.4.0
359+
ESP32_New_TimerInterrupt v1.5.0
357360
CPU Frequency = 240 MHz
358361
[TISR] ESP32_S2_TimerInterrupt: _timerNo = 0 , _fre = 1000000
359362
[TISR] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
@@ -405,7 +408,7 @@ The following is the sample terminal output when running example [ISR_16_Timers_
405408

406409
```
407410
Starting ISR_16_Timers_Array_Complex on ESP32C3_DEV
408-
ESP32_New_TimerInterrupt v1.4.0
411+
ESP32_New_TimerInterrupt v1.5.0
409412
CPU Frequency = 160 MHz
410413
Starting ITimer OK, millis() = 2187
411414
SimpleTimer : 2, ms : 12193, Dms : 10004
@@ -544,7 +547,6 @@ Timer : 12, programmed : 65000, actual : 65008
544547
Timer : 13, programmed : 70000, actual : 70008
545548
Timer : 14, programmed : 75000, actual : 75008
546549
Timer : 15, programmed : 80000, actual : 80008
547-
548550
```
549551

550552
---
@@ -556,7 +558,7 @@ The following is the sample terminal output when running example [ISR_16_Timers_
556558

557559
```
558560
Starting ISR_16_Timers_Array on ESP32S2_DEV
559-
ESP32_New_TimerInterrupt v1.4.0
561+
ESP32_New_TimerInterrupt v1.5.0
560562
CPU Frequency = 240 MHz
561563
Starting ITimer OK, millis() = 2538
562564
simpleTimerDoingSomething2s: Delta programmed ms = 2000, actual = 10008
@@ -571,7 +573,7 @@ The following is the sample terminal output when running example [ISR_16_Timers_
571573

572574
```
573575
Starting ISR_16_Timers_Array_Complex on ESP32S3_DEV
574-
ESP32_New_TimerInterrupt v1.4.0
576+
ESP32_New_TimerInterrupt v1.5.0
575577
CPU Frequency = 240 MHz
576578
[TISR] ESP32_S3_TimerInterrupt: _timerNo = 1 , _fre = 1000000
577579
[TISR] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
@@ -777,6 +779,9 @@ Submit issues to: [ESP32_New_TimerInterrupt issues](https://github.com/khoih-pro
777779
- ESP32_S2 : ESP32S2 Native USB, UM FeatherS2 Neo, UM TinyS2, UM RMP, microS2, LOLIN_S2_MINI, LOLIN_S2_PICO, ADAFRUIT_FEATHER_ESP32S2, ADAFRUIT_FEATHER_ESP32S2_TFT, ATMegaZero ESP32-S2, Deneyap Mini, FRANZININHO_WIFI, FRANZININHO_WIFI_MSC
778780
- ESP32_S3 : UM TinyS3, UM PROS3, UM FeatherS3, ESP32_S3_USB_OTG, ESP32S3_CAM_LCD, DFROBOT_FIREBEETLE_2_ESP32S3, ADAFRUIT_FEATHER_ESP32S3_TFT
779781
- ESP32_C3 : LOLIN_C3_MINI, DFROBOT_BEETLE_ESP32_C3, ADAFRUIT_QTPY_ESP32C3, AirM2M_CORE_ESP32C3, XIAO_ESP32C3
782+
13. Use `allman astyle` and add `utils`
783+
784+
780785

781786
---
782787
---
@@ -800,7 +805,7 @@ If you want to contribute to this project:
800805

801806
### License
802807

803-
- The library is licensed under [MIT](https://github.com/khoih-prog/ESP32_New_TimerInterrupt/blob/master/LICENSE)
808+
- The library is licensed under [MIT](https://github.com/khoih-prog/ESP32_New_TimerInterrupt/blob/main/LICENSE)
804809

805810
---
806811

changelog.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,23 @@
22

33
[![arduino-library-badge](https://www.ardu-badge.com/badge/ESP32_New_TimerInterrupt.svg?)](https://www.ardu-badge.com/ESP32_New_TimerInterrupt)
44
[![GitHub release](https://img.shields.io/github/release/khoih-prog/ESP32_New_TimerInterrupt.svg)](https://github.com/khoih-prog/ESP32_New_TimerInterrupt/releases)
5-
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/khoih-prog/ESP32_New_TimerInterrupt/blob/master/LICENSE)
5+
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/khoih-prog/ESP32_New_TimerInterrupt/blob/main/LICENSE)
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_New_TimerInterrupt.svg)](http://github.com/khoih-prog/ESP32_New_TimerInterrupt/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_New_TimerInterrupt/count.svg" title="ESP32_New_TimerInterrupt Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-ESP32_New_TimerInterrupt/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)
@@ -26,6 +33,12 @@
2633

2734
## Changelog
2835

36+
### Releases v1.5.0
37+
38+
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_New_TimerInterrupt/issues/28)
39+
2. Modify examples to avoid using `LED_BUILTIN` / `GPIO2` as it can cause crash in some boards, such as `ESP32_C3`
40+
3. Use `allman astyle` and add `utils`
41+
2942
### Releases v1.4.0
3043

3144
1. Suppress warnings for ESP32_C3, ESP32_S2 and ESP32_S3

0 commit comments

Comments
 (0)