Compare commits

...

1067 commits

Author SHA1 Message Date
Limor "Ladyada" Fried
eeab5cf9da
Merge pull request #23 from adafruit/update-tinyuf2-partition-order
change(partitions): Reorder No OTA TinyUF2 partition scheme to come first on 4MB boards
2025-07-30 20:46:33 -04:00
tyeth
138ea12d9f change(partitions): Reorder No OTA TinyUF2 partition scheme to come first on 4MB boards 2025-07-29 16:56:17 +01:00
Me No Dev
6359af9a0a
Merge pull request #11641 from espressif/feat/esp-zigbee-sdk-166
feat(zigbee): Update ESP-ZIGBEE-SDK to 1.6.6
2025-07-29 13:31:44 +03:00
Lucas Saavedra Vaz
f5b08cd812
feat(codeql): Add CodeQL analysis for interpreted languages (#11662) 2025-07-28 13:38:14 -03:00
Me No Dev
e998f5be8f
Merge pull request #11640 from espressif/feat/updated-template
feat(github): Update template type
2025-07-28 15:08:36 +03:00
Me No Dev
13bacf5086
Merge pull request #11639 from espressif/feat/remove-forum
feat(github): remove ESP32 forum from issue template
2025-07-28 15:08:04 +03:00
Me No Dev
9902934412
Merge pull request #11629 from angelnu/patch-1
Allow calls to timer functions within ISR
2025-07-28 15:07:05 +03:00
Me No Dev
1a56a1dcca
Merge pull request #11608 from PaulaScharf/master
Add senseBox Eye board
2025-07-28 15:06:45 +03:00
Me No Dev
288672980c
Merge pull request #11661 from espressif/fix/idf-component-logs
fix(component): Use external diag logs to avoid error
2025-07-28 14:59:51 +03:00
Jan Procházka
311955ccbb fix(component): Use external diag logs to avoid error 2025-07-28 11:59:01 +02:00
pre-commit-ci-lite[bot]
a5e85f675e
ci(pre-commit): Apply automatic fixes 2025-07-28 07:44:47 +00:00
Paula Scharf
e375698ade feat(board): spelling 2025-07-28 09:44:04 +02:00
pre-commit-ci-lite[bot]
0dcb1d1178
ci(pre-commit): Apply automatic fixes 2025-07-28 06:56:12 +00:00
Paula Scharf
ed6e95d4fc feat(board): use existing led API 2025-07-28 08:46:14 +02:00
Jan Procházka
b3152a4ffc feat(zigbee): Update SDK to latest 2025-07-25 14:10:32 +02:00
Parsaabasi
10e73be714
feat(github): Update template type 2025-07-25 12:49:46 +02:00
Parsaabasi
5c24611b91
feat(github): remove ESP32 forum from issue template 2025-07-25 12:35:55 +02:00
pre-commit-ci-lite[bot]
e3a0a3a6c5
ci(pre-commit): Apply automatic fixes 2025-07-24 11:22:13 +00:00
Angel Nunez Mencias
d55646344d
Merge branch 'master' into patch-1 2025-07-24 00:42:53 +02:00
Angel Nunez Mencias
126039663f
fix: conditional logs when not ISR 2025-07-24 00:09:17 +02:00
Me No Dev
c7520ccef0
fix(report): Update Issue-report.yml for version 3.3.0 2025-07-23 17:15:59 +03:00
Me No Dev
dbaf6a3226
Merge pull request #10884 from espressif/release/v3.3.x
Arduino ESP32 v3.3 based on ESP-IDF v5.5 (master)
2025-07-23 15:28:45 +03:00
Wulu
3da3ad2f2d
feat(board): Add onboard LED support for Waveshare ESP32-S3 Zero (#11630)
Defines the standard LED_BUILTIN and RGB_BUILTIN macros for the Waveshare ESP32-S3 Zero, allowing its onboard WS2812 RGB LED to be controlled via standard Arduino APIs.
2025-07-23 15:28:19 +03:00
Angel Nunez Mencias
67c59a2021
fix: remove log from IRAM function 2025-07-23 07:26:03 +02:00
Angel Nunez Mencias
0bdad7f2a3
Merge branch 'master' into patch-1 2025-07-23 07:23:37 +02:00
Angel Nunez Mencias
e92e631811
feat: Allow calls to timer functions within ISR 2025-07-23 07:11:11 +02:00
pre-commit-ci-lite[bot]
6fdfccf21b
ci(pre-commit): Apply automatic fixes 2025-07-22 22:46:36 +00:00
Me No Dev
2b3b4f05d5
Merge branch 'master' into release/v3.3.x 2025-07-23 01:45:13 +03:00
Jan Procházka
ae634a92e3
fix(zigbee): Fix RGB color calculation (#11624) 2025-07-23 01:44:36 +03:00
Jan Procházka
f08efa1fa3
feat(docs): Updaze Zigbee docs with latest changes (#11627) 2025-07-23 01:43:23 +03:00
Lucas Saavedra Vaz
a14ce89715
fix(tamc_termod_s3): Fix header includes (#11625) 2025-07-23 01:38:01 +03:00
Me No Dev
69d891434b
IDF release/v5.5 b66b5448 (#11626)
IDF release/v5.5 b66b5448
2025-07-23 01:37:23 +03:00
Me No Dev
554de56f40
IDF release/v5.5 25c7c119 (#11623) 2025-07-22 11:23:49 +03:00
Jan Procházka
c369dca062
feat(docs): Add Zigbee library API documentation (#11525)
* feat(docs): Add Zigbee library documentation

* fix: Remove helper scripts

* fix: Proper class naming for better readability

* fix(docs): Fix typos

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* ci(pre-commit): Apply automatic fixes

* fix(docs): Precommit fixes

* fix(docs): Precommit fixes

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-22 00:35:28 +03:00
Me No Dev
4c51968acf
Merge branch 'master' into release/v3.3.x 2025-07-21 15:49:41 +03:00
Me No Dev
4a3c6d7fbb
feat(netif): Allow setting interface's routing priority (#11617)
* feat(netif): Allow setting interface's routing priority

* feat(netif): Rename route priority method names and add notes

* feat(netif): Print route prio for each interface
2025-07-21 15:49:15 +03:00
Me No Dev
f1712943b4
fix(ppp): Detach PPP RST pin from periman on end (#11620) 2025-07-21 15:48:05 +03:00
Jan Procházka
995e603d3a
fix(zigbee): Replace assert with error log to solve immediate crash (#11614)
* fix(zigbee): Replace assert with error log to solve immediate crash

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-21 15:47:43 +03:00
Jan Procházka
cb3329be60
feat(zigbee): Add callback option for default response message (#11613)
* feat(zigbee): Add cb option for default response message

* fix(example): Add timeout and fix spelling

* feat(zigbee): Add global default response cb option

* fix(example): Use task for measure and sleep

* fix(zigbee): Remove debug logs

* ci(pre-commit): Apply automatic fixes

* fix(example): Add retry and fix typo

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-21 15:47:21 +03:00
Paula Scharf
349b11d2d8 feat(board): name tag lowercase 2025-07-20 23:00:05 +02:00
Paula Scharf
28e9076601 feat(board): build name uppercase 2025-07-20 22:53:35 +02:00
Paula Scharf
cf0a58908d feat(board): remove APOTA 2025-07-19 15:14:07 +02:00
Paula Scharf
439bbb8391 feat(board): use additional button for APOTA 2025-07-19 15:14:07 +02:00
Paula Scharf
cdf606af5f feat(board): updated tinyuf2 bins 2025-07-19 15:14:07 +02:00
Paula Scharf
f330585717 feat(board): update PID 2025-07-19 15:14:07 +02:00
Paula Scharf
76210797ed fix(board): add APOTA to senseBox Eye 2025-07-19 15:14:07 +02:00
Paula Scharf
6a33f0bfc1 fix(board): add APOTA description comments 2025-07-19 15:14:07 +02:00
Paula Scharf
9641de1b12 feat(board): add senseBox Eye board 2025-07-19 15:13:06 +02:00
Sugar Glider
3ad17de6aa
fix(build): make core compatible with IDF 5.3 (#11607)
* fix(uart): make it compatible with IDF 5.3

* fix(ci): Fix artifact names

* fix(build): Fix ESP_NOW and WiFi for IDF 5.3

* fix(build): Fix NetworkClient for IDF 5.3

* fix(build): Fix WiFi for IDF 5.3

* fix(build): Fix WiFi Captive Portal for IDF 5.3

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: me-no-dev <hristo@espressif.com>
2025-07-18 19:02:55 +03:00
Lucas Saavedra Vaz
211a0ce143
fix(ci): Fix artifact names 2025-07-18 09:15:48 -03:00
me-no-dev
000336bad0 fix(build): Enable I2C FIFO mode only on IDF 5.4.2+ 2025-07-18 11:25:36 +03:00
me-no-dev
530c1a43fe fix(build): Enable I2C FIFO mode only on IDF 5.4.2+ 2025-07-18 11:19:50 +03:00
me-no-dev
346e7f4138 fix(build): Enable I2C FIFO mode only on IDF 5.5+ 2025-07-18 11:18:13 +03:00
me-no-dev
6cb5184487 fix(build): Fix build for IDF 5.3.3+ and older releases 2025-07-18 11:12:22 +03:00
me-no-dev
98d309f84a feat(ci): Enable builds on IDF 5.3, 5.4 and 5.5 2025-07-18 10:44:01 +03:00
me-no-dev
a69c71f6ad feat(core): Update core version to 3.3.0 2025-07-16 19:55:53 +03:00
Me No Dev
5ccd9523d6
Merge branch 'master' into release/v3.3.x 2025-07-16 19:53:58 +03:00
Sugar Glider
6015fd73e0
feat(openthread): native API extension (#11598)
* feat(openthread): native API extension

* fix(openthread): wrong return type and parameter

* fix(openthread): wrong field reference

* fix(openthread): CR/LF fix

* feat(openthread): print leader RLOC information

* feat(openthread): code improvements

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-16 19:53:36 +03:00
pre-commit-ci-lite[bot]
ac05f18720
ci(pre-commit): Apply automatic fixes 2025-07-16 12:12:43 +00:00
Sugar Glider
3f32903125
Merge branch 'master' into release/v3.3.x 2025-07-16 09:10:59 -03:00
Me No Dev
ce7ef9c2ba
IDF release/v5.5 cf8dad07 (#11601)
IDF release/v5.5 cf8dad07
2025-07-16 13:42:07 +03:00
Sugar Glider
82d56bc679
feat(gpio): new functional interrupt lambda example (#11589)
* feat(gpio): new functional interrupt lambda example

* fix(readme): schematic diagram allignment

* fix(example): uses volatile for ISR variables

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(example): uses volatile for ISR variables

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(example): uses volatile data type also for the pointers

* fix(readme): clear documentation

* feat(example): improves ISR execution time

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* feat(gpio): simplifies the example and documentation

* feat(gpio): uses IRAM lambda and fixes volatile operation

* fix(doc): fixing documentation apresentation

* ci(pre-commit): Apply automatic fixes

* fix(ci): Update README.md

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2025-07-16 11:51:31 +03:00
Lucas Saavedra Vaz
1f0d4b5dc0
ci(gitlab): Initial GitLab setup (#11577)
* ci(gitlab): Initial GitLab setup

* fix(version): Add to version update script

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-14 19:17:56 +03:00
Sugar Glider
0a45a06142
feat(wire): std::functional Wire slave callback functions (#11582)
This PR enhances the Wire library to support std::function–based callbacks for I2C slave mode, enabling the use of lambdas and captured contexts.

- Replaces raw function pointers in TwoWire and HardwareI2C with std::function for onRequest and onReceive
- Updates constructors, method signatures, and default initializations to use std::function
- Adds new example sketch, CI config, and documentation updates demonstrating the functional callback API
2025-07-12 02:12:36 -03:00
Sugar Glider
c6a3bcb014
feat(matter): removing wifi requirement for H2 and C5 (#11581)
This PR removes WiFi provisioning support from CI and examples (shifting to Thread/BLE provisioning), updates the CI configs for all Matter examples to drop the WiFi requirement, and adds new API keywords and a fresh “LambdaSingleCallbackManyEPs” example.

- Deleted the WiFiProvWithinMatter example (its .ino and ci.json) since BLE is now used for provisioning.
- Stripped "CONFIG_SOC_WIFI_SUPPORTED=y" from the CI JSON of existing examples to test Thread-only builds.
- Updated keywords.txt with new Matter API identifiers and introduced a new “LambdaSingleCallbackManyEPs” example with CI and source
2025-07-12 00:11:41 -03:00
Sugar Glider
4ee17dea04
feat(matter): new matter lambda function example (#11561)
Adds a new Matter Library example using lambda function to creat 6 endpoints using a single callback
2025-07-11 11:25:27 -03:00
Me No Dev
fbf3c11daa
Merge branch 'master' into release/v3.3.x 2025-07-09 14:06:56 +03:00
Lucas Saavedra Vaz
87b718a59c
fix(merge): Fix merging CN Json (#11574) 2025-07-09 13:25:16 +03:00
Lucas Saavedra Vaz
ee021855a1
feat(docs_version): Update docs in update-version script (#11564)
* feat(docs_version): Update docs in update-version script

* fix(logging): Fix log message

* fix(idf_version): Add error if IDF version is not found
2025-07-09 13:24:42 +03:00
Me No Dev
df3db3c9dc
Merge branch 'master' into release/v3.3.x 2025-07-08 17:59:48 +03:00
Lucas Saavedra Vaz
ccc0a69ef8
change(esptool): Upgrade esptool to release v5.0.0 (#11563) 2025-07-08 17:58:36 +03:00
Lucas Saavedra Vaz
6a5839acb2
change(esptool): Upgrade esptool to release v5.0.0 (#11562) 2025-07-08 17:56:23 +03:00
Me No Dev
2cb6fbccdb
Add access methods to get the Wire bus number and I2C bus handle (#11570)
* feat(i2c): Add method to access the I2C bus handle

* feat(wire): Add access method to get the I2C bus number

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-08 16:18:42 +03:00
Me No Dev
241e2576be
fix(async): Update IP setup in AsyncUDP (#11569)
* fix(async): Update IP setup in AsyncUDP

* fix(udp): Revert to IP_SET_TYPE_VAL in connect
2025-07-08 16:00:51 +03:00
Lucas Saavedra Vaz
040e0ca42a
fix(dangerjs): Disable target branch rule (#11565) 2025-07-08 13:09:59 +03:00
Jan Procházka
e2c7578fa8
feat(zigbee): Add Fan Control endpoint support (#11559)
* feat(zigbee): Add Fan Control endpoint support

* fix(zigbee): Update logs and change device_id

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-08 13:08:56 +03:00
Jason2866
b709a78283
fix deprecated warnings caaused from esptool v5.0.0 (#11556) 2025-07-07 13:01:50 +03:00
Daniel.Cao
d3c5a82eed
fix(board): Update PSRAM configuration for RAK3112 to fix PSRAM error (#11552)
* fix(board): Update PSRAM configuration for RAK3112 to fix PSRAM error

* feat(board): RAK3112 add WisBlock module pin definitions to pins_arduino.h

* fix(board): Update RAK3112 flash mode and boot settings for improved performance

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Daniel.Cao <daniel.cao@rakwireless.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-07 11:56:44 +03:00
Me No Dev
1426927c83
fix(matter): Fix MatterSmartButon.ino when CHIPOBLE is on 2025-07-04 18:37:56 +03:00
Me No Dev
f84fab5592
Merge branch 'master' into release/v3.3.x 2025-07-04 17:14:12 +03:00
Me No Dev
aab542d658
Update Issue-report.yml to add v 3.2.1 2025-07-03 23:14:53 +03:00
Dogus Cendek
0b9c9362de
Add Deneyap Kart v2 (#11545)
* Updated Pins of Devkits

Deleted soc_caps.h library and related commands at Deneyap Kart 1A v2, Deneyap Kart 1A, Deneyap Mini and Deneyap Mini v2.
Added TX1 and RX1 pins and updated LED pin definition at all Devkits.
Added BOOT (BT) pins at Deneyap Kart, Deneyap Kart 1A, Deneyap Mini and Deneyap Kart G.
Changed D0 and D1 pin numbers at Deneyap Kart G.
Changed D12, D13, D14, D15, PWM0 and PWM1 pin numbers at Deneyap Kart 1A v2.
Added A8, T0, T1, T2, T3, T4, T5, T6, T7, T8, D16, D17, D18, D19, PWM2, PWM3, PWM4 and BAT pin numbers at Deneyap Kart 1A v2.
Changed A2, A3, A4 (T0) and A5 (T1) pin numbers at Deneyap Kart and Deneyap Kart 1A.
Renamed DA2 (DAC2) pin as DA0 (DAC0) and changed DAC1 and DAC2 pin numbers at Deneyap Mini and Deneyap Mini v2.

* Updated board.txt of all Devkits

Updated board.txt of all Devkits

* Remove Repeating Pin Definition

Remove Repeating Pin Definition

* Fix Pin Definition

Remove repeating pin definitions of SPI, I2C and DAC.
Update RGB LED definition for using digitalWrite() command with RGB LED.

* Remove Repeating Pin Definitions

Remove repeating pin definitions of LEDB, SPI, I2C and DAC.

* Update RGB LED definition

Update RGB LED definition for using digitalWrite() command with RGB LED.

* Fix broken links for external library test

Fix broken links for external library test

* Update UploadMode Config of Deneyap Kart 1A v2

Update UploadMode Config of Deneyap Kart 1A v2

* Add Deneyap Kart v2

Add pin definitions and configs of Deneyap Kart v2.

* Update UploadMode config

Hardware CDC is default now.

* Fixed typo fault

Fixed typo fault

* Fixed build.board parameter

Fixed build.board parameter

* Removed unsupported Flash sizes and RAM type

Removed unsupported Flash sizes and RAM type from menu.

* Remove unsupported partition options

Remove unsupported partition options

* Fixed Annotations and Space

* Update pins_arduino.h
2025-07-03 23:13:42 +03:00
me-no-dev
ac961f671a Update core version to 3.2.1 2025-07-03 16:42:28 +03:00
Jan Procházka
18f647611b
fix(spi): Fix bus clock for ESP32-P4 + remove S2 leftover (#11547)
* fix(spi): Fix bus clock for ESP32-P4

* fix(ci): Ignore unused-variable warning

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-03 16:39:46 +03:00
Sugar Glider
c2d23258f1
feat(matter): enables BLE Matter commissioning with NimBLE (#11537)
* feat(matter): enables BLE Matter commissioning with NimBLE

* fix(matter): commentary typo and formatting

* fix(matter): commentary typo and formatting

* fix(matter): removes forcing second network clustter

* fix(matter): adds matter source code to CMakeLists.txt

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-03 12:25:51 +03:00
Me No Dev
d4e5c5f969
IDF release/v5.5 adb3f2a5 (#11543)
IDF release/v5.5 adb3f2a5
2025-07-03 12:25:33 +03:00
Me No Dev
70696df2d6
Merge branch 'master' into release/v3.3.x 2025-07-03 12:25:04 +03:00
Paula Scharf
12e881b6d6
fix(board): Update variant.cpp for senseBox MCU-S2 ESP32-S2 (#11532)
* fix(board): Update variant.cpp for senseBox MCU-S2 ESP32-S2

* fix(board):  translate comments

* ci(pre-commit): Apply automatic fixes

* fix(board): translate comments

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-02 22:22:20 +03:00
Paul Price
33c8438263
Add FED4 board (#11536)
* Added Fed 4 board

* fixed boards.txt

* fixed board.txt again

* added usb pid address

* fixed typo: updated name to upper case

* fix(fed4): update PID and change partition scheme to default_16MB

* fix(fed4): remove unused OPI flash mode configurations

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-02 15:48:40 +03:00
John
6474127dd4
Update ZigbeeColorDimmableLight to clamp color hue and saturation to 0-254 (Fixes #11527) (#11528)
* Clamp Zigbee color saturation to 0-254

* Clamp hue to 0-254 for Zigbee color lights

* Use std::min instead of ternary operator

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-02 15:48:03 +03:00
Daniel.Cao
7f75e445f7
feat(board): add support for RAKwireless RAK3112 (#11485)
* feat(rak3112): add pins_arduino.h for RAKWireless RAK3112 module

* feat(rak3112): update pins_arduino.h to define LED pins and update board.txt

* Delete the redundant configuration information in board.txt

* Restore the incorrect modifications to board.txt

* Delete blank lines

* Move the rak configuration information to the end of the boards.txt .

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Daniel.Cao <daniel.cao@rakwireless.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2025-07-02 15:23:01 +03:00
HighDoping
bc7a549876
fix(example): led flash not working if not using default model in camera example. (#11466)
* fix(example): led flash not working if not using default model in camera example

fix(example): add camera_config.h and enable LED FLASH based on board model

fix(example): Remove face detection description as no longer supported

* fix(example): add header guard for board_config.h
2025-07-02 14:54:12 +03:00
Me No Dev
212b12b625
IDF release/v5.4 (#11517)
* IDF release/v5.4 dfa785ed

* IDF release/v5.4 72775cd6

* IDF release/v5.4 858a988d
2025-07-02 14:41:39 +03:00
Me No Dev
f4fdecc60c
fix(csrf): Fix SCRF vulnerability in OTA examples and libraries (#11530)
* fix(csrf): Fix SCRF vulnerability in WebUpdate.ino

* fix(csrf): Prevent CSRF on other OTA examples

* fix(csrf): Require auth user and pass to be changed

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-02 14:41:06 +03:00
Jason2866
8cf0818d82
make adresses for partitions.bin and boot_app0.bin configureable (#11534) 2025-07-02 14:17:00 +03:00
Me No Dev
2592a7b3bb
feat(p4): Add method to set the pins for SDIO to WiFi chip (#11513)
* feat(p4): Add method to set the pins for SDIO to WiFi chip

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-30 16:03:38 +03:00
LusimiCollado
6e60f2f6b9
feat(variant): add kode dot ESP32-S3 board with QSPI LCD, SD and GPIO … (#11371)
* feat(variant): add KodeDot ESP32-S3 board with QSPI LCD, SD and GPIO header

* fix(kodedot): Reorder board definitions and translate comments to English

* fix(kodedot): Clean up OTA override and remove unused partition menu for kode dot

* fix(kodedot): Build board changed from ESP32S3_DEV to KODE_DOT on kode dot board

* ci(pre-commit): Fix whitespace, EOLs and codespell 'Analog'

* ci(pre-commit): Add bash script formatter

* fix(merge): New name and description for custom merge tool and change partitions table to variants folder
2025-06-30 13:18:02 +03:00
Mattias Schäffersmann
6476260e8f
fix(esp32): Fix appending to Strings longer than 64k (#11523)
If oldLen is truncated to uint16_t, appending to a String
that is longer than 65535 bytes will create a broken string.
2025-06-30 13:04:11 +03:00
Lucas Saavedra Vaz
6754b1962c
feat(esp_now): Add support for ESP NOW V2 (#11524)
* feat(esp_now): Add support for ESP NOW V2

* fix(esp_now): Return -1 on error
2025-06-30 12:02:12 +03:00
Kuba Andrýsek
9a35d9455f
feat(SDFS): Add destructor for SD card to clean up resources (#11521)
* feat(test): Enhance NVS test

* fix(nvs): Remove unused Unity header and improve Serial wait loop

* refactor(nvs): Extract string increment logic into a separate function

* refactor(test): Format long strings in expect_exact calls for better readability

* feat(SDFS): Add destructor to clean up resources
2025-06-30 11:50:49 +03:00
Lucas Saavedra Vaz
875b923035
ci(ext_lib): Skip P4 in ArduinoBLE test (#11520) 2025-06-30 11:50:17 +03:00
Lucas Saavedra Vaz
ff3cc813fc
Merge branch 'master' into release/v3.3.x 2025-06-26 13:17:18 +03:00
Lucas Saavedra Vaz
21640ac82a
fix(webserver): Validate header inputs 2025-06-26 12:43:50 +03:00
Me No Dev
5871a80616
Merge branch 'master' into release/v3.3.x 2025-06-24 17:26:45 +03:00
Me No Dev
9e61fa7e4b
IDF release/v5.4 (#11512)
* IDF release/v5.4 f0f2980d

* fix(p4): Allow custom pins on P4 for ESP-Hosted
2025-06-24 17:23:50 +03:00
Jan Procházka
0213200b3d ci(sizes): Use commit id in report-size-delta action 2025-06-24 14:40:53 +02:00
Jan Procházka
e9b0930f9d ci(sizes): Update sizes workflow action 2025-06-24 14:34:17 +02:00
Lucas Saavedra Vaz
30fb3cbb4f
fix(docs): Fix links and versions (#11505)
* fix(docs): Fix links and versions

* fix(docs): Apply suggestions and leftover substitutions
2025-06-24 14:43:27 +03:00
Jan Procházka
b7e5169ea1
fix(spi): Update spi bus for esp32s2 (#11510) 2025-06-24 14:43:05 +03:00
me-no-dev
882ef25a36 fix(p4): Update hosted and wifi_remote components 2025-06-24 12:35:18 +03:00
Me No Dev
36d049659b
IDF release/v5.5 (#11504)
* IDF release/v5.5 4c3d086c

* fix(prov): Enable BLE provisioning with NimBLE

* fix(uart): idf 5.5 new gpio_iomux_* functions (#11507)

* fix(uart): idf 5.5 new gpio_iomux_* functions

* fix(uart): formatting and style

* fix(uart): commentaries style fix

* fix(uart): commentaries style fix

* fix(uart): commentaries style fix

* fix(uart): support to any idf 5.x version

* fix(uart): changing assert in order to avoid reset

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>

* IDF release/v5.5 cbe9388f

---------

Co-authored-by: Sugar Glider <rodrigo.garcia@espressif.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-24 12:30:29 +03:00
Sugar Glider
bad975daa5
fix(uart): removes assert() to avoid reset (#11508) 2025-06-24 09:37:07 +03:00
Kuba Andrýsek
95ae8cf9c6
feat(test): Enhance NVS test (#11481)
* feat(test): Enhance NVS test

* fix(nvs): Remove unused Unity header and improve Serial wait loop

* refactor(nvs): Extract string increment logic into a separate function

* refactor(test): Format long strings in expect_exact calls for better readability
2025-06-23 15:02:47 +03:00
Me No Dev
18c909a8fd
Merge branch 'master' into release/v3.3.x 2025-06-23 14:49:32 +03:00
Lucas Saavedra Vaz
dc82467ba4
fix(esp_now): Fix broadcast example and use nullptr (#11490)
* fix(esp_now): Fix example and use nullptr

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-23 14:48:37 +03:00
Lucas Saavedra Vaz
1c79eb823c
feat(NimBLE): Add support for NimBLE (#11424)
* feat(NimBLE): Add support for NimBLE

Co-authored-by: h2zero <ryan@nable-embedded.io>

* ci(pre-commit): Apply automatic fixes

* fix(nimble): Fix typo in BLEClient

---------

Co-authored-by: h2zero <ryan@nable-embedded.io>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-23 14:47:49 +03:00
me-no-dev
febca6b2f1 fix(p4): Update hosted and wifi_remote components 2025-06-23 12:11:32 +03:00
Me No Dev
29035dc689
Merge branch 'master' into release/v3.3.x 2025-06-22 21:04:01 +03:00
Sugar Glider
9d84c78cf2
feat(uart): fixes pin attach for any IDF 5.x (#11499)
* feat(uart): fixes pin attach for any IDF 5.x

* fix(uart): commentary typo error

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(uart): commentary typo error

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(uart): commentary typo error

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(uart): commentary style fix

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-22 21:02:36 +03:00
Me No Dev
bf55924b67
Merge branch 'master' into release/v3.3.x 2025-06-21 15:46:46 +03:00
Sugar Glider
01e4d5debb
feat(uart): fixes loopback function after IDF changes (#11492)
* feat(uart): fixes loopback function after IDF changes

IDF 5.4.1 has added a new function called uart_release_pin() that is called whenever new pins are set or when uart driver is deleted.

This has a side effect that causes RX pin to never work again with the loopback function. Other changes also have removed some GPIO setup that was necessary for the GPIO loopback mode work.

The PR forces a full RX Pin setup in order to make it work in GPIO Matrix with Loopback TX Signal

* feat(uart): adds missing include file

* feat(uart): removes not necessary part of the code

* fix(uart): commentaries style fix

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-21 15:45:26 +03:00
Sugar Glider
ccda9c5f84
feat(matter): Adds Matter Events callback plus example (#11465)
* feat(matter): Adds Matter Events callback and related example
2025-06-20 15:28:07 -03:00
Olaf
23c6abc1ac
Proper EDNS handling and cleaner NOERROR response in DNSSERVER (#11411)
* Proper EDNS handling and cleaner NOERROR response

* fix:  library.properties

reverting version number update - as it is done automatically

* ci(pre-commit): Apply automatic fixes

* Spelling Corrected  and minor clarification in comments

* Removing commented out code fragments

* ci(pre-commit): Apply automatic fixes

* fix(pr): Fix typo

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2025-06-20 12:52:21 +03:00
Me No Dev
05fbda2d6d
Merge branch 'master' into release/v3.3.x 2025-06-20 12:25:31 +03:00
Jason2866
016077e245
changes for updated esptool.py v5 (#11488) 2025-06-20 12:25:03 +03:00
Lucas Saavedra Vaz
02be6e8826
feat(esptool): Upgrade to esptool v5 (#11487) 2025-06-20 12:23:18 +03:00
Wulu
51f1367d57
fix(docs): correct code block indentation in core_compatibility.rst (#11471)
* fix(docs): correct code block indentation in core compatibility guide

* fix(docs): remove extra colon causing rendering error in core_compatibility.rst
2025-06-20 12:22:01 +03:00
Ludovic BOUÉ
f7889116b1
feat(openthread): Add RLOC16 in otPrintNetworkInformation() (#11480)
* feat(openthread): Add RLOC16 in otPrintNetworkInformation()
2025-06-18 14:55:11 -03:00
Jan Procházka
6d4886cd1f
feat(spi): Add return values to SPI begin (#11477) 2025-06-17 16:23:35 +03:00
is-qian
4bc5ffc88d
fix: Delete 8M flash option for xiao_esp32_s3_plus. (#11476) 2025-06-17 13:39:33 +03:00
Jan Procházka
7462b09bb4
feat(LEDC): Add Gamma Fade support and enhance auto channel/timer selection for multi-group (#11464)
* feat(ledc): Enhance LEDC auto channel/timer selection for multi-group support

* feat(ledc): Add Gamma Fade support

* fix(example): Update comments

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-16 14:44:11 +03:00
Sugar Glider
ef995b6564
feat(openthread): adds native api (#11474)
* feat(openthread): adds native api

* feat(openthread): adds source code to CMakeLists.txt

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-16 13:15:54 +03:00
SooDragon
228393708d
fix: Update Pin compatability (#11473)
fix: Update Pin compatability
2025-06-16 11:12:33 +03:00
Me No Dev
0f72681fa0
Merge branch 'master' into release/v3.3.x 2025-06-10 14:30:19 +03:00
Paula Scharf
422e52684b
fix(msc): remove weak function declaration of tud_msc_is_writable_cb (#11353)
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2025-06-10 14:29:27 +03:00
Me No Dev
aaeabb5b87
Merge branch 'master' into release/v3.3.x 2025-06-10 13:28:31 +03:00
whatsABetterNick
d71135e2ca
Fix(I2S example): make fix to the ESP32 I2S simple tone example (#10954)
* made some fix to the ESP32 I2S simple tone example

* edit the I2S - simple tone example

* edit the I2S - simple tone example

* some edit

* edit comment

* edit

* edit

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-10 13:27:47 +03:00
Lucas Saavedra Vaz
c21ef70a15
fix(release): Replace all assets with chinese mirrors (#11323)
* fix(release): Replace all assets with chinese mirrors

* feat(release): Add script to append "-cn" to versions

* docs(install): Add instructions for users in China
2025-06-10 13:09:27 +03:00
Jan Procházka
cbdaee6f52
feat(ledc): Improve timer management with frequency/resolution matching (#11452)
* feat(ledc): Improve timer management with frequency/resolution matching

* fix(ci): Fix uninitialized timer variable warning

* Update cores/esp32/esp32-hal-ledc.c

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-10 12:57:07 +03:00
Niki Waibel
d6a76da0a5
fix(libraries/asyncudp): IPv4 ONLY listenMulticast() (#11444)
AsyncUDP::listenMulticast() properly receives packets sent to IPv4
multicast addresses like 239.1.2.3, but it is not receiving packets sent
to IPv6 multicast addresses like ff12::6ood:cafe.

The root cause is a bit hidden: listen(NULL, port) would match
AsyncUDP::listen(const ip_addr_t *addr, uint16_t port), which calls
_udp_bind(_pcb, addr, port), which uses the lwIP API to call
udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) at
the end. If lwIP has LWIP_IPV4 enabled, it checks if ipaddr == NULL and
sets it to IP4_ADDR_ANY. So an IPv6 address is never bound.

This fix checks the IP address passed to AsyncUDP::listenMulticast(). If
it is an IPv6 address, it constructs and passes the IPv6 any address
(::); otherwise (IPv4), it constructs and passes the IPv4 any address
(0.0.0.0).
2025-06-10 11:55:43 +03:00
Jan Procházka
0aada091e1
feat(zigbee): Support min/max setting for Analog EP (#11451)
* feat(zigbee): Support min max for Analog EP

* feat(zigbee): Use cfloat FLT_MAX

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-10 11:31:17 +03:00
Lucas Saavedra Vaz
89ff465328
feat(esptool): Upgrade to esptool v5 (#11433)
* feat(esptool): Upgrade to esptool v5

* fix(script): Update script for better handling of esptool

* fix(script): Get proper download url

* fix(script): Apply copilot suggestions
2025-06-10 11:19:32 +03:00
Me No Dev
0007815a11
feat(p4): Add 32MB Flash Partitions to ESP32-P4 (#11453)
* feat(p4): Add 32MB Flash Partitions to ESP32-P4

* feat(p4): Add 32MB flash size option

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2025-06-10 11:00:20 +03:00
Jan Procházka
af47bd3008
fix(ci): Process only needed files in publish sizes (#11439) 2025-06-10 10:59:56 +03:00
i3water
ee347baa7d
feat(boards): update wifiduinov2&wifiduino32s3 boards setting (#11440)
* update wifiduinov2&wifiduino32s3 boards setting

* fix wifiduinov2&wifiduino32s3 build board error.

* fix wifiduinov2(esp32c3) board setting

* fix wifiduinov2(esp32c3) cdc on boot default setting.

* fix wifiduino32s3 spi pin set

* change wifiduino32s3 spi pin to spi1

* remove 32Mb flash size

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-10 10:29:46 +03:00
Jason2866
610d951f9d
include "esp_bt.h" only when existing (#11438) 2025-06-10 10:29:29 +03:00
SooD
1bac8de384
fix: Updated the tools options for Geekble Mini (#11437)
fix: Updated the tools options for Geekble Mini
2025-06-10 10:29:11 +03:00
Me No Dev
e9813c6a52
Merge branch 'master' into release/v3.3.x 2025-06-04 19:12:52 +03:00
SooD
31d22e6ed0
fix: change geekble nano board setting (#11432)
add PSRAM Setting
2025-06-04 18:49:09 +03:00
Jan Procházka
0ab9a0fe6f
feat(zigbee): Update to esp-zigbee-sdk 1.6.5 and fix ci.json files (#11436)
* feat(zigbee): Update esp-zigbee-sdk and fix ci.json files

* fix(ci): Check if LED_BUILTIN exist

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-04 18:48:48 +03:00
Jan Procházka
e3018b6719
feat(zigbee): Add method to set/get/report analog output (#11431)
* feat(zigbee): Add methot to set,get,report analog output

* fix(ci): Update json file for example

* fix(zigbee): Add missing keywords

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-04 17:40:52 +03:00
Jan Procházka
cae66e65a3
feat(zigbee): Add endpoint identification in read handlers + command structures fix (#11425)
* feat(zigbee): Add endpoint identification in read handlers

* fix(zigbee): initialize Zigbee command structures with zeros

* fix(zigbee): Spelling correction

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-04 17:40:28 +03:00
Jason2866
375f2c002d
C2: Disable network provisioning (#11423) 2025-06-04 17:40:12 +03:00
Jason2866
460b89201b
make BT core code execution conditional from include esp_bt.h (#11413)
* make code execution conditional from include esp_bt.h.h

* only one if

* Update esp32-hal-bt.c
2025-06-04 17:39:54 +03:00
Me No Dev
a2880a4c17
feat(ap): Add support for DHCP Captive Portal (opt 114) (#11412)
* feat(ap): Add support for DHCP Captive Portal (opt 114)

* feat(ap): No need to guard the function

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-06-04 17:39:34 +03:00
Kevin Sidwar
b5c5655cf0
Support HTTP 204 (#11408)
HTTP 204 is a successful return code which indicates No Content. While it's appropriate to return a 304 if the server has content for a device but it hasn't change, it is more accurate for a server to return a 204 if it simply doesn't have any firmware files for a particular device.

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2025-06-04 17:39:19 +03:00
Lucas Saavedra Vaz
6f56df2a09
feat(codeowners): Initial CODEOWNERS setup (#11397)
* feat(codeowners): Initial CODEOWNERS setup

* fix(comment): Improve comment

* fix(codeowners): Add teams

* fix(codeowners): Apply suggestions

* fix(codeowners): Add missing libraries
2025-06-04 16:19:44 +03:00
me-no-dev
a6bba43d32 fix(c5): Enable components for ESP32-C5 2025-05-30 19:12:34 +03:00
Me No Dev
6ce7e254c4
IDF release/v5.5 (#11369)
* IDF release/v5.5 719b1b2b

* fix(build): Add dependency on esp_http_client

* fix(build): Add dependency on esp_https_ota

* IDF release/v5.5 28ac0243
2025-05-30 17:18:32 +03:00
Me No Dev
b7698461ac
Merge branch 'master' into release/v3.3.x 2025-05-30 15:54:01 +03:00
Me No Dev
f3ae2a65e2
IDF release/v5.4 (#11406)
* fix(build): Update APB frequency set routine

* IDF release/v5.4 aed8bdc8
2025-05-30 15:18:57 +03:00
Me No Dev
72a582b908
feat(ssl): Do not check if client is connected if already disconnected (#11356) 2025-05-27 16:51:23 +03:00
Me No Dev
15038e64b3
Merge branch 'master' into release/v3.3.x 2025-05-27 13:34:03 +02:00
Jan Procházka
91fd517cf1
feat(zigbee): Check the type of leave signal (#11385)
* feat(zigbee): Check the type of leave signal

* Update libraries/Zigbee/src/ZigbeeCore.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update libraries/Zigbee/src/ZigbeeCore.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2025-05-27 14:33:30 +03:00
Thomas J.
31bfcb27ce
add board yb_esp32s3_drv (#11388) 2025-05-27 14:16:37 +03:00
Lucas Saavedra Vaz
fa275971cd
Update gen_esp32part.py (#11391)
* Update gen_esp32part.py

* change(tools): Push generated binaries to PR

* fix(formatting): Apply formatter

* change(tools): Push generated binaries to PR

* fix(gen_esp32part): Remove unnecessary generator

* change(tools): Push generated binaries to PR

* fix flake8 (#11393)

---------

Co-authored-by: Jason2866 <24528715+Jason2866@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-05-27 14:16:13 +03:00
Jacob Williams
d960f61e0a
fix(board): Alfredo-NoU3 changed default upload mode from Hardware CDC and JTAG to USB-OTG (#11403)
* fix(board): Alfredo-NoU3 changed default upload mode from Hardware CDC and JTAG to USB-OTG

* feat(board): Add Alfredo NoU2

* Revert "feat(board): Add Alfredo NoU2"

This reverts commit 35ba26acd9da17477f3ee14a1e3f63fd11df5f8d.
2025-05-27 14:15:54 +03:00
Jan Procházka
7bafc1b19b
feat(zigbee): Add AC DC ElectricalMeasurement support (#11384)
* feat(zigbee): Add AC DC ElectricalMeasurement support

* ci(pre-commit): Apply automatic fixes

* ci(): fix precommit codespell

* ci(pre-commit): Add spaces between numbers and units

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2025-05-27 14:10:18 +03:00
Jan Procházka
6c3528ac69
feat(zigbee): Add support for Binary input EP + Analog EP extension (#11339)
* feat(zigbee): Add binary input and analog extension

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* feat(zigbee): Remove setBinaryInputReporting

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2025-05-27 13:41:38 +03:00
Vlastimil Hajek
07d662a7fc
fix: crash on watchdog timeout on iddle task (#11376) 2025-05-27 13:15:41 +03:00
Jan Procházka
542274d5ea
feat(zigbee): Remove static variables, improve binding, new example (#11316)
* feat(zigbee): Remove static variables, improve binding, new example

* feat(example): Add missing header

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-05-27 13:13:47 +03:00
Ludovic BOUÉ
9090b46da5
feat(esp32): Zigbee power outlet example (#11296)
* feat(esp32): Zigbee power outlet example

Zigbee power outlet example

* feat(esp32): Zigbee power outlet example

Change username

* feat(esp32): Zigbee power outlet example

Remove old comment

* fix(zigbee): fix power outlet compile errors and update example

* fix(example): Update readme

* fix(example): Update ci json file

* ci(pre-commit): Apply automatic fixes

* fix(): precommit codespell

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-05-27 13:13:28 +03:00
qhddz
d85b75c219
add dfrobot lorawan esp32s3 board (#11362)
* add dfrobot_lorawan_esp32s3 board

* Update pins_arduino.h

* Update pins_arduino.h

remove duplicate macro definitions

* Update pins_arduino.h

* update board.txt

* add other menu items

* delete OPI Flash

* Update pins_arduino.h

* Update pins_arduino.h
2025-05-22 18:31:31 +02:00
me-no-dev
3f63a4929f fix(build): Add dependency on esp_http_client 2025-05-19 13:54:12 +02:00
Jan Procházka
13cd0d3c3f
fix(rainmaker): Fix the 8MB partition scheme (#11363) 2025-05-15 11:14:58 +02:00
me-no-dev
5540afa1ea feat(ci): Run push CI against IDF v5.5 2025-05-15 11:13:32 +02:00
Me No Dev
d69ad5e747
Merge branch 'master' into release/v3.3.x 2025-05-15 11:10:58 +02:00
Me No Dev
69cd5a0a66
IDF master 7cf5dacd (#11358) 2025-05-15 11:10:00 +02:00
Me No Dev
8d5a026c98
IDF release/v5.4 (#11357)
* IDF release/v5.4 8ad0d3d8

* IDF release/v5.4 fd37cd46

* IDF release/v5.4 fe753553
2025-05-15 10:56:48 +02:00
Jason2866
bc08c49579
Update version for wifi remote (#11344) 2025-05-13 12:25:39 +02:00
Me No Dev
a83bb93b6d
Merge branch 'master' into release/v3.3.x 2025-05-13 11:49:03 +02:00
Me No Dev
6f92b604f6
IDF release/v5.4 (#11212)
* fix(i2c): update i2c_ll_slave_init for IDF 5.4

* IDF release/v5.4 8ad0d3d8
2025-05-13 11:46:58 +02:00
Unexpected Maker
210edfeaa6
Added new Unexpected Maker SQUiXL and EDGES3[D] boards. (#11350)
* Added new Unexpected Maker SQUiXL and EDGES3[D] boards.

Signed-off-by: Seon Rozenblum <seonr@3sprockets.com>

* Seems we are being picky about board names now ;)

Signed-off-by: Seon Rozenblum <seonr@3sprockets.com>

* Seems I have to have SPI pins defined for SQUiXL, or compiling breaks

Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>

---------

Signed-off-by: Seon Rozenblum <seonr@3sprockets.com>
Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>
2025-05-13 11:46:15 +02:00
Me No Dev
602f1f6e7f
IDF master (#11342)
* fix(ci): ESP32-P4 hosted compile fail (#11341)

* fix(ci): Update changes for P4 and C5 builds with latest IDF

* IDF master aaebc374

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Jason2866 <24528715+Jason2866@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-05-07 16:24:33 +03:00
Stian Coward
15e71a6afd
fix(esp32): Add missing vflip status in esp32-cam example (#11335)
Toggle switch for V-Flip will now indicate correct status in frontend when loading the webpage
2025-05-07 11:50:32 +03:00
Limor "Ladyada" Fried
158c7aec42
Add new board: Sparkle Motion Stick (#11330)
* add new version of sparklemotion

* updated change as requested

* fix

* fix clang complaints
2025-05-07 11:03:54 +03:00
Me No Dev
b115acea40
IDF master (#11289)
* fix(libs): Ensure compilation with ESP32-C5

* fix(i2c): Update I2C Slave init call

* IDF master 465b159c

* ci(simple_ble): Add check for BLE supported

* IDF master 38628f98

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2025-05-01 02:15:03 +03:00
Me No Dev
c9efce6342
Merge branch 'master' into release/v3.3.x 2025-04-29 10:55:47 +03:00
Lucas Saavedra Vaz
543fad2bdf
fix(spi): Add missing initializer for ss_invert (#11320)
* fix(spi): Add missing initializer for ss_invert

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-04-29 10:49:23 +03:00
Lucas Saavedra Vaz
de72a03ca5
docs(mirror): Add Chinese mirror links (#11317) 2025-04-29 10:46:44 +03:00
Sugar Glider
d63b876f93
feat(uart): simplifies UART example based on MODBUS standard (#11309)
* feat(uart): simplifies UART example based on MODBUS standard

* fix(uart): fixes a uart example typo

* feat(uart): replaces UART0 by Serial0 in the code

* ci(pre-commit): Apply automatic fixes

* fix(uart): typo error message in commentary

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-04-29 08:58:10 +03:00
Luca Burelli
16fcdeb0be
fix(arduino): restore proper pin remapping functionality (#11315)
Commit 0773dd7619 from PR #10841 broke pin
remapping by moving its application too early in the definition process.
This commit restores the original order of includes, ensuring that pin
remapping is applied correctly.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Co-authored-by: Sugar Glider <rodrigo.garcia@espressif.com>
2025-04-29 08:57:51 +03:00
UltimumControl
b461e01e22
New SPI invert hardware SS function in hall-spi and SPI library (#11297)
* Add files via upload

* Add files via upload

* Update SPI.h

* Update esp32-hal-spi.c

renamed invert_out to ss_invert to be more intuitive

* Update esp32-hal-spi.h

Removed the out from the function name spiSSInvertout.

* Update SPI.cpp

Removed the out from the function name spiSSInvertout.

* Update cores/esp32/esp32-hal-spi.c

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-04-28 20:45:31 +03:00
microbots
9193c9db1e
Update boards.txt with updated CodeCell board variant (#11313)
* Update boards.txt

* Update boards.txt

* Update boards.txt

* Update boards.txt

---------

Co-authored-by: Carl Bugeja <carlb20@gmail.com>
2025-04-28 20:27:17 +03:00
Sugar Glider
8d121e075f
feat(rmt): fixes example to run correctly within IDF 5.x (#11292)
* feat(rmt): fixes exaple to run correctly within IDF 5.x

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-04-28 18:46:12 +03:00
Lewis He
5df9b64023
Update LilyGo T-Watch-S3-Ultra and T-LoRa-Pager variants (#11299)
* Update LilyGo variants

* Update T-Watch-S3-Ultra variants

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-04-28 18:45:54 +03:00
Lucas Saavedra Vaz
8ed97f6fa8
ci(release): Add package JSON with chinese mirrors (#11288)
* ci(release): Add package JSON with chinese mirrors

* fix(comment): Fix comment with proper description
2025-04-28 18:45:31 +03:00
Lucas Saavedra Vaz
5262f5ad5e
ci(idf): Use included IDF examples in CI (#11240)
* ci(idf): Use included IDF examples in CI

* fix(example): sets Matter version to be 1.3 or higher

* feat(matter): sets c++ 2a as default

* feat(matter): Update README.md

* fix(matter): instructions about using more than one sdkconfig file

---------

Co-authored-by: Sugar Glider <rodrigo.garcia@espressif.com>
2025-04-28 18:45:12 +03:00
Me No Dev
23f3600a4b
Merge branch 'master' into release/v3.3.x 2025-04-23 20:20:51 +03:00
Sugar Glider
571c2f74f2
feat(uart): sets correct ESP32/S2 clock source for the example (#11286)
* feat(uart): sets correct ESP32/S2 clock source for the example

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-04-23 20:20:23 +03:00
Sugar Glider
51023aea79
feat(ledc): clear all fields added to ledc struct in IDF 5.4 (#11276)
* feat(ledc): clear all fields added to ledc struct in IDF 5.4

* feat(ledc): use memset for all ledc struct

* fix(ledc): typo - missing semi collon

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-04-23 20:20:05 +03:00
Me No Dev
03e9c45084
IDF master (#11204)
* fix(esp-now): Update TX Callback

* IDF master d930a386

---------

Co-authored-by: Jason2866 <24528715+Jason2866@users.noreply.github.com>
2025-04-23 15:50:58 +03:00
Me No Dev
5d0c4b3507
Merge branch 'master' into release/v3.3.x 2025-04-22 11:47:28 +03:00
Lucas Saavedra Vaz
c110ca8295
docs(language): Enforce English on contributions and issues (#11267) 2025-04-22 11:46:59 +03:00
Lucas Saavedra Vaz
a8bead7efb
fix(gpio): Fix GPIO warning message (#11268) 2025-04-22 09:16:46 +03:00
Lucas Saavedra Vaz
e0d4d176ea
ci(pre-commit): Lock versions to SHA and apply fixes (#11248)
* ci(pre-commit): Execute codespell after formatting changes

* ci(pre-commit): Lock versions to hash

* fix(pre-commit): Apply pre-commit fixes
2025-04-22 09:16:32 +03:00
Jason2866
42ae2426af
fix C5 compile (#11255) 2025-04-21 19:32:51 +03:00
Lucas Saavedra Vaz
ae2ae8dfa0
Merge branch 'master' into release/v3.3.x 2025-04-14 14:28:03 -03:00
Me No Dev
f1223663dd
fix(wifi): Workaround bug in esp_wifi_get_protocol() (#11239)
* fix(wifi): Workaround bug in esp_wifi_get_protocol()

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-04-14 13:54:47 +03:00
Jason2866
9cad83bacf
check for CONFIG_BT_BLUEDROID_ENABLED in esp32-hal-misc.c (#11234)
* check for `CONFIG_BT_BLUEDROID_ENABLED` in esp32-hal-misc.c

* overseen changes to `CONFIG_BT_BLUEDROID_ENABLED`
2025-04-14 12:13:55 +03:00
Mathieu Carbou
60c8206ee6
feat(logging): Arduino log redirection (#11159)
* feat(logging): Arduino log redirection

* fix(uart): log will only use ets_printf() for uart and cdc

* feat(uart_cdc): when CDC is logging, UART is silent

* feat(uart_cdc): when CDC is logging, UART is silent

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Sugar Glider <rodrigo.garcia@espressif.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-04-14 12:08:33 +03:00
Sugar Glider
3fcc316d3c
fix(usb_hid): duplicated CONSUMER_CONTROL_PLAY_PAUSE (#11242) 2025-04-14 11:24:30 +03:00
Sugar Glider
bd4b32522c
feat(usb): add a few more consumer control HID commands (#11227) 2025-04-09 11:57:12 +03:00
Sugar Glider
be57376b6b
fix(usb): uninitilized variable warning message (#11222) 2025-04-09 11:56:52 +03:00
Sugar Glider
2647cbbbc2
refactor(rmt): refactored RMT loopback example (#11221)
* feat(rmt): refactored RMT loopback example

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-04-09 11:56:32 +03:00
Jason2866
8e8b1cbd31
Use CONFIG_BT_BLUEDROID_ENABLED for enabling (#11214)
Co-authored-by: Sugar Glider <rodrigo.garcia@espressif.com>
2025-04-09 11:26:13 +03:00
Jan Procházka
d3509ef98b
feat(zigbee): Add battery voltage attribute support (#11210)
* feat(zigbee): Add battery voltage attribute support

* Update libraries/Zigbee/src/ZigbeeEP.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update libraries/Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy/Zigbee_Temp_Hum_Sensor_Sleepy.ino

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-04-09 11:25:58 +03:00
Jacob Williams
7f60945018
fix(board): Alfredo NoU3 pins_arduino.h uses uint8_t but it causes error with esp32-hal-gpio.h (#11206)
* fix(board): Alfredo NoU3 include stdint.h

* fix(hal_gpio): lets pins_arduino.h to use stdint and stdbool types

* feat(pins_arduino): fixes lack of stdint in the right place

* fix(pins_arduino): reverts all changes to this file

* fix(pins_arduino): reverts all changes to this file

* fix(pins_arduino): reverts all changes back to original pr

---------

Co-authored-by: Sugar Glider <rodrigo.garcia@espressif.com>
2025-04-09 11:25:39 +03:00
Gonzalo Brusco
0cc8eab836
Add an option to force IDF's default UART clock source (#11191)
* Add an option to force IDF's default UART clock source

* feat(uart): adds function to set clock source

* feat(uart): add uart clock source selection method

* feat(uart): add uart hall function to set the uart clock source

* feat(uart): add function to set the uart clock source

* feat(uart): set clock source as necessary

* fix(uart): missing class qualifier declaration

* fix(uart): fixing a typo and non LP UART SoC clk src setting

* fix(uart): variable name, typo error

* fix(uart): retores previous identation reducing diff load

* feat(uart): apply CONFIG_ARDUINO_SERIAL_FORCE_IDF_DEFAULT_CLOCK_SOURCE to LP UART

* feat(uart): adds option for UART_CLK_SRC_DEFAULT

* feat(uart): adds option for setting default uart clock source from IDF

* feat(uart): documents UART_CLK_SRC_DEFAULT as option in header file

* feat(uart): documents using the IDF default uart clock source

* fix(uart): type missmatch may cause error

* fix(uart): type missmatch may cause error, test for -1

* feat(uart): considering both HP and LP default uart clock source

* feat(uart): improve the defined value for UART_CLK_SRC_DEFAULT

* fix(uart): using uart_sclk_t as hal level parameter

* feat(uart): apply default LP uart clock source

* fix(uart): considers that it may set the LP UART as well

* feat(uart): using UART SCLK enum for uart clock source values

* fix(uart): using UART_CLK_SRC_RTC now

* fix(uart): documentation using UART_CLK_SRC_RTC now

* fix(uart): fix old commentary that is not correct anymore

* fix(uart): wrong identation in code line

* fix(uart): using uart number as argument instead

* fix(uart): using uart number as argument in setClockSource()

* fix(uart): using uart number as parameter in uartSetClockSource()

* feat(uart): update Kconfig.projbuild to reflect functionality

* feat(uart): removing Kconfig.projbuild option to force default clk src

* feat(uart): removes kconfig option to force uart default clk src

* fix(uart): replacing #if #endif by #if #elif #endif for the same enum

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Sugar Glider <rodrigo.garcia@espressif.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-04-09 11:25:06 +03:00
Sugar Glider
b333bf2697
fix(zigbeeEP): review of names and memory allocation (#11199)
* fix(zigbeeEP): review of names and memory allocation

* fix(zigbeeEP): destructor shall free any allocated memory

* fix(zigbee_ep): forgotten var name change

* feat(zigbee_ep): use static heap memory for manufacturer and model names

* feat(zigbee_ep): changed model and manufacturer to heap

* feat(zigbee_ep): use static heap memory allocation

* fix(zigbee_ep): using stack only for adding attribute

* feat(zigbee_ep): reverting back read data type

* fix(zigbee_ep): rooling back to use malloc for remote attr reading

* feat(zigbee_ep): check malloc return for null

* fix(zigbee_ep): replace nullptr by NULL after C malloc()

* ci(pre-commit): Apply automatic fixes

* fix(zigbee_ep): fix variable scope

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(zigbee_ep): fix variable scope

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-04-05 18:47:38 +03:00
Jan Procházka
23ded939ea
feat(zigbee): Add PM2.5 endpoint support (#11205)
* feat(zigbee): Add PM2.5 endpoint support

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-04-05 18:46:20 +03:00
Sugar Glider
22f07d01c8
fix(rmt): memset all config structs to zero before using (#11203)
* fix(rmt): memset all config structs to zero to increase code safety
2025-04-01 09:36:19 -03:00
Lewis He
7b0298b462
Modify T-LoRa-Pager device PID (#11194)
Co-authored-by: Sugar Glider <rodrigo.garcia@espressif.com>
2025-03-31 11:06:18 +03:00
Me No Dev
998bf80248
Merge branch 'master' into release/v3.3.x 2025-03-29 23:48:18 +02:00
Me No Dev
fbca62fd68
Update Issue-report.yml with the latest versions 2025-03-29 14:13:57 +02:00
Me No Dev
a61961d5c9
IDF master (#11150)
* IDF master ee77c489

* IDF master ee77c489

* IDF master 50be9735

* IDF master 23c73cdc

* IDF master a45d713b
2025-03-28 10:48:39 +02:00
Me No Dev
dac2dd907d
Merge branch 'master' into release/v3.3.x 2025-03-28 10:48:05 +02:00
Lewis He
de184bd0cb
Update LilyGo variants and add new variants (#11192)
* Update LilyGo T-Watch-S3 definition and expansion options

* Update LilyGo T-Watch-Ultra definition and expand options

* Added variant LilyGo-T-LoRa-Pager

* Update partition table order

* Update LilyGo board partition table order

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-28 10:38:31 +02:00
Me No Dev
1014937965
IDF release/v5.4 (#11149)
* IDF release/v5.4 5cbd2a38

* fix(ci): Disable RainMaker examples on ESP32

* IDF release/v5.4 5cbd2a38

* IDF release/v5.4 2f7dcd86
2025-03-28 10:37:48 +02:00
Jan Procházka
a3b6fe61ba
feat(zigbee): Add check, boolean returns, fix Analog, add optional reset on factoryReset (#11153)
* feat(zigbee): Add checks on setting attrs and commands

* feat(zigbee): Add error info in the logs

* fix(zigbee): Fix memory leak, print esp_zb_zcl_status_t error, remove analogValue from analog EP

* feat(example): Update factoryResetoption in sleepy example

* fix(zigbee): Add error checks to Illuminance EP

* fix(zigbee): Return false on first error hit

* fix(zigbee): Apply same formatting on all returns

* fix(zigbee): Add check when adding a OTA cluster

* fix(zigbee): release locks before returning

* fix(zigbee): use correct return in doorWindowHandle

* fix/zigbee): Add missing return in WindowCovering

* fix(zigbee): Added a note of future task

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-27 22:13:48 +02:00
SooDragon
bbaabb183a
fix: Geekble Nano board setup update (#11131)
* Geekble Nano board setup update

Geekble Nano board setup update

* fix: erase Comment Line

fix: erase Comment Line

* revert re-naming

revert re-naming
2025-03-27 14:52:32 +02:00
Me No Dev
d81c19534f
Merge branch 'master' into release/v3.3.x 2025-03-27 13:39:40 +02:00
Me No Dev
17258930e6
fix(wifi_scan): Fix some edge cases where WiFi Scan may fail (#11188) 2025-03-27 13:38:04 +02:00
MikaFromTheRoof
e37435c442
feat(zigbee): Add Illuminance sensor endpoint (#11171)
* Added Zigbee light sensor

* Add comment for macro

* Some last corrections

* refactor(zigbee): changed class name to ZigbeeIlluminanceSensor

* feat(zigbee): Illumanance sensor update

* fix(zigbee): Change name of macro to avoid possible conflict with esp-zigbee-sdk

* Update keywords.txt

* fix(zigbee): Add Illuminance to Cmake file

* fix(example): Update Illuminance example

* ci(pre-commit): Apply automatic fixes

* Update Zigbee_Illuminance_Sensor.ino

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-27 12:56:30 +02:00
FidelSch
86221479b7
fix: BLEAdvertising methods return error codes (#11154)
* fix: BLEAdvertising methods return error codes

Some methods returned void even if they could produce an error, in which case they failed silently. They now return the corresponding error code.

* fix: methods which could error out return bool

Changed from returning esp_error_t, in order to be more arduino compatible.

---------

Co-authored-by: Sugar Glider <rodrigo.garcia@espressif.com>
2025-03-27 12:35:19 +02:00
Sugar Glider
1ca9dab521
fix(arduino_pins): fixes Lolin-C3-Pico and C3-Mini RGB LED pin + C3-Pico SPI SCK pin definition (#11186)
* fix(arduino_pins): fixes RGB LED pin and SPI SCK pin definition

* fix(arduino_pins): lolin-c3-mini rgb led pin
2025-03-27 12:32:36 +02:00
Lucas Saavedra Vaz
caa597143c
ci(workflows): Lock actions to commits and improve readability (#11147)
* Revert "ci(actions): Replace changed-files (#11130)"

This reverts commit ba2ab1e4bb.

* ci(workflows): Lock actions to commits and improve readability
2025-03-27 12:31:31 +02:00
ShuishengPeng
98611d46dc
fix: Add 16M flash option for xiao_esp32_s3_plus (#11183)
* fix: xiao_esp32_s3_plus supports 16M flash, adds 16M flash and 16M partition table options

* fix: remove empty lines

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2025-03-27 12:29:57 +02:00
Me No Dev
df51bc3aa5
fix(eth): Set the ETH properties at the correct time (#11182)
* fix(eth): Set the ETH properties at the correct time

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-27 12:29:31 +02:00
Me No Dev
9dddc142fc
fix(net): Use network_event_handle_t for internal callbacks (#11179)
* fix(net): Use network_event_handle_t for internal callbacks

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-27 12:29:11 +02:00
Marcel
cd7f4218e7
Fix(esp32s3usbotg) stdbool dependency in pins_arduino.h (#11155)
* Fix(esp32s3usbotg) stdbool dependency in pins_arduino.h

* fix(board): Remove comment in pins_arduino.h

---------

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2025-03-24 15:26:49 +02:00
Sugar Glider
6273c4ffd8
fix(freertos_stats): remove volatile c++ 20 deprecated warning (#11158) 2025-03-24 14:59:42 +02:00
Lucas Saavedra Vaz
cc2632b3bb
fix(ext_lib): Fix ESPAsyncWebServer URL and examples (#11160) 2025-03-24 14:51:25 +02:00
Math0XK
6c04a93153
Add a Default 32MB partition (#11143)
* Add a Default 32MB partition

This is a complementary addition to use 32MB boards in PlatformIO like the ESP32-S3-DevKitC-1-N32R8V.

* Edited Board file

Added partition "default_32MB" to the menu

* Delete tools/boards.txt

* Edited boards.txt

Added the "default_32MB" partition to the menu

* feat(boards): adds app13M_data7M_32MB to s3 octal

* fix(board): format linux new line

* fix(boards): trying to make it \n and not \r\n

* add change to esp32s3-octal board too

This reverts commit 3afddfc2ce5281d8cd0344bc91665665d4179040, reversing
changes made to a9f64003bad5a2dcc1bd7f66e8494c9f8c8dd2e2.

* fix(boards): setting eol as /n

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Sugar Glider <rodrigo.garcia@espressif.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-20 22:11:11 +02:00
TANAKA Masayuki
7fda434d89
fix(rmt): Fixed protocol name in RMTReadXJT examples (#11136)
* fix(rmt): Fixed protocol name in RMTReadXJT examples

I couldn't find a protocol called D12.
I found LR12 so I'll fix that.

* feat(RMT): changing example commentary to reflect D16 protocol

---------

Co-authored-by: Sugar Glider <rodrigo.garcia@espressif.com>
2025-03-20 21:52:36 +02:00
Me No Dev
7c1ac1ae60 feat(wifi): Add support for 2.4GHz and 5GHz band switching (#11045)
* feat(wifi): Add support for 2.4GHz and 5GHz band switching

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-20 02:10:20 +02:00
Jason2866
d66eeb7754 c5 flash base address is 0x2000 (#11037)
* c5 flash base address is 0x2000

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-20 02:10:20 +02:00
Me No Dev
3fe2fe5311 IDF master 0461e2ff (#11018) 2025-03-20 02:10:20 +02:00
Me No Dev
e30e3c30f1 IDF master (#10999)
* IDF master c71d74e2

* IDF master 81e8b752

* IDF master 877057db
2025-03-20 02:10:20 +02:00
Me No Dev
042015efc8 IDF master (#10981)
* IDF master 1160a86b

* fix(ci): Do not compile RainMaker examples on ESP32
2025-03-20 02:10:20 +02:00
Me No Dev
6283c15ae2 IDF master (#10887)
* feat(ci): Run sketches on ESP32-C5

* IDF master 1160a86b

* fix(zigbee): Remove RCP mode from ESP32-C5
2025-03-20 02:10:20 +02:00
me-no-dev
75de09ef29 fix(board): Update ESP32-C5 Dev Kit Pinout 2025-03-20 02:09:27 +02:00
me-no-dev
f45cd7bf33 fix(psram): Add support for ESP32-C5 PSRAM 2025-03-20 02:09:27 +02:00
Jan Procházka
9fbcb345b7 fix(c5): Update PIN_RGB_LED in pins_arduino.h 2025-03-20 02:09:27 +02:00
me-no-dev
8af81cdf09 fix(ci): Fix/stop some examples for C5 2025-03-20 02:09:27 +02:00
Jason2866
d9d3bf48d3 add c5 bootloader location to pioarduino script (#10889)
* add c5 bootloader location to pioarduino script

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-20 02:09:27 +02:00
Jan Procházka
100ed8e895 fix(c5): Update debug log in setCpuFrequencyMhz 2025-03-20 02:09:27 +02:00
me-no-dev
0894d7db68 fix(report): Add missing chip names 2025-03-20 02:09:27 +02:00
me-no-dev
af5abd5f61 fix(c5): Update bootloader location 2025-03-20 02:09:27 +02:00
me-no-dev
bf90cbd183 fix(examples): Add changes required to some examples 2025-03-20 02:09:27 +02:00
me-no-dev
88cda9ff59 feat(idf): Add initial support for IDF v5.5 and ESP32-C5 2025-03-20 02:09:27 +02:00
Lucas Saavedra Vaz
66abd86ce9
fix(camera_webserver): Fix typo in OV2640 definition (#11145) 2025-03-20 02:06:20 +02:00
Sugar Glider
18709faa90
fix(uart): uart rx timeout validation with proper log message (#11141)
* feat(uart): adds a function to calculate maximum valid rx timeout

* fix(uart): check uart rx timeout value and log an error msg

* fix(uart): changes log message to a more clear one

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-20 02:02:20 +02:00
Jan Procházka
e2915c48e8
feat(zigbee): Save network channel after 1st joining for faster rejoin (#11123)
* feat(zigbee): Save network channel after 1st joining for faster rejoin

* ci(pre-commit): Apply automatic fixes

* feat(zigbee): Add channel mask reset after timeout

* feat(zigbee): Add the resetChannelMask to all Begin methods

* feaz(zigbee): Move function to private and add set method

* fix(example): Remove test from device mode name

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-19 14:08:56 +02:00
Sugar Glider
8e62997bfd
fix(UART): sets the correct uart clock source when using begin(baudrate) (#11122)
* fix(uart): uart begin does not set the clock source when baudrate changes

* fix(uart): returns success on baud rate change operation

* fix(code): uart typo - missing ( in the code

* fix(uart): replacing mutex lock to avoid double lock

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-17 17:36:44 +02:00
Sugar Glider
74ee9df48c
fix(uart): Fixes UART CI script to work with Arduino Core 3.2.x (#11077)
* fix(uart): ci uart test fail on esp32s2 after uart break

* fix(uart): ci error with change pins test on ESP32

* fix(uart): ci test with perimgr using esp32 fails

* feat(uart): avoid electrical noise before setting pins

* fix(uart_ci): fixes the UART CI sketch due to IDF 5.3 pull up change

* fix(uart_ci): keeping previous formatting and applying changes

* feat(uart_ci): trick for passing esp32 wokwi ci test

Wokwi ESP32 fails with the pinMode() in line 56|58
Real device with Arduino Core 3.1.2 and 3.2 needs it to fix the issue.
This patch will skip the pinMode() when compiling with Wokwi and make it pass the CI test case.

* feat(uart_ci): reverting the wokwi patch, once it didn't make any difference

* fix(wokwi): Change CPU freq to 80

* fix(wokwi): Change CPU freq to 120

* ci(pre-commit): Apply automatic fixes

* fix(uart_ci): fixes a couple typos in commentatries

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-17 17:36:10 +02:00
Lucas Saavedra Vaz
ba2ab1e4bb
ci(actions): Replace changed-files (#11130) 2025-03-17 15:20:30 +02:00
Lucas Saavedra Vaz
f7c1efccaa
docs(esp32p4): Add missing information and improve organization (#11081)
* docs(esp32p4): Add missing information and improve organization

* docs(datasheets): Add missing datasheets

* docs(readme): Reorder title

* docs(typos): Fix typos
2025-03-17 12:37:41 +02:00
Lucas Saavedra Vaz
2a3de9c415
test(i2c): Do not use delta as Wokwi timing can be inconsistent (#11080)
* test(i2c): Do not use delta as Wokwi timing can be inconsistent

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-13 12:02:43 +02:00
Lucas Saavedra Vaz
c2b0482511
ci(hw): Fix files being overwritten (#11019)
Co-authored-by: Sugar Glider <rodrigo.garcia@espressif.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2025-03-13 11:44:23 +02:00
Ludovic BOUÉ
07d6a5a0d2
feat(Zigbee): Adding Zigbee Wind speed sensor endpoint (#10455)
* Create ZigbeeWindSpeedSensor.h

* Create ZigbeeWindSpeedSensor.cpp

* Update ZigbeeWindSpeedSensor.cpp

* Update ZigbeeWindSpeedSensor.cpp

* Create ZigbeeWindSpeedSensor.ino

* Update ZigbeeWindSpeedSensor.ino

* Update ZigbeeWindSpeedSensor.ino

* Create ci.json

* Rename ZigbeeWindSpeedSensor.ino to Zigbee_Wind_Speed_Sensor.ino

* Rename ci.json to ci.json

* Update CMakeLists.txt

* Update Zigbee_Wind_Speed_Sensor.ino

* Update Zigbee_Wind_Speed_Sensor.ino

* Update Zigbee_Wind_Speed_Sensor.ino

* Update ZigbeeWindSpeedSensor.cpp

* Update ZigbeeWindSpeedSensor.cpp

Use ESP_ZB_HA_SIMPLE_SENSOR_DEVICE_ID device id

* feat(zigbee): Add windspeed sensor endpoint

* Update Zigbee.h

Add ZigbeeWindSpeedSensor.h

* update example

* add missing sdkconfig include

* add readme

* ci(pre-commit): Apply automatic fixes

* Update README.md

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-12 15:38:09 +02:00
Me No Dev
bda7c48117
IDF release/v5.4 d4aa25a3 (#11060)
IDF release/v5.4 d4aa25a3
2025-03-11 00:26:18 +02:00
Sugar Glider
e8a243c1db
fix(network): fixes a macro name conflict warning (#11068)
* fix(network): fixes a macro name conflict warning

* feat(networking): removed local maco definition in favor of IDF one
2025-03-10 22:18:12 +02:00
Sugar Glider
d9dbc4af41
fix(matter): examples must set pin to Digital Mode after analogWrite() and before digitalWrite() (#11070)
* fix(matter): itshall set digital mode before digitalWrite

* fix(matter): example must set pin in digital mode before writting

* fix(matter): example shall set digital mode before writing

* fix(matter): digitalMode necessary before digitalWrite(LOW)

* fix(matter): example must set digital mode after analogwrite

* fix(matter): wrong copy paste

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-10 22:00:34 +02:00
Sugar Glider
e680e7b538
fix(matter): removes a few matter 1.4 / IDF 5.4 compilation warning messages (#11067)
* fix(matter): uninitialized fields warning

* fix(matter): uninitialized fields warning
2025-03-10 21:21:25 +02:00
Jan Procházka
2276f0b794
fix(zigbee): Add manuf_code to report attribure commands (#11066) 2025-03-10 21:21:00 +02:00
Jan Procházka
665d6f8e8d
fix(zigbee): Use correct attributeID in setAnalogInputReporting (#11065) 2025-03-10 21:20:34 +02:00
Me No Dev
bf5265c7d8
feat(eth): Add setters for negotiation, speed and duplex modes (#11053)
* feat(eth): Add setters for negotiation, speed and duplex modes

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-10 21:20:07 +02:00
Me No Dev
eeb6a26ed1
fix(wifi): Disable properly LR mode if it was enabled before (#11052)
* fix(wifi): Disable properly LR mode if it was enabled before

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-03-10 21:19:46 +02:00
Me No Dev
8575d04ab5
fix(eth): Fix RMII Ethernet not being able to be restarted (#11048) 2025-03-10 21:19:22 +02:00
Oli
4677ea6ad8
Fix to issue #11044 (#11064)
Fix to a copy-paste error that causes a Guru Meditation crash with Zigbee Analog Example.
2025-03-10 13:53:43 +02:00
Sugar Glider
efb02d30ac
feat(gpio): allows mixing digital and analog read/write operations (#11016)
* feat(gpio): allows mixing digital and analog read/write operations

* fix(gpio): simple mistake in calling __pinMode() fnuction

* fix(gpio): simple mistake in calling __pinMode() fnuction

* feat(gpio): update the log message to tell the solution for the error.

* feat(gpio): warn user about digitalRead() used with non GPIO pin

* fix(gpio): wrong peripheral manager test case
2025-03-09 13:20:59 +02:00
Sugar Glider
fb5f11b638
feat(matter): necessary changes to insights version for esp_matter (#11042)
* feat(matter): necessary changes to insights version for esp_matter

* feat(rainmaker): update RainMaker version to 1.5.2
2025-03-08 00:00:58 +02:00
Lucas Saavedra Vaz
9e2f755641
test(i2c): Add test to scan bus (#11022)
* test(i2c): Add test to scan bus

* test(i2c): Add scan test with wifi running

* fix(i2c): Simplify test
2025-03-05 13:33:20 +02:00
iranl
684a9312e6
fix(bt): Compile error on ESP32-P4 (#11035)
* fix(bt): Fix compile error on ESP32-P4

* fix(bt): Fix compile error on ESP32-P4
2025-03-05 12:45:11 +02:00
oddlama
7575fa0ce8
fix(zigbee): use correct carbon dioxide cluster function in setTolerance (#11015)
* fix(zigbee): use correct carbon dioxide cluster function in setTolerance

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-26 11:50:28 +02:00
Lucas Saavedra Vaz
e3bcc58672
ci(esp32p4): Add missing options for P4 (#11014)
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2025-02-26 11:49:42 +02:00
Jan Procházka
923da957e4
feat(zigbee): Add ZigbeeGateway endpoint support + Time Cluster bugfix (#11009)
* fix(zigbee): Remove the need of native ieee802154 radio

* feat(zigbee): Add ZigbeeGateway endpoint support

* fix(zigbee): Fix TimeCluster missing status attribute

* feat(zigbee): Add new src to CMakeLists

* feaz(zigbee): Update keywords.txt with latest updates

* feat(zigbee): Add 8MB Zigbee ZCZR partitions to other socs

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2025-02-26 11:49:24 +02:00
Lucas Saavedra Vaz
7485c653bb
ci(zigbee): Check if Zigbee is enabled for CI tests (#11012)
* ci(zigbee): Check if Zigbee is enabled for CI tests

* ci(zigbee): Fix requirements

* fix(zigbee): Use LED_BUILTIN for range extender

* fix(zigbee): Use default GPIO if LED_BUILTINnot defined
2025-02-25 18:00:39 +02:00
Gonzalo Brusco
09d89c6da1
Fix HardwareSerial config (#11007) 2025-02-25 17:58:10 +02:00
oddlama
1467d87454
fix(zigbee): use correct pressure cluster function in setTolerance (#11008)
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2025-02-25 10:17:17 +02:00
Hoan Pham
c76c2eab37
Update of Boards.txt & variants - Adding CYObot board - 3rd party board (#10947)
* Adding CYObot board - 3rd party board

1. Adding Pin Header file for CYObot to variants folder
2. Add CYObot config to boards.txt

* feat(cyobot): adding cyobot_v2_esp32s3 board

Change comments in pin header file for cyobot board

* fix(cyobot_v2_esp32s3): fix variant name

fix variant name for cyobot board

* fix(boards.txt): fix name of CYOBot board

- Change name to uppercase

* fix(CYOBot): fix boards.txt & pin_arduino.h

* fix(pins_arduino.h): capitalize name

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-25 10:13:35 +02:00
Me No Dev
b33470e44b
IDF release/v5.4 (#10998)
* IDF release/v5.4 bcb3c32d

* fix(zigbee): Remove the need of native ieee802154 radio

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2025-02-25 10:13:10 +02:00
SooDragon
0c18b17ac4
feat(boards): Add Geekble-nano-ESP32S3 (#11005)
* add new board

add new board

* fix(board): add LED_BUILTIN #define

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2025-02-25 10:07:12 +02:00
Eric Lewis
164fcc6a61
fix(board): Update feathers3 wire1 pin definition (#11001)
* update feathers3 wire1 pin definition

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2025-02-25 10:06:54 +02:00
Lucas Saavedra Vaz
39be694127
ci(runners): Bump runner images version (#10960)
* ci(runners): Bump runner images version

* ci(arm): Use github arm images
2025-02-25 10:06:18 +02:00
Lucas Saavedra Vaz
988dbe2973
ci(test): Skip some PSRAM tests in P4 2025-02-22 01:27:17 -03:00
Lucas Saavedra Vaz
42bd7456ce
ci(test): Fix GPIO test 2025-02-21 23:54:52 -03:00
Lucas Saavedra Vaz
543a647f2c
ci(test): Fix PSRAM test 2025-02-21 23:47:01 -03:00
SooDragon
003db9e4c0
Update pins_arduino.h (#11000) 2025-02-21 12:27:11 +02:00
pwclay
9a783a5d2c
feat(zigbee): Add Analog endpoint device (input, output, value clusters) (#10950)
* add analog sensor modules

* feat(zigbee): Add analog value, input and output support

* fix(zigbee): add missing functiong to header file

* fix(zigbee): Update log messages

* ci(pre-commit): Apply automatic fixes

* fix(example): Fix comment typo

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-20 10:59:43 +02:00
Lucas Saavedra Vaz
cd95e4055b
ci(report): Add runtime tests report (#10764) 2025-02-20 00:52:01 +02:00
Lucas Saavedra Vaz
978b441cd4
test(wokwi): Add I2C Master test and enable GPIO and PSRAM tests (#10848)
* test(wokwi): Enable PSRAM test

* fix(tests): Add missing diagram for ESP32-P4

* test(wokwi): Enable GPIO test

* test(wokwi): Add I2C master test

* fix(tests): Add missing requirement and improve logging

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-19 23:32:06 +02:00
Jan Procházka
eec2af3d35
feat(zigbee): Add range extender device endpoint (#10970)
* feat(zigbee): Add range extender device endpoint

* ci(pre-commit): Apply automatic fixes

* fix(example): Fix typo catched by precommit

---------

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-19 23:31:37 +02:00
Rodrigo Garcia
5afafdf4c6
fix(matter): commentaries and messages related to factory reset (#10988)
* fix(matter): commentaries and messages related to the factory reset

* fix(matter): commentaries and messages typo
2025-02-19 23:31:08 +02:00
Rodrigo Garcia
646785e086
feat(LP_UART): Implements the ESP32-C6/ESP32-P4 Low Power UART as a possible HardwareSerial port (#10967)
* feat(uart): adds low power uart peripheral into hardware serial class

* feat(lp_uart): pin setting for lp uart plus esp32p4 fixes

* fix(uart): keeps the test as it was before.

* fix(uart): updates the copyright year reference

* fix(uart): updates the copyright year reference

* feat(lp_uart): supports any number of lp uart port for the future

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-19 01:01:18 +02:00
me-no-dev
55f4f1bfa8 Update core version to 3.2.0 2025-02-18 19:10:54 +02:00
Me No Dev
8e9f7c31c9
IDF release/v5.4 e37d33cc (#10980) 2025-02-18 17:00:36 +02:00
Me No Dev
783271b6b5
Merge pull request #10890 from P-R-O-C-H-Y/libs/update-zigbee-1.6.2
fix(zigbee): Update esp-zigbee-sdk to 1.6.3 + necessary fixes
2025-02-18 14:01:16 +02:00
Me No Dev
35feed5077
Merge pull request #10832 from espressif/release/v3.2.x
Arduino 3.2.0 based on ESP-IDF v5.4
2025-02-18 11:54:51 +02:00
Me No Dev
f0cf3b1af6 feat(i2c): Add support for the new I2C driver in IDF v5.4 (#10858)
* feat(i2c): Add support for the new I2C driver in IDF v5.4

* fix(build): Add the new driver to CMakeLists.txt

* fix(i2c): Guard sleep retention

Not all chips can restore I2C bus after light sleep

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-18 10:11:55 +02:00
Me No Dev
18cbd762c9 feat(eth): Add support for generic IEEE 802.3 driver (#10859) 2025-02-18 10:11:55 +02:00
me-no-dev
50d85a6e9d fix(ci): Run CI against ESP-IDF v5.4 2025-02-18 10:11:55 +02:00
Me No Dev
47343a43f7 feat(idf): Add support for IDF v5.4 (#10823) 2025-02-18 10:11:55 +02:00
me-no-dev
dbfde15b6a Update core version to 3.1.3 2025-02-17 15:28:32 +02:00
TD-er
758cbd097d
Fix crash in String when using nullptr (#10971) (#10972)
Fixes: #10971
2025-02-17 15:27:41 +02:00
Jan Procházka
20e5e706be fix(boards): Delete removed Zigbee RCP mode 2025-02-17 09:47:29 +01:00
Jan Procházka
a4ecdb1a0f feat(zigbee): Bump esp-zigbee-sdk to 1.6.3 2025-02-14 18:32:14 +01:00
Me No Dev
a7907cd07e
Add the latest versions to issue report template 2025-02-14 16:57:23 +02:00
me-no-dev
62082398d3 Update core version to 3.1.2 2025-02-13 14:32:20 +02:00
TD-er
5488d5d23f
Fix crash when using String::move on empty string (#10938) (#10945)
Fixes: #10938
Keep allocated memory when rhs fits

Use case: Appending to a String with pre-allocated memory (e.g. from `reserve()`)
No need to move 0-termination char in String::move
Simplify calls to String::copy

A lot of the same checks were done before calling `copy()` which should be done in the `copy()` function itself.
String::copy() Should not copy more than given length
Fix potential out of range in String::concat

There is no prerequisite the given array has to be a 0-terminated char array.
So we should only copy the length that has been given.

The `setLen()` function will make sure the internal string is 0-terminated.
So no need to dangerously assume there will be 1 more byte to copy
Allow String::concat(const String &s) with s.buffer() == nullptr

When constructing a String object, the internal buffer is a nullptr.
However concatenating this to another String would return `false` while this is perfectly fine to do.
2025-02-13 14:14:05 +02:00
vortigont
6fb55a7f68
feat(board): Update 3rd party board Huidu HD-WF2/HD-WF4 (#10957)
* feat(board): Update 3rd party board Huidu HD-WF2/HD-WF4

Followup #10779

 - fixed flash mode to 'dio'
 - removed psram flags
 - corrected gpio mapping defines

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-13 14:03:21 +02:00
Jan Procházka
fb6b788b30
feat(zigbee): Support HSV color commands for RGB light endpoint (#10959)
* feat(zigbee): Support HSV color commands

* ci(pre-commit): Apply automatic fixes

* feat(zigbee): Add hue and sat attributes and update color capabilities

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-13 13:34:30 +02:00
Me No Dev
606a4049a2
IDF release/v5.3 (#10873)
* IDF release/v5.3 adf53196

* IDF release/v5.3 fb25eb02

* IDF release/v5.3 fb25eb02

* IDF release/v5.3 fb25eb02

* IDF release/v5.3 fb25eb02

* IDF release/v5.3 489d7a2b
2025-02-13 13:16:30 +02:00
Jan Procházka
7f8c77f9ee
feat(zigbee): Add vibration sensor endpoint (#10944) 2025-02-13 13:03:02 +02:00
Jan Procházka
83abca1604
feat(zigbee): Add OTA client cluster support (#10946)
* feat(zigbee): Add OTA client cluster support

* feat(zigbee): Add conditions to reject OTA upgrade

* feat(zigbee): Add newest version of OTA handler

* fix(zigbee): Fix errors and warnings, swap parameters order

* feat(zigbee): Add simple OTA Client example

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-13 13:02:35 +02:00
dependabot[bot]
6c3a49cac7
build(deps): bump cryptography from 43.0.1 to 44.0.1 in /tests (#10961)
Bumps [cryptography](https://github.com/pyca/cryptography) from 43.0.1 to 44.0.1.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/43.0.1...44.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-13 13:01:13 +02:00
Me No Dev
7b651b64d6
feat(cdc): Add support for two CDC ports at once (#10962)
* feat(cdc): Add support for two CDC ports at once

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-13 12:51:28 +02:00
Me No Dev
250c1abf78
fix(i2s): Add missing initializer for I2S CLK config (#10963)
* fix(i2s): Add missing initializer for I2S CLK config

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-12 10:40:15 +02:00
Jan Procházka
5ba4c21a99
fix(zigbee): Add default destructor and fix initialization of tm struct (#10943) 2025-02-06 17:06:07 +02:00
Me No Dev
6fcaf69097
fix(wifi): Make sure that esp-hosted events are propagated (#10939) 2025-02-06 11:19:27 +02:00
Henning Kulander
db0bbad934
Created Zigbee Endpoint for Window Covering. (#10914)
* feat(zigbee): Added Endpoint for Window Covering (#10913)

* Added example Sketch.

* Added window covering to CMakeLists.txt.

* feat(zigbee): Window covering tilt support and fixes

* fix(zigbee): Fix typos

* ci(pre-commit): Apply automatic fixes

* fix(ci): Fixes of typos

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-04 17:52:02 +02:00
Me No Dev
6a1127625c
fix(ota): Make sure that ArduinoOTA.end() is called in the destructor (#10932) 2025-02-04 13:22:20 +02:00
Me No Dev
8b31d1e1a8
fix(ci): Disable some RainMaker examples on ESP32 (#10931) 2025-02-04 12:53:29 +02:00
thekurtovic
b385562fa6
NetworkEvents allow stack size to be changed. (#10805)
* feat(net): Allow for event task custom stack size

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-04 11:52:45 +02:00
Jan Procházka
6eb99d3ae3
feat(zigbee): Add IAS Zone endpoints (Contact Switch + Door/Window Handle) (#10918)
* feat(zigbee): Add IAS Zone endpoints

* ci(pre-commit): Apply automatic fixes

* fix(ci): Typo fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-02-04 11:25:11 +02:00
Akashdeep Deb
2040cbad51
Update README.md to add ESP-SR (#10925)
Adding ESP-SR to the documentation

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2025-02-04 11:24:49 +02:00
Rodrigo Garcia
1c01fcd196
fix(uart): fixed esp32s2 uart ci test case (#10926)
Wrong pins were used for baud rate detection test case, therefore no data was reaching UART1 RX FIFO from UART0 TX loopback.
2025-02-04 11:04:58 +02:00
Sayed (Tashfi) Nowroz
0302b4db47
fix(logging): incorrect FPS logging (#10921)
* fix(logging): Corrected FPS calculation

Previously, last_frame was only updated once at the beginning of stream_handler,
leading to incorrect FPS and avg_frame_time computation.

This commit ensures last_frame is updated on each iteration after last FPS computation,
resulting in accurate FPS logging.

Fixes #10920

* Revert "fix(logging): Corrected FPS calculation"

This reverts commit 0bb7b9555e7661c72dc3376cf8a001c6fd3758c8.

* fix(loggin): Incorrect FPS computation fixed

Corrected and tested change in FPS computation, suggested by @me-no-dev and found working with correct numbers.

Previously, last_frame was only updated once at the beginning of stream_handler,
leading to incorrect FPS and avg_frame_time computation.

This commit ensures last_frame is updated on each iteration after last FPS computation,
resulting in accurate FPS logging.

Fixes #10920
2025-01-31 23:25:45 +02:00
Jack Lin
f22866f888
Update HTTPS certificate in BasicHttpsClient.ino (#10911)
The certificate is outdated. The current certificate can be found using `openssl s_client -showcerts -connect jigsaw.w3.org:443`
2025-01-30 19:14:08 +02:00
TD-er
402ab56bf1
fix(SPIFFS): Use new disableWDT bool return value (#10909)
Analogue to this PR, but for SPIFFS: https://github.com/espressif/arduino-esp32/pull/10896/files
2025-01-30 19:12:07 +02:00
Jan Procházka
732a7cb4ee
feat(zigbee): Add Time cluster support + fix of duplicate indentify cluster (#10863)
* feat(zigbee): Add Time cluster support

* fix(zigbee): Remove duplicate of identify cluster

* feat(zigbee): Remove unused variables in addTimeCluster

* feat(zigbee): Update examples with optional Time cluster

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-01-30 19:11:40 +02:00
lbernstone
2fecc482b7
fix(littlefs): Converted core disableWDT functions to bool (#10896)
* fix(littlefs): Converted core disableWDT functions to bool

* Missed the returns on core1

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-01-27 12:39:15 +02:00
lsroka76
15cbb1e857
Add IAS Zone Notification Message service to ZigbeeHandlers and ZigbeeEP.h (#10821)
* Update ZigbeeHandlers.cpp

* Update ZigbeeEP.h

* Update ZigbeeEP.h

make addBoundDevice virtual for override

* fix(zigbee): Update and reorder handlers

* fix(zigbee): Place default handler to the end

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-01-27 12:38:50 +02:00
Jan Procházka
7089c0a188 fix(zigbee): Update esp-zigbee-sdk to 1.6.2 + necessary changes 2025-01-22 13:34:39 +01:00
is-qian
496b841177
feat(esp32): Added a new device(xiao esp32s3 plus) (#10768)
* feat(esp32): Added a new device(xiao esp32s3 plus)

* Update boards.txt

* Apply suggestions from code review

* Fix filename error.

* Fix filename error.

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-01-21 13:24:00 +02:00
Jan Procházka
2a2b81ad6f
feat(zigbee): Add 2MB + 8MB partitions (#10864) 2025-01-15 16:35:27 +02:00
Lucas Saavedra Vaz
01d9726609
docs(discord): Replace Gitter links with Discord (#10852)
* docs(discord): Replace Gitter links with Discord

* docs(links): Add Developer Portal link
2025-01-15 01:46:31 +02:00
Lucas Saavedra Vaz
fcce93a029
fix(example): Fix partition for PathArgServer 2025-01-13 19:14:41 -03:00
Rodrigo Garcia
0773dd7619
Bugfix/include order (#10841)
* fix(arduino): include order pins_arduino first

* fix(arduino): include order pins_arduino first

* fix(arduino): include order pins_arduino first
2025-01-13 12:40:14 +02:00
Rodrigo Garcia
4c36c89768
fix(matter): serial print instead of log_i (#10842)
* fix(matter): serial print instead of log_i

* fix(example): adds a white space to the message
2025-01-13 12:36:03 +02:00
Jan Procházka
a81e2d48f5
fix(i2s): Check if pin is used before clearing bus (#10833)
* fix(i2s): Check if pin is used before clearing bus

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-01-10 14:05:16 +02:00
Jan Procházka
814371726d
fix(zigbee): Fixes in handlers, destructors and co2 sensor delta reporting (#10834)
* fix(zigbee): Fix co2 sensor delta in reporting

* fix(zigbee): Declare default empty destructors

* fix(zigbee): Return on error in zigbee handlers
2025-01-10 14:04:39 +02:00
Jan Procházka
2f423afc4e
fix(zigbee): Fixes of timeout, example, warnings and bounding + add a 2MB part scheme for Zigbee ED (#10817)
* feat(zigbee): Add 2MB partition scheme for ED

* fix(example): Check if readings are not null

* fix(zigbee): Add a 10s timeout for temp sensor settings read

* fix(example): Remove duplicated read

* fix(zigbee): Check if device is not bound before bounding again

* fix(zigbee): Revert zigbee partitions name

* fix(zigbee): Fix warnings of missing initializer for member

* fix(zigbee): Fix typo in the comment

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-01-08 15:31:51 +02:00
stefan-sherwood
c23c786749
ESPmDNS: Add method for querying discovered service name (#10819)
* Add method for querying service name

* Added implementation for getting service name

* Update mDNS-SD_Extended example to include service name

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-01-07 23:53:43 +02:00
Me No Dev
51ef2a1d29
fix(platform): Improve firmware size calculation (#10820)
* fix(platform): Improve firmware size calculation

It will still have a couple of hundred of bytes difference

* fix(build): Change partition used for UploadHugeFile
2025-01-07 18:01:12 +02:00
vortigont
e305a483b0
feat(board): Add custom board Huidu HD-WF2/HD-WF4 - esp32-s3 HUB75 driver boards (#10779)
* feat(board): Add custom boards Huidu HD-WF2/HD-WF4 - esp32-s3 HUB75 driver boards

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2025-01-07 15:51:14 +02:00
Me No Dev
7cfe0adc87
IDF release/v5.3 (#10816)
* IDF release/v5.3 cfea4f7c

* Update core version
2025-01-07 15:50:38 +02:00
Limor "Ladyada" Fried
efb3393aa1
Add two more Adafruit Boards (Sparkle Motion & Sparkle Motion mini) (#10809)
* add sparkle motion board (w/esp32 mini module)

* add mini version!
2025-01-07 12:05:19 +02:00
Me No Dev
30b97d1f91
fix(camera): Update resolutions and remove face detection (#10814)
* fix(camera): Update resolutions and remove face detection

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-01-07 12:04:20 +02:00
Me No Dev
ed9a5d876d
fix(udp): Add missing LwIP locks to init multicast (#10813)
* fix(udp): Add missing LwIP locks to init multicast

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-01-07 12:03:55 +02:00
Rodrigo Garcia
2cb08193d8
feat(matter): adds esp_matter:: namespace to attribute_t (#10807)
* feat(matter): adds esp_matter:: namespace to attribute_t

* feat(matter): adds esp_matter:: namespace to attribute_t

* feat(matter): adds esp_matter:: namespace to attribute_t

* feat(matter): adds esp_matter:: namespace to attribute_t

* feat(matter): adds esp_matter:: namespace to attribute_t

* feat(matter): adds esp_matter:: namespace to attribute_t
2025-01-07 12:03:31 +02:00
Mattia Pennasilico
5f44c4ebc5
fix(client): Restore Arduino Client API (#10776) 2025-01-07 12:03:11 +02:00
Lucas Saavedra Vaz
9eee1dd559
ci(dangerjs): Fix and update settings (#10770) 2025-01-07 12:02:50 +02:00
Rodrigo Garcia
5aaccd8f89
feat(matter): fixes matter temperature sensor endpoint to indicate celsius as measure unit (#10759) 2025-01-07 12:02:30 +02:00
Me No Dev
10d0bf8ea7
ci: Allow push to the component registry from a given git ref (#10757)
Co-authored-by: Sergei Silnov <sergei.silnov@espressif.com>
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2025-01-07 12:01:55 +02:00
Rodrigo Garcia
e3cc04084d
feat(matter): new Matter Endpoint for Thermostat (#10755)
* feat(matter): add new matter endpoint for thermostat

* fix(matter): not used variable from log_e() message

* feat(matter): adds specifc type name for thermostat auto mode enabled

* fix(matter): suggested changes in pr review

* feat(matter): added the whole list of thermostat operational modes

* fix(matter): fixed type in thermostat operational modes

* ci(pre-commit): Apply automatic fixes

* fix(matter): typos caught by CI codespell

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-01-07 12:01:16 +02:00
Mathieu Carbou
b07eb175d8
feat(webserver): Middleware with default middleware for cors, authc, curl-like logging (#10750)
* feat(webserver): Middleware with default middleware for cors, authc, curl-like logging

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-01-07 12:00:50 +02:00
Lucas Saavedra Vaz
089cbabf17
docs(3rd-party): Add section for third party tools (#10749)
* docs(3rd-party): Add section for third party tools

* fix(docs): Fix dependencies in Python 3.13

* fix(typo): Fix docs typo

* docs(3rd-party): Re-write some phrases

* ci(pre-commit): Apply automatic fixes

* fix(naming): Rename files

* fix(spelling): Fix spelling mistake

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-01-07 12:00:21 +02:00
Ramprasad G
5c41881858
improving logging message while waiting for WiFi (#10739)
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2025-01-07 11:59:52 +02:00
Me No Dev
9eb7dc6f7b
Update Issue-report.yml with the latest version numbers 2024-12-19 12:54:56 +02:00
Lucas Saavedra Vaz
352705e607
fix(component): Add check for workflow_run (#10753) 2024-12-18 15:55:26 -03:00
Me No Dev
7298959ce5
Merge pull request #10752 from lucasssvaz/ci/component
fix(component): Checkout proper branch for uploading component
2024-12-18 20:43:02 +02:00
Lucas Saavedra Vaz
4884c96463
fix(component): Checkout proper branch for uploading component 2024-12-18 15:37:39 -03:00
Me No Dev
bd7a74ee51
Merge pull request #10202 from espressif/release/v3.1.x
ESP32 Arduino v3.1.x
2024-12-18 15:56:18 +02:00
Me No Dev
4fdf9ef854
Merge pull request #10740 from lucasssvaz/ci/sched_debug
ci(debug): Compile once a week with verbose log level
2024-12-18 15:01:11 +02:00
Me No Dev
3ffee273fb
Merge pull request #10745 from lucasssvaz/fix/update_readme
fix(readme): Update readme and fix badges
2024-12-18 14:56:47 +02:00
Me No Dev
ee33ad5910
Merge pull request #10741 from yellobyte/master
feat(board): Add custom board YB-ESP32-S3-ETH
2024-12-18 14:56:32 +02:00
Lucas Saavedra Vaz
238c384e4e
fix(readme): Update readme and fix badges 2024-12-17 19:02:26 -03:00
Lucas Saavedra Vaz
2fc679151c
ci(debug): Compile once a week with verbose log level 2024-12-17 09:57:25 -03:00
pre-commit-ci-lite[bot]
4d0ae18aee
ci(pre-commit): Apply automatic fixes 2024-12-17 06:37:40 +00:00
Thomas Jentzsch
25ebe440e2 add board yb_esp32s3_eth 2024-12-16 23:36:33 +01:00
Me No Dev
6bf6df2d6f
Merge pull request #10734 from SuGlider/matter_identify_callback
feat(matter) adds Identification callback to all matter endpoints
2024-12-16 21:46:43 +02:00
pre-commit-ci-lite[bot]
71e57eaf52
ci(pre-commit): Apply automatic fixes 2024-12-16 19:29:30 +00:00
Rodrigo Garcia
e2dc5b60f3 fix(matter): stashing merge error 2024-12-16 16:28:51 -03:00
pre-commit-ci-lite[bot]
bce01087d2
ci(pre-commit): Apply automatic fixes 2024-12-16 19:20:35 +00:00
Rodrigo Garcia
017f2df8ef fix(matter): ci codespell 2024-12-16 16:19:47 -03:00
pre-commit-ci-lite[bot]
1ef603aab7
ci(pre-commit): Apply automatic fixes 2024-12-16 19:13:45 +00:00
Rodrigo Garcia
7302be9792 fix(matter): log_i() leftover 2024-12-16 15:50:59 -03:00
Rodrigo Garcia
6f79e03449 fix(matter): fixes identify and double begin() call 2024-12-16 15:48:41 -03:00
Rodrigo Garcia
ba8d04eff2
Merge branch 'release/v3.1.x' into matter_identify_callback 2024-12-16 14:25:27 -03:00
Me No Dev
6a6edcbee9
Merge branch 'master' into release/v3.1.x 2024-12-16 19:12:44 +02:00
Me No Dev
0515264aa6
Merge pull request #10737 from TD-er/patch-2
[NetworkClient] Init members of NetworkClient
2024-12-16 19:12:24 +02:00
Me No Dev
eb7258070b
Merge pull request #10735 from lucasssvaz/fix/p4_apll
fix(clk_src): Fix error as APLL is not yet supported for P4
2024-12-16 19:12:10 +02:00
Me No Dev
30e55fc4b7
Merge pull request #10732 from SuGlider/matter_while_serial
feat(matter): General Review - remove while(!serial)  ipv6(enable) and fixes some commentaries in the code
2024-12-16 19:11:52 +02:00
TD-er
8479b4cd9f
[NetworkClient] Init members of NetworkClient
Fixes: #10736
2024-12-16 16:25:53 +01:00
Rodrigo Garcia
cd7a775344
fix(matter): missing logged message type value 2024-12-16 11:47:07 -03:00
pre-commit-ci-lite[bot]
43c419e31b
ci(pre-commit): Apply automatic fixes 2024-12-16 14:41:38 +00:00
Rodrigo Garcia
3f7c5976d2 feat(matter):replacing code in examples and header files 2024-12-16 11:40:49 -03:00
Rodrigo Garcia
0e22bb4bac feat(matter): moved all identify callback to endpoint.h 2024-12-16 10:58:49 -03:00
Lucas Saavedra Vaz
c688f3090f
fix(clk_src): Fix error as APLL is not yet supported for P4 2024-12-16 10:48:50 -03:00
Rodrigo Garcia
1dff8bc759 feat(matter) adds Identification callback to all matter endpoints 2024-12-16 10:01:24 -03:00
me-no-dev
1ef1e7dbac fix(version): Update Zigbee Library version 2024-12-16 14:43:33 +02:00
Rodrigo Garcia
7d465f323b feat(matter): fix commentaries related to feature changes and log messages 2024-12-16 08:14:13 -03:00
Rodrigo Garcia
31dc520c4d feat(matter): removed while(serial) and ipv6 enabling, which is a default 2024-12-16 08:11:50 -03:00
Me No Dev
a207d58f0f
Merge branch 'master' into release/v3.1.x 2024-12-16 13:09:39 +02:00
Me No Dev
6005b15947
Merge pull request #10730 from leochen4891/patch-1
Use INPUT_PULLUP instead of INPUT
2024-12-16 13:09:19 +02:00
Me No Dev
926c043e3a
Merge pull request #10727 from FaBjE/feature/zigbeeDimmableLight
Zigbee: Add dimmable light endpoint class
2024-12-16 13:08:31 +02:00
Jan Procházka
4f863d52ba fix(zigbee): Rename method to avoid future conflict 2024-12-16 10:19:42 +01:00
pre-commit-ci-lite[bot]
ddf8c42af3
ci(pre-commit): Apply automatic fixes 2024-12-16 09:10:57 +00:00
Lei Chen
2c7b76aea8
Use INPUT_PULLUP instead of INPUT
Tested on some of the popular S3 board bought from Amazon, the digitalRead of an INPUT pin is LOW, which stops the timer right after start.
Setting it to INPUT_PULLUP will fix it.
2024-12-15 12:19:49 -05:00
FaBjE
ae274ee897 feat(Zigbee): Adjusted example author comment 2024-12-14 18:01:49 +01:00
FaBjE
ff7e50482a feat(Zigbee): Applied formatter + add formatter protection
As suggested by code review
2024-12-14 17:57:00 +01:00
Me No Dev
3c3ff48d73
Merge branch 'master' into release/v3.1.x 2024-12-14 17:52:55 +02:00
Me No Dev
64b62dc45b
Merge pull request #10724 from socram8888/fix-web-raw-timeout
Cap size of last chunk in raw read in WebServer
2024-12-14 17:50:39 +02:00
Me No Dev
8e59a1b777
Merge pull request #10722 from SuGlider/matter_plugin
feat(matter): adds a new endpoint to Matter - On/Off Plugin (Power Relay)
2024-12-14 17:50:22 +02:00
Me No Dev
417c7ee25d
Merge pull request #10720 from P-R-O-C-H-Y/feat/zigbee-multi-sensor
feat(zigbee): Add pressure, flow, ccupancy and carbon dioxide sensor
2024-12-14 17:49:57 +02:00
FaBjE
42f9cfca60 feat(Zigbee): Add additional zigbee enabled check 2024-12-14 16:39:32 +01:00
FaBjE
af541a5c14 feat(Zigbee): Add Zigbee Dimmable light to CMakeLists.txt 2024-12-14 11:16:26 +01:00
pre-commit-ci-lite[bot]
b6d0553fa5
ci(pre-commit): Apply automatic fixes 2024-12-13 22:26:35 +00:00
FaBjE
a0d57bb6d0 feat(Zigbee): Update Zigbee Dimmable light example config/define names 2024-12-13 19:16:06 +01:00
FaBjE
538c57a994 feat(Zigbee): Update Zigbee Dimmable light example to 3.1.x features 2024-12-13 19:09:36 +01:00
FaBjE
aa0c3da729 feat(Zigbee): Add Zigbee Dimmable light example
Add example for a dimmable light. Based on a copy of color dimmable light example.
2024-12-13 17:23:25 +01:00
FaBjE
a44e45795c feat(Zigbee): Add Zigbee Dimmable light endpoint class
Add a endpoint type class for a dimmable light. Based on a copy of color dimmable light.
2024-12-13 17:23:25 +01:00
Jan Procházka
6bc971c1a3 fix(zigbee): fix formatting of defines 2024-12-13 17:12:13 +01:00
Jan Procházka
a7e2e64c5b
Apply suggestions from code review
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-12-13 17:07:08 +01:00
pre-commit-ci-lite[bot]
faed832298
ci(pre-commit): Apply automatic fixes 2024-12-13 14:34:24 +00:00
pre-commit-ci-lite[bot]
8b77d91b69
ci(pre-commit): Apply automatic fixes 2024-12-13 13:45:07 +00:00
Marcos Del Sol Vives
c562aeceda
Update libraries/WebServer/src/Parsing.cpp
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-12-13 14:32:32 +01:00
Me No Dev
740fc0b78e
Merge pull request #10725 from mathieucarbou/issue-10526
fix(sntp): Lock / Unlock LWIP if CONFIG_LWIP_TCPIP_CORE_LOCKING is set
2024-12-13 15:31:47 +02:00
Jan Procházka
57339ba58c feat(zigbee): Update keywords.txt with co2 sensor 2024-12-13 14:27:04 +01:00
Jan Procházka
b72e8669df fix(zigbee): mention Carbon dioxide delta reporting is not supported 2024-12-13 14:15:08 +01:00
Jan Procházka
44e1559830 feat(zigbee): Add carbon dioxide sensor ed 2024-12-13 11:47:28 +01:00
Jan Procházka
ce9a34db9a fix(zigbee): Update example + pressure unit 2024-12-13 11:13:28 +01:00
Mathieu Carbou
71396de822
fix(sntp): Lock / Unlock LWIP if CONFIG_LWIP_TCPIP_CORE_LOCKING is set
- Fixes: #10526
- Completes old PR #10529
2024-12-13 09:09:09 +01:00
Marcos Del Sol Vives
784ef0f286
fix(webserver): Cap size of last chunk in raw read in WebServer
Before, the raw read would time out if the content length was not a multiple
of HTTP_RAW_BUFLEN, as it tried to read HTTP_RAW_BUFLEN bytes even if the
last chunk should actually contain less.
2024-12-13 03:08:16 +01:00
github-actions[bot]
7dc1c92813 change(tools): Push generated binaries to PR 2024-12-12 20:45:05 +00:00
Me No Dev
7205ee81ac
Merge pull request #10718 from espressif/change/esptool
change(esptool): Bump esptool version and fix deprecation warning
2024-12-12 22:43:37 +02:00
github-actions[bot]
c6ec112054 change(tools): Push generated binaries to PR 2024-12-12 16:25:55 +00:00
pre-commit-ci-lite[bot]
8f0f46fe54
ci(pre-commit): Apply automatic fixes 2024-12-12 16:24:21 +00:00
Rodrigo Garcia
c126f017f8
Merge branch 'release/v3.1.x' into matter_plugin 2024-12-12 13:11:42 -03:00
Rodrigo Garcia
c310c1ade4 feat(matter): adds matter on off plugin endpoint 2024-12-12 13:05:35 -03:00
Rodrigo Garcia
e060b02328
feat(matter): adds new Matter Occupancy Sensor endpoint (#10717)
* feat(matter): adds matter occupancy sensor endpoint
2024-12-12 12:49:10 -03:00
Jan Procházka
b64b8500cb feat(zigbee): Fill the keywords.txt 2024-12-12 15:27:53 +01:00
Jan Procházka
5e7139b8fe fix(cmake): Update CMakeLists.txt 2024-12-12 15:19:31 +01:00
Jan Procházka
b4d7227068 fix(zigbee): Fix functions comment 2024-12-12 15:18:01 +01:00
Jan Procházka
aef691e0e2 fix(example): use correct print format 2024-12-12 15:15:33 +01:00
Jan Procházka
77df256f5d feat(zigbee): Add pressure, flow and occupancy sensor 2024-12-12 15:07:31 +01:00
pre-commit-ci-lite[bot]
4cf0f20129
ci(pre-commit): Apply automatic fixes 2024-12-12 13:43:48 +00:00
Me No Dev
a4f96e9280
Merge pull request #10719 from espressif/idf-release/v5.3
IDF release/v5.3
2024-12-12 15:10:56 +02:00
Rodrigo Garcia
3bf8f23e48
fix(matter): removed commentary that has no code related 2024-12-12 10:03:45 -03:00
me-no-dev
217eec6e1e IDF release/v5.3 083aad99 2024-12-12 09:41:07 +00:00
github-actions[bot]
c8f23ec65d change(tools): Push generated binaries to PR 2024-12-11 23:03:22 +00:00
Lucas Saavedra Vaz
b9a0122f7b
fix(get): Fix deprecation warning 2024-12-11 20:01:51 -03:00
Lucas Saavedra Vaz
d072cdd41f
change(esptool): Bump to version 4.9.dev3 2024-12-11 19:50:49 -03:00
Rodrigo Garcia
e17900b02a feat(matter): adds matter occupancy sensor endpoint 2024-12-11 15:57:54 -03:00
Me No Dev
a1f58ad2c8
Merge branch 'master' into release/v3.1.x 2024-12-11 20:39:53 +02:00
Me No Dev
fb6e977aa8
Merge pull request #10715 from SuGlider/remove_while_not_serial_in_examples
feat(arduino): remove all while(not serial) in examples
2024-12-11 20:39:37 +02:00
Me No Dev
59d51de642
Merge pull request #10677 from kvp1703/fix/wifi_provision
fix: Split provisioning into two parts for better synchronization
2024-12-11 16:13:00 +02:00
Rodrigo Garcia
029a57ff36
Merge branch 'master' into remove_while_not_serial_in_examples 2024-12-11 11:07:32 -03:00
Me No Dev
d55160c2fe
Merge pull request #10712 from SuGlider/matter_contact_sensor
feat(matter): creates a Matter Contact Sensor Endpoint
2024-12-11 15:59:52 +02:00
pre-commit-ci-lite[bot]
4ecfd35ec6
ci(pre-commit): Apply automatic fixes 2024-12-11 13:52:12 +00:00
Me No Dev
237523ee2b
Merge pull request #10699 from yellobyte/master
feat(board): Add custom boards YB-ESP32-S3-AMP-V2 & YB-ESP32-S3-AMP-V3
2024-12-11 15:49:22 +02:00
Me No Dev
83165f3494
Merge pull request #10704 from P-R-O-C-H-Y/fix/zigbee-rejoin-battery-powered
fix(zigbee): Fix rejoin issue for battery powered devices
2024-12-11 15:45:40 +02:00
pre-commit-ci-lite[bot]
9c169fac8b
ci(pre-commit): Apply automatic fixes 2024-12-11 13:43:04 +00:00
Me No Dev
c3ddcd74d4
Merge pull request #10713 from P-R-O-C-H-Y/fix/sdmmc-esp32-define
fix(SDMMC): Remove need for BOARD_HAS_SDMMC for esp32
2024-12-11 15:42:56 +02:00
Me No Dev
2bd1ec4394
Merge branch 'release/v3.1.x' into matter_contact_sensor 2024-12-11 15:42:18 +02:00
Me No Dev
639a08eb20
Merge pull request #10710 from SuGlider/matter_pressure_sensor
feat(matter): adds a Pressure Sensor Matter Endpoint
2024-12-11 15:40:44 +02:00
Me No Dev
626a09f8ea
Merge pull request #10711 from espressif/idf-release/v5.3
IDF release/v5.3
2024-12-11 15:40:25 +02:00
Me No Dev
7e908be100
Merge pull request #10708 from espressif/ci/remove_pio_tests
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2024-12-11 15:40:08 +02:00
Rodrigo Garcia
68cafb460d feat(arduino): remove all while(not serial) in examples 2024-12-11 10:35:46 -03:00
Jan Procházka
3a8d4c5244 fix(example): Use Serial in printBoundDevices() 2024-12-11 14:35:32 +01:00
pre-commit-ci-lite[bot]
8cbc395122
ci(pre-commit): Apply automatic fixes 2024-12-11 13:30:13 +00:00
me-no-dev
dfa732419b IDF release/v5.3 083aad99 2024-12-11 12:35:59 +00:00
pre-commit-ci-lite[bot]
56a9b1d123
ci(pre-commit): Apply automatic fixes 2024-12-11 12:25:13 +00:00
Lucas Saavedra Vaz
bfc45db3af
ci(tests): Re-enable UART test for P4 2024-12-11 08:56:12 -03:00
Jan Procházka
7c95911ff1 fix(SDMMC): Remove need for BOARD_HAS_SDMMC for esp32 2024-12-11 11:13:46 +01:00
Jan Procházka
07a3e629c8 fix(example): Remove wait on Serial after begin 2024-12-11 10:35:54 +01:00
Rodrigo Garcia
1f9eb74337
fix(matter): fix a bad error message - left over 2024-12-11 00:25:43 -03:00
Rodrigo Garcia
9c383687e0 feat(matter): creates a matter contact sensor endpoint 2024-12-11 00:18:11 -03:00
me-no-dev
59bc22a98f IDF release/v5.3 9a6aba74 2024-12-11 00:49:58 +00:00
Rodrigo Garcia
178af05079 feat(matter): adds a new matter endpoint for pressure sensor 2024-12-10 19:51:52 -03:00
Rodrigo Garcia
de4824fc24
feat(matter_examples): apply boot button change to all examples (#10702)
* feat(matter_examples): apply boot button change to all examples
2024-12-10 18:16:54 -03:00
Rodrigo Garcia
5a8cba88c7
feat(Matter): Adds New Matter Humidity Sensor Endpoint (#10703)
* feat(matter): adds matter humidity sensor endpoint
2024-12-10 12:51:00 -03:00
Lucas Saavedra Vaz
45d863049a
ci(tests): Remove 3rd party tests
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2024-12-10 10:37:53 -03:00
Lucas Saavedra Vaz
3d8014b453
Merge branch 'master' into release/v3.1.x 2024-12-10 10:23:39 -03:00
Jan Procházka
d7492b167c fix(example): Lower the delay for sleepy device 2024-12-10 14:06:17 +01:00
Jan Procházka
a281b26bae fix(zigbee): Move button and led pins from defines 2024-12-10 13:37:23 +01:00
Jan Procházka
87d988fdb5 fix(zigbee): Add getter for RxOnWhenIdle 2024-12-10 12:57:37 +01:00
Jan Procházka
be95fc5764 fix(zigbee): Set scan to 3 and remove duplicate 2024-12-10 12:46:44 +01:00
Jan Procházka
8c3efc26f6 fix(zigbee): set rx on idle and alloc address 2024-12-10 08:56:53 +01:00
Thomas Jentzsch
9b9e6afdc6 Update boards.txt
mixed line endings fixed, pre-commit succssful
2024-12-10 01:29:19 +01:00
Me No Dev
9660e66325
feat(chip): Add definition for BOOT_PIN for all chips (#10700)
* feat(chip): Add definition for BOOT_PIN for all chips

For use in sketches as default button

* fix(core): Make BOOT_PIN static

* fix(hal): BOOT_PIN should always be defined
2024-12-10 01:12:50 +02:00
Rodrigo Garcia
538efe3b8c
feat(matter): adds new Temperature Sensor Matter Endpoint (#10698)
* feat(matter): adds new temperature sensor matter endpoint

* feat(matter): commentaries review and fixes

* feat(matter): commentaries review and fixes

* feat(matter): commentaries review and fixes

* feat(matter): commentaries review and fixes

* feat(matter): commentaries review and fixes

* feat(matter): commentaries review and fixes

* feat(matter): general commentaries and code review

* feat(matter): keeping arduino style for local variables (lower case)

* feat(matter): applies a generic temperature unit to the implementation and example

* fix(matter): fixed problem with begin(float) implementation

* fix(matter): fixed begin(float) initiallization

* feat(matter): updated matter temperature keywords with new api

* ci(pre-commit): Apply automatic fixes

* fix(matter): fixed code spell ci errors in matter temperature sensor

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-12-10 00:30:05 +02:00
Lucas Saavedra Vaz
2028ba43da
fix(push): Re-comment unused code 2024-12-09 19:03:54 -03:00
Thomas Jentzsch
2f21d6482b add custom boards yb_esp32s3_amp v2 & v3 2024-12-09 18:26:43 +01:00
Michael Stegen
19e4d0db4a
fix ESP32-U4WDH chip detection by ESP.getChipModel() (#10696)
* fixes chip detection for ESP32-U4WDH
2024-12-09 12:59:52 -03:00
Lucas Saavedra Vaz
cd772f1437
ci(pre-commit): Add bash script formatter and linter (#10681)
* ci(pre-commit): Add check for bash scripts

* fix(formatting): Fix bash scripts

* docs(pre-commit): Add info about the included hooks
2024-12-09 15:25:11 +02:00
github-actions[bot]
7a0775d697 change(tools): Push generated binaries to PR 2024-12-09 13:02:28 +00:00
Rodrigo Garcia
7a82b8be83
feat(Matter): Creates New Matter Fan Controller Endpoint (#10691)
* feat(matter): creates new matter fan controller endpoint
2024-12-09 10:01:24 -03:00
Lucas Saavedra Vaz
76d1f9e643
ci(pre-commit): Bump hooks versions and fix leftover files (#10680)
* update(hooks): Bump pre-commit hooks versions

* fix(formatting): Fix python script formatting

* fix(formatting): Fix leftover files on protected folders
2024-12-09 15:00:41 +02:00
Jan Procházka
92dd841ffc
feat(Zigbee): Recall bounded devices after reboot + IEEE address option for commands (#10676)
* feat(zigbee): Recall bound devices after reboot

* fix(zigbee): Add missing locks + allow printBoundDevices to Serial

* fix(Zigbee): Add locks to temp sensor setReporting

* fix(Zigbee): remove unnecessary space in formatting

* fix(Zigbee): proper parameter in printBoundDevices

* feat(Zigbee): factory reset when removed from network

* fix(zigbee): Update comment

* fix(zigbee): fix serial and add missing factoryReset to example

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-12-09 14:30:15 +02:00
PCB CUPID
77c69c38d6
feat (Variants) Added custom boards variants GLYPH C3, GLYPHC6 & GLYPHH2 (#10671)
* Added custom boards GLYPH C3, GLYPHC6 & GLYPHH2 based on ESP32C3, ESP32C6 & ESP32H2

* feat(Variants) : Added custom boards GLYPH C3, GLYPHC6 & GLYPHH2

Added custom boards variants from PCBCUPID - GLYPH C3, GLYPHC6 & GLYPHH2 based on ESP32C3, ESP32C6 & ESP32H2

* added required fix : moved the variants to end and fixed build.board

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: srini <srinivasanm329@gmail.com>
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-12-09 11:41:30 +02:00
Lucas Saavedra Vaz
e159bf6e46
refactor(uart): Refactor UART test to work with any number of UARTs (#10593)
* refactor(uart): Refactor UART test to work with any number of UARTs

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>

* fix(uart): Set CPU freq on ESP32

* ci(pre-commit): Apply automatic fixes

* fix(spelling): Fix codespell error

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-12-09 11:27:56 +02:00
kshitij.patil
4eeff9bc57 fix: Split provisioning into two parts for better synchronization 2024-12-04 15:05:32 +05:30
Rodrigo Garcia
c7022caeda
Remove 3rd party references in code and documentation (#10666)
* feat(support): documentation adjustment
* feat(support): readme files, commentaries and examples
* fix(template): Fix Issue Report Template
-----------------------------
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-12-03 14:35:13 -03:00
Sylvain Quendez
6ce43695d2
BLECharacteristic optimization (#10665)
* BLECharacteristic::notify() optimization

GeneralUtils::hexDump() doesn't output anything if the log level is not "VERBOSE". Additionally, it is very CPU intensive, even when it doesn't output anything. So it is much better to *not* call it at all if not needed. 

In a simple program which calls BLECharacteristic::notify() every 50 ms, the performance gain of this little optimization is 37% in release mode (-O3) and 57% in debug mode. 

Of course, the "#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE" guard could also be put inside the GeneralUtils::hexDump() function itself. But it's better to put it here also, as it is clearer (indicating a verbose log thing) and it allows to remove the "m_value.getValue().c_str()" call, which is in itself quite CPU intensive.

* BLECharacteristic optimization

Calls to BLEUtils::buildHexData() don't output anything when the log level is not "VERBOSE" or "DEBUG". As this function is quite CPU intensive, it is better to not call it when not needed.
2024-12-03 11:10:51 -03:00
Rodrigo Garcia
af84da6f6a
feat(matter): Adds a new Matter Endpoint: Generic Switch (smart button) (#10662)
* feat(matter): adds new matter generic switch endpoint

* fix(matter): no need of arduino preferences here

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-12-03 08:08:51 +02:00
Rodrigo Garcia
9d8df8b315
feat(matter): Adds Matter Enhanced Color Light Endpoint (CW/WW/RGB) (#10657)
* feat(matter): created enhanced color light new matter endpoint and example
2024-12-02 19:26:13 -03:00
Rodrigo Garcia
c2ce738cae
feat(matter): New example => Wifi Prov within Matter as alternative for wireless network provisioning (#10658)
* feat(matter): Arduino WiFi Prov example for Matter
2024-12-02 19:13:17 -03:00
Me No Dev
9f5f95e50a
Merge branch 'master' into release/v3.1.x 2024-11-28 21:01:21 +02:00
Rodrigo Garcia
414e4f3233
feat(Matter): add new MatterColorLight endpoint (#10654)
* feat(matter): adds Matter Color Light endpoint
2024-11-26 17:14:38 -03:00
Dogus Cendek
98da424de6
Add our new development board "cezerio mini dev ESP32C6" (#10648) 2024-11-26 14:46:22 +02:00
Jan Procházka
0f3191e34f
fix(zigbee): Increase timeout, commision again on failure + setScanDuration (#10651)
* fix(zigbee): Increase timeout, commision again on failure
* fix(zigbee): Update library keywords
2024-11-25 17:39:59 -03:00
Rodrigo Garcia
0bcdd2c65f
Merge branch 'master' into release/v3.1.x 2024-11-25 12:18:11 -03:00
Rodrigo Garcia
4fc8abfafe
AsyncUdp license and keyword update (#10637)
* feat(asyncudp): add all current keywords to the list

* feat(asyncudp): add license information to the source code

* feat(asyncudp): add license information to the source code

* feat(asyncudp): add license information to the source code

* feat(asyncudp): add license information to the source code

* feat(asyncudp): add license information to the source code

* feat(asyncudp): revert license information to the source code

* feat(asyncudp): revert license information to the source code

* feat(asyncudp): revert license information to the source code

* feat(asyncudp): revert license information to the source code

* feat(asyncudp): revert license information to the source code

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-25 14:04:20 +02:00
Jason2866
eb1933fde9
Guard crypto parts in "Update" to save resources (#10630)
* guard crypt update

* guard update crypt

* Update Updater.cpp

* revert logic to disable

* change disable logic

* formatting

* formatting

* remove trailing space
2024-11-25 13:15:51 +02:00
Jan Procházka
1730e4e57e
fix(zigbee): Add connected(), minor fixes, example update (#10636)
* fix(zigbee): Add connected and minor fixes, example update

* fix(example): Use correct API call for connected

* fix(zigbee): Increase timeout and add semaphore to begin

* feat(zigbee): Add option to select debug libs for zigbee

* fix(example): fix warning by double percentage symbol

* fix(example): Fix serial prints for Windows os

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>

* ci(pre-commit): Apply automatic fixes

* fix(example): Fix precommit spelling

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-25 13:13:28 +02:00
Rodrigo Garcia
9417a84918
feat(uart): [IDF 5.3] fixes HardwareSerial::updateBaudRate() using a baud rate higher 230400 - checks UART Clock Source (#10643)
* fix(uart): fixes issue with update baudrate higher than 250000

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-25 13:13:01 +02:00
Lucas Saavedra Vaz
1712fb5eee
fix(network): Avoid returning zero if connection is not dropped (#10640)
Co-authored-by: NPaolini <75562717+NPaolini@users.noreply.github.com>
2024-11-25 12:17:38 +02:00
Jason2866
6e57662599
fix compile of P4 caused from missing ")" in debug macro (#10638) 2024-11-25 11:49:24 +02:00
Rodrigo Garcia
962ab3acea
Adds a Minimum Code Matter Example (#10639)
* feat(matter): add a new example for a minimum matter device
---------
2024-11-24 19:09:46 -03:00
Rodrigo Garcia
3dd4b0d112
feat(openthread): add license declaration to all soure code and examples (#10631) 2024-11-22 11:57:08 -03:00
Rodrigo Garcia
6bc3ce68fe
feat(matter): New Matter Endpoint (#10628)
* feat(matter): add new endpoint - color temperature light

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-20 17:02:34 -03:00
Lucas Saavedra Vaz
ff613b3f29
ci(uart): Disable UART test for P4 until it is fixed in Wokwi 2024-11-20 10:10:39 -03:00
Me No Dev
66f7c93db4
Merge branch 'master' into release/v3.1.x 2024-11-20 10:52:06 +02:00
Jan Procházka
268b31c3f6
feat(zigbee): Add setLight APIs to manually operate lights (#10626)
* feat(zigbee): Add setLight APIs to manually operate lights

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-20 10:51:47 +02:00
Rodrigo Garcia
f0ded24b3f
OTA Library adjust (#10627)
* feat(ota): library revision

* feat(ota): license

* feat(ota): license addtion

* feat(ota): license addition into example
2024-11-20 10:47:46 +02:00
Jan Procházka
442679d225
fix(Zigbee): Add missing direction to report commands (#10623)
* fix(Zigbee): Add missing direction to report commands

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-20 10:47:27 +02:00
Jason2866
d7b5bb111e
Guard WPA Enterprise support (#10616)
* Guard WPA Enterprise support

* guard `WIFI_ENTERPRISE_SUPPORT`

* wrong part guarded

* fix guard start and end

* add guard enterprise
2024-11-20 10:42:43 +02:00
Jason2866
f5ce3f7675
Guard ethernet parts to make it possible to use without (#10609)
* Update ETH.cpp

* Update ETH.h

* Update WiFiGeneric.h

* Update NetworkEvents.h

* remove unnecessary include "sdkconfig.h"

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-19 12:19:02 +02:00
Rodrigo Garcia
2b6b5c74ce
feat(uart): adds Serial4 as a keyword - used by ESP32-P4 (#10619)
* feat(uart): adds Serial4 as a keyword - used by ESP32-P4

* fix(keywords): added 2 new lines to keep consistancy
2024-11-19 12:18:43 +02:00
Rodrigo Garcia
fe0f016b4f
Matter example patch (#10618)
* feat(matter): adjust preferences labels in matter examples

* feat(matter): adjust preferences labels in matter examples

* fix(matter_example): extra blank space in code added by mistake

* feat(matter_example): use const char * instead of #define

* feat(matter_example): use const char * instead of #define

* feat(matter_example): change Preferences names

* fix(matter_example): missing semicolon in code
2024-11-19 12:18:23 +02:00
Jason2866
4a8ba4294e
fix weird formatting, no code change (#10617)
* fix formatting

* Disable formatter for these lines

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-11-19 12:18:06 +02:00
Me No Dev
3a5dbf241e
Merge branch 'master' into release/v3.1.x 2024-11-19 12:14:57 +02:00
Unexpected Maker
1cdd8e8ce0
Fixed incorrect Flash size for UM FeatherS3 Neo build flash size (#10614)
Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>
2024-11-18 14:43:28 +02:00
Mikey Sklar
02b03286a2
Feather V2 and Qt PY Pico PartitionScheme (#10604)
Default stays the same, additional option for larger SPIFFS area. Using existing partition CSV.

Tested on Feather V2
Arduino 2.3.3
ESP32 BSP 3.0.7
2024-11-18 09:44:22 +02:00
Cellie
9c25cef93f
Update pins_arduino.h (#10610)
The correct pin is GPIO4.
2024-11-18 09:43:31 +02:00
Lucas Saavedra Vaz
e9b3f2650e
ci(pytest): Bump pytest-embedded to 1.12.0 for P4 fixes 2024-11-14 12:20:18 -03:00
Me No Dev
3822a68820
IDF release/v5.3 (#10599)
* fix(zigbee): Bump zigbee version and use 1.6.0 (#10563)

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>

* fix(zigbee): Add require public for zigbee libs

* fix(zigbee): Guard the Zigbee library

* fix(zigbee): Fix removed cluster_role attribute (#10576)

* fix(hosted): Update hosted configuration

* fix(hosted): Fix Hosted deinit and protect reinit for now

* IDF release/v5.3 a0f798cf

* IDF release/v5.3 a0f798cf

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-11-13 12:33:02 +02:00
Me No Dev
cc407185a3
fix(build): Allow Arduino to compile in IDF without components (#10597)
* fix(build): Allow Arduino to compile in IDF without components

This adds guards for the rest of the extra components

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-12 17:23:51 +02:00
Me No Dev
f8d9ffb74a
fix(net): Allow to compile without IPv6 enabled (#10582)
* fix(net): Allow to compile without IPv6 enabled

cc: @Jason2866

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-12 11:29:52 +02:00
Me No Dev
d561685258
Merge branch 'master' into release/v3.1.x 2024-11-12 10:24:28 +02:00
Rodrigo Garcia
e99f1fdc6d
fix(wifi): fixes isconnected() to return true when it has ip addr (#10595) 2024-11-12 01:00:26 +02:00
Rodrigo Garcia
54a7a3ee9a
feat(usb_hid_keyboard): Adds Keyboard Layout and Sends reports just for Modifier Keys (#10591)
* feat(usb_kb): add keyboard layouts. new pt_br layout

* feat(usb_kb): add kb layout and fixes modifier key press

* feat(usb_kb): update cmakelists.txt to add new kb layout code

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-12 00:56:06 +02:00
Jerzy Stusiński
1a8e53fe47
fix(typo): Fix typo in CDC DFU flash tutorial (#10584)
* Update cdc_dfu_flash.rst

* Update docs/en/tutorials/cdc_dfu_flash.rst

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* Update docs/en/tutorials/cdc_dfu_flash.rst

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-11-11 15:22:32 +02:00
Lucas Saavedra Vaz
09a6770320
fix(tests): Fix wrong selection of tests and add debug flag for testing (#10583)
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2024-11-08 11:17:55 +02:00
Ludovic BOUÉ
f66ba37d1f
fix(Zigbee): Fix typo in Zigbee_Temp_Hum_Sensor_Sleepy.ino (#10581) 2024-11-08 11:10:54 +02:00
Lucas Saavedra Vaz
1ecbbae7d3
fix(wifi): Guard missing sketches for hosted Wi-Fi 2024-11-06 21:25:38 -03:00
Lucas Saavedra Vaz
32e2230de2
fix(wifi): Fix requirements and guards for hosted Wi-Fi (#10579)
* fix(wifi): Fix requirements and guards for hosted Wi-Fi

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2024-11-07 00:31:29 +02:00
me-no-dev
c0092206a6 fix(wifi): Fix WiFiMulti on ESP32-P4 2024-11-06 18:29:57 +02:00
Lucas Saavedra Vaz
61d5c49445
Merge branch 'master' into release/v3.1.x 2024-11-06 13:11:23 -03:00
Lucas Saavedra Vaz
9f3010f214
ci(json): Improve requirement checking (#10554)
* ci(json): Change requirements for sketches that use WiFi

* ci(checks): Optimize requirement checking

* fix(tests): Additional checks before running tests

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-11-06 18:08:16 +02:00
Me No Dev
adcbc2ab59
Merge branch 'master' into release/v3.1.x 2024-11-06 11:41:17 +02:00
Jan Procházka
d1df696cd0
feat(Zigbee): Support for sleepy device + Power Source and battery level + Humidity sensor cluster (#10551)
* feat(zigbee): Add power source and battery level

* fix(zigbee): Make sure Indentify callback in not null

* fix(zigbee): Remove leftovers and use workaround for mac capabilities

* feat(zigbee) Add humidity optional cluster + fixes

* feat(zigbee): Add common Zigbee.h header file

* fix(zigbee): remove leftover code

* ci(pre-commit): Apply automatic fixes

* fix(zigbee): Fix codespell issues

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-06 11:40:31 +02:00
Me No Dev
3dad918cea
Merge branch 'master' into release/v3.1.x 2024-11-06 01:02:54 +02:00
Lucas Saavedra Vaz
501f8a9a4e
fix(esptool): Bump esptool version to 4.9.dev1 on 3.1.x (#10570) 2024-11-06 01:01:11 +02:00
Rodrigo Garcia
69825a99f9
feat(Matter): New Matter Endpoint - Dimmable Light (#10543)
* feat(matter): source code folder organization

* feat(matter): new matter endpoint dimmable light

* feat(matter): dimmable friend class and adjusts log levels

* feat(matter): adds new folder and source code to cmakelists.txt

* fix(matter): identation in cmakelists.txt

* feat(matter): adds license disclaimer to all source code

* feat(matter): example code simplification

* feat(matter): make it work with rgb and analog led

* feat(matter): single user callback based on lambda function

* feat(matter): commentaries and code improvement. update() and callbacks added.

* feat(matter): adde new keywords to arduino settings

* feat(matter): example code adjustment to use improved api

* fix(matter): it shuold work even when no callback is set

* feat(matter): matter.h includes all possible endpoint header files

* feat(matter): adjusts all examples to only include matter.h

* fix(matter): double declaration of ret - var scope issue

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-06 00:59:27 +02:00
s-hadinger
a80b03e017
fix(IPaddress): IPv6 restore zone id (#10546)
* IPv6 restore zone id

This PR restores the IPv6 zone-id in String representation of IPv6 address as well as parsing. This follows 20a28b58bc that disabled it due to a crash in `netif_index_to_name()`.

The fixed code scans through `netif_list` to find the `netif` name and id.

Note: zone-id are incremented by 1 compared to `netif` id.

For example internal zoneid value `3` actually translates to `%st2`

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-06 00:58:30 +02:00
Lucas Saavedra Vaz
b170e87d41
fix(wokwi): Delete generated diagram to avoid issues running locally (#10567) 2024-11-06 00:57:19 +02:00
github-actions[bot]
de93e6e176 change(tools): Push generated binaries to PR 2024-11-04 22:45:41 +00:00
Lucas Saavedra Vaz
f1e1f5ab95
Merge branch 'master' into release/v3.1.x 2024-11-04 19:43:44 -03:00
Lucas Saavedra Vaz
11f3cff53f
fix(get.py): Check if win32 tools also exist when running on win64 (#10565)
* fix(get.py): Check if win32 tools also exist when running on win64

* change(tools): Push generated binaries to PR

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-04 23:49:40 +02:00
ASDosjani
870468bb25
Update BLE5_periodic_advertising.ino (#10538) 2024-11-04 23:43:07 +02:00
wurongmin
57d0deef2d
feat(boards): add Waveshare ESP32-S3-Touch-AMOLED boards (#10549)
* Add files via upload

* Add files via upload

* feat(boards): add Waveshare ESP32-S3-Touch-AMOLED boards

Added three micro snow development boards to boards

* feat(boards): add Waveshare ESP32-S3-Touch-AMOLED variants

A trio of micro-snow variants have been added to the variants

* Delete variants/waveshare_esp32_s3_touch_amoled_143/pins_arduino.h

* Delete variants/waveshare_esp32_s3_touch_amoled_164 directory

* Delete variants/waveshare_esp32_s3_touch_amoled_191 directory

* feat(boards): Three variants of the development board were added

waveshare_esp32_s3_touch_amoled_143 waveshare_esp32_s3_touch_amoled_164 waveshare_esp32_s3_touch_amoled_191

* feat(boards): Add three boards to boards

* feat(boards): Add the variants

* feat(boards): Fixed the boards file

To ensure that each plate type only one

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-11-04 23:42:19 +02:00
Lucas Saavedra Vaz
eeecf844a7
ci(workflows): General improvements and fixes (#10544)
* ci(triggers): Improve workflow triggering and bump versions

* ci(runtime): Improve runtime tests triggers

* fix(push): Fix push chunks script indentation and lib detection
2024-11-04 23:12:20 +02:00
Lucas Saavedra Vaz
05102fe853
docs(lib-builder): Improve UI and Docker image sections (#10535)
* docs(lib-builder): Improve UI and Docker image sections

* docs(lib-builder): Apply review suggestions
2024-10-31 13:13:08 +02:00
Mathieu Carbou
d47771f2cc
fix(sntp): Lock / Unlock LWIP if CONFIG_LWIP_TCPIP_CORE_LOCKING is set (#10529)
* fix(sntp): Lock / Unlock LWIP if CONFIG_LWIP_TCPIP_CORE_LOCKING is set
Fixes: https://github.com/espressif/arduino-esp32/issues/10526

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-29 13:10:40 +02:00
Me No Dev
87ad78d787
fix(bm): Board Manager install will fail on Windows (#10533)
* fix(bm): Board Manager install will fail on Windows

On some Windows installations, Board Manager will fail to install the RC2 core, because it could not find esptool for the given OS.

* fix(package): EspTool for Mac is only ARM64 version

cc: @lucasssvaz
2024-10-29 13:10:20 +02:00
Me No Dev
804ee12741
Merge branch 'master' into release/v3.1.x 2024-10-25 20:49:26 +03:00
Lucas Saavedra Vaz
a805e0696c
feat(esptool): Update esptool to v4.8.1 (#10524)
* feat(esptool): Update esptool to v4.8.1

* fix(archives): Fix checksums
2024-10-25 20:49:05 +03:00
Rodrigo Garcia
74e4a744ce
feat(uart): uart break example improvement (#10525)
prints the HEXA and CHAR in order to allow the user to see why there is 1 extra char (0x00) when BREAK is received.
2024-10-25 20:48:35 +03:00
Rodrigo Garcia
9aeb1ba548
ESP32-P4 UART Pin Definitions (#10521)
* feat(uart): allow pins_arduino.h to define esp32-p4 uart pins

ESP32-P4 has UART default pins only for UART0 and UART1.
This PR allows the board definition from pins_arduino.h to define RX2 ... RX4 and TX2 ... TX4 if necessary.
It also solves the issue of begin(baud) with no pins for UART2...4 by just sending a error message and returning.

* feat(uart): removes the uart2 pin definitions - not existant

* fix(uart): solves the case when uart has already been initialized

* ci(pre-commit): Apply automatic fixes

* fix(ci): uart definition for esp32-p4 uart2 rx,tx pins

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-25 15:07:37 +03:00
Me No Dev
38a4c29fed
feature(rtos): Add Tasks status print function (#10515)
* feature(rtos): Add Tasks status print function

* fix(cmake): Add the new cpp file to CMakeLists

* fix(stats): Adjust size of Load column

* fix(format): Fix print of runtime formatting

* fix(stats): Add license, usage note and C++ guards

* fix(stats): Fix formatting and variable names

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-25 14:57:21 +03:00
Me No Dev
9ac705e5f2
IDF release/v5.3 a0f798cf (#10522) 2024-10-25 14:53:35 +03:00
Lucas Saavedra Vaz
a3ee37669e
Update readme 2024-10-24 10:56:45 -03:00
Me No Dev
9fd1bf362f
Merge branch 'master' into release/v3.1.x 2024-10-24 15:16:58 +03:00
vortigont
07c510e3ad
fix (NetworkEvents lib) remove checks for duplicated event handlers (#10376)
* lib Network: add cpp syntax to structs

* [Network] deprecate NetworkEvents::removeEvent() for std::function callbacks

removing event callback via std::function pointer does not work as expected for lambdas (issue #10365)
here mark NetworkEvents::removeEvent(NetworkEventFuncCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX)
as deprecated in favor of removing by callback's id

for NetworkEvents::onEvent remove checking for dublicate event handler, this does not work for lambdas too

remove NetworkEvents::find methods as unnecessary

move cbEventList container inside the class

declare NetworkEventCbList_t as a cpp struct with constructor, allows using std::vector.emplace() when adding new items to container

optimize NetworkEvents::remove() calls to use erase-remove idiom for std::vector

* [Network] hide event task under private member of NetworkEvents class

prevent checkForEvent loop to be callable from outside the task's thread

* refactor(NetworkEvents) code polishing and comments

- rename NetworkEvents::cbEventList as private member NetworkEvents_cbEventList
- NetworkEvents::getStatusBits() add const qualifier
- turn statics into constexpr
- add indexes to enum::arduino_event_id_t to make events indexing consistent for SOCs with/without WiFi
  also leave some index gaps to minimize renumbering on adding new events
- add doxygen help to NetworkEvents:: methods
- declare NetworkEvents::eventName() as static, that could be used without creating class scope
- potential mem leak in postEvent

* refactor(NetworkEvents) add (optional) mutex lock for container operations

provide thread safety for dual core SoCs
since std::mutex brings additional componetns of libstdc++ lib it impacts resulting image size significantly (around 50k)
Might be enabled on-demand if thread-safety is required

* ci(pre-commit): Apply automatic fixes

* fix(spelling): Fix spelling mistakes

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-10-24 15:15:13 +03:00
zinkett
330beb40a5
Update lib - User can choose if calc MD5 from encrypted or decrypted file (#10510)
* User can choose if calc MD5 from decrypted file

At the present moment, if user want use OTA, the function calculate MD5 of the decrypted file, but if file is encrypted from source, could be more useful to know the MD5 of the encrypted file.

* md5

* Update Updater.cpp

* Update libraries/Update/src/Update.h

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* Update libraries/Update/src/Update.h

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* Update libraries/Update/src/Updater.cpp

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* Update libraries/Update/src/Updater.cpp

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-24 14:31:54 +03:00
Me No Dev
6dfd958983
fix(eth): Set default clock in pin value to zero (#10513)
When Arduino is used as component, `CONFIG_ETH_RMII_CLK_IN_GPIO` might not be defined, so we set it to const `0` to clear the issue.
2024-10-24 00:46:01 +03:00
Thomas Weller
cb83cda06a
Fix comments for AD types in advertising (#10512) 2024-10-23 20:39:12 +03:00
Me No Dev
35549272b3
Merge branch 'master' into release/v3.1.x 2024-10-23 15:31:08 +03:00
Me No Dev
6e88445ba9
fix(i2s): Use separate variables when reading and writing (#10509) 2024-10-23 15:30:30 +03:00
二九
3502b9c7a9
Add multiple boards of the Waveshare ESP32-S3-Touch-LCD-1.46 type (#10482)
* Delete boards.txt

Delete old files

* Add files via upload

Add new board

* Add files via upload

Add new board

* Delete boards.txt

Delete old files, modify the definition of the case error

* Add files via upload

Modify the definition of the case error

* ci(pre-commit): Apply automatic fixes

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-10-23 15:16:12 +03:00
Jan Procházka
bcc357c0ca
fix(ci): Boards test set fail-fast to false (#10508) 2024-10-23 11:47:50 +03:00
Ludovic BOUÉ
1756bd567c
fix(zigbee): Enable internal pull-up resistor (#10491)
Enable the internal pull-up resistor for BUTTON_PIN
2024-10-23 11:46:04 +03:00
Lucas Saavedra Vaz
a0139bc37d
fix(tests): Add missing files to compilation tests (#10501)
* fix(tests): Add CMakeLists file to compilation tests

* fix(tests): Add variant files that are used in compilation

* fix(c2): Move C2 as it is only tested as component

---------

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2024-10-23 11:45:30 +03:00
Jan Procházka
0f5219df0e
fix(ci): Get correct file for the diff (#10507) 2024-10-23 10:24:36 +03:00
Me No Dev
dc1a49e6f0
IDF release/v5.3 (#10503)
* fix(psram): Do not disable PSRAM when used as component

Information: https://github.com/espressif/arduino-esp32/issues/10500

* IDF release/v5.3 59550599
2024-10-23 02:04:03 +03:00
Me No Dev
4285912a46
fix(cmake): Use proper name for LittleFS component 2024-10-22 20:40:15 +03:00
clashman
4944dd0df3
fix(littlefs): Add missing dependency (#10496) 2024-10-22 20:22:15 +03:00
Me No Dev
0eee5c4a13
fix(arduino): Move extra_flags to flags (#10493)
This will help external library developers
2024-10-22 20:17:40 +03:00
Me No Dev
aefe8a55d3
IDF release/v5.3 59550599 (#10498) 2024-10-22 17:40:11 +03:00
me-no-dev
1631466426 fix(build): Update required components and menu 2024-10-22 15:55:37 +03:00
me-no-dev
774201ade3 fix(build): Require main component to include all components 2024-10-22 15:19:24 +03:00
me-no-dev
20a28b58bc fix(net): Do not use netif_index_to_name
Causes error on recent IDF builds
2024-10-22 12:13:04 +03:00
Rodrigo Garcia
8ac076c44c
fix(matter): empty line removing - style 2024-10-21 19:26:34 -03:00
Rodrigo Garcia
7a33a9eeff
fix(matter): change the place of wifi credentials in the code 2024-10-21 19:25:20 -03:00
Rodrigo Garcia
0045cfa658
fix(matter): change place of wifi credentials in code 2024-10-21 19:23:28 -03:00
Jan Procházka
e509d33d27
fix(ci): Chnage approach in listing the changed boards (#10495) 2024-10-22 00:56:18 +03:00
Rodrigo Garcia
f1f0e4d4f3
Update MatterOnOffLight.ino 2024-10-21 14:43:54 -03:00
Lucas Saavedra Vaz
01789a7a89
fix(formatting): Fix formatting and disable JSON hook (#10492) 2024-10-21 18:29:05 +03:00
Rodrigo Garcia
c40444ab33
feat(matter): initial commit with arduino matter lib (#10467)
* feat(matter): initial commit with arduino matter lib

* feat(matter): add matter library to cmakelists.txt

* fix(matter): add correct guard for ci

* fix(matter): using correct ci requirements in ci.json

* fix(matter): using correct ci requirements in header files

* fix(matter): using correct ci requirements header and examples

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(commentary): longer explanation

* feat(matter): api simplification with begin

* feat(matter): testing flashmode=qio in CI

* feat(matter): testing flashmode=qio in CI

* fix(matter): changes CI FQBN

* fix(matte): include all fqbn in ci.json using qio

* fix(matter): revert ci and guard changes

* fix(matter): typo and commentaties

* feat(matter): adds a light toggle switch button

* feat(matter): improved the button control

* feat(matter): using switch instead of if() for attibute change

* fix(matter): switch/case scope

* fix(matter): problems found after pressing reset

* feat(matter): improve example using preferences

* fix(pre-commit): Fix and apply pre-commit hooks

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-10-21 16:42:43 +03:00
Lucas Saavedra Vaz
f668557b54
Enable tests for ESP32P4 2024-10-21 10:22:02 -03:00
Lucas Saavedra Vaz
03bfa52d49
Merge branch 'master' into release/v3.1.x 2024-10-21 10:20:31 -03:00
Lucas Saavedra Vaz
9e643c08a7
fix(testing): Checkout proper branch for Wokwi tests and small QoL improvements (#10435)
* fix(tests): Add missing newlines to output

* fix(tests): Improve fibonacci test

* fix(tests): Remove redundant targets from json

* fix(wokwi): Checkout proper base branch for wokwi tests

* feat(logging): Add logging to some tests to improve debugging

* fix(ci): Make CI more permissive and improve messages

* fix(tests): Bump pytest-embedded version to support P4
2024-10-21 15:45:59 +03:00
Jan Procházka
83d35683c3
feat(sdmmc): Add SDMMC support for P4 + remove BUILTIN LED (#10460)
* feat(sdmmc): Add support for P4

* fix(board): Remove builtin led

* Update libraries/SD_MMC/examples/SDMMC_Test/SDMMC_Test.ino

Add missing note about power pin for P4

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* ci(pre-commit): Apply automatic fixes

* feat(sdmmc): Option to set power channel

* feat(sdmmc): Update pins_arduino.h

* feat(sdmmc): remove sdmmc power from periman

* fix(sdmmc): use corrent variable

* fix(sdmmc): Remove periman

* feat(sdmmc): Toggle power pin if defined

* feat(sdmmc): setPowerChannel available only when supported

* feat(sdmmc): Toggle sd power pin for 200ms

* fix(example): Remove p4 pins as they are listed already

* feat(sdmmc): Check if power channel is specified

* ci(pre-commit): Apply automatic fixes

* fix(ci): codespell fix

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-21 15:03:44 +03:00
Jan Procházka
7cfe470d8d
feat(touch): Support NG touch driver for P4 (#10448)
* feat(touch): Support NG touch driver for P4

* fix(ci): Touch test + IDF compilation fixes

* fix(ci): remove debug prints from touch test

* fix(ci): Fix touch test for esp32

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-21 13:29:01 +03:00
Me No Dev
a7d9b670a8
Add missing versions to ISSUE_REPORT
Versions 3.0.5 and 3.0.6 were added
2024-10-21 11:56:01 +03:00
Lucas Saavedra Vaz
4ca635a3b6
ci(json): Add requires_any field and use QIO by default to match IDE (#10472)
* ci(FQBN): Use QIO as default as DIO can be used on demand now

* fix(indentation): Fix default indentation for bash files

* fix(compilation): Make errors appear on CI fail

* ci(json): Add requires_any field to JSON and fix comparison
2024-10-19 12:00:48 +03:00
Me No Dev
59ca4e2d3d
Merge branch 'master' into release/v3.1.x 2024-10-18 20:32:08 +03:00
Lucas Saavedra Vaz
064d1c4d97
fix(build): Fix sdkconfig copy for Arduino CLI (#10484) 2024-10-18 20:29:14 +03:00
Me No Dev
edb4ee13d2
IDF release/v5.3 707d097b (#10480) 2024-10-17 19:46:14 +03:00
Lucas Saavedra Vaz
8570b3d270
Fix formatting in ETH and USB 2024-10-17 10:21:08 -03:00
me-no-dev
9e48d9f238 fix(spi): Fix P4 SPI Pin definitions
Use GPIOs 36 or lower to avoid LDO power issues
2024-10-17 16:13:59 +03:00
二九
ee8931d151
Add the Waveshare ESP32-S3-Touch-LCD-1.85 board (#10477)
* Delete boards.txt

Delete old files

* Add files via upload

Add the Waveshare ESP32-S3-Touch-LCD-1.85 board

* Add files via upload

Add the Waveshare ESP32-S3-Touch-LCD-1.85 board

* Update pins_arduino.h

Modify the pin definition

* Add files via upload

Add the Waveshare ESP32-S3-Touch-LCD-1.85 board

* Update pins_arduino.h

Modify the pin definition

* feat(board): Add waweshare s3 rouch lcd 185

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-17 14:31:46 +03:00
Me No Dev
ee1bc6ba0a
Add RMII Ethernet support for ESP32-P4 (#10479)
* fix(eth): Add ETH support for ESP32-P4

Also adds configuration to pins_arduino.h

* fix(eth): Enable TLK110 Example on P4

* fix(eth): Fix Ethernet examples

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-17 14:30:48 +03:00
me-no-dev
612fc4c4bb fix(pins): Adjust P4 SPI pins to ones that are available 2024-10-17 12:12:44 +03:00
Jan Procházka
955b277497
fix(example): print correct fade direction (#10450)
* fix(example): print correct fade direction

* fix(example): Change to fade in out

* fix(example): Codespell fix
2024-10-17 10:43:47 +03:00
Dogus Cendek
51b2fb356d
Add our new board "cezerio dev ESP32C6" (#10462)
* Add cezerio dev ESP32-C6

* Modify pin number of cezerio dev ESP32C6

Modify pin number of cezerio dev ESP32C6

* Update boards.txt

* Update USB_PID

Update USB_PID

* Update boards.txt

Deleted flash and partition options related in flash size bigger than 4MB

* Update pins_arduino.h

* Merge manually to solve conflicts

* Resolve Conflicts

* Add cezerio dev ESP32-C6

* Modify pin number of cezerio dev ESP32C6

Modify pin number of cezerio dev ESP32C6

* Update boards.txt

* Update USB_PID

Update USB_PID

* Update pins_arduino.h

* Add cezerio dev ESP32C6

* Update pins_arduino.h

* Update pins_arduino.h

* Update pins_arduino.h
2024-10-17 10:43:21 +03:00
Max
7849a79435
Add IOXESP32-C6 and ATD3.5-S3 board (#10471)
Co-authored-by: Max <7087907+maxpromer@users.noreply.github.com>
2024-10-17 02:44:47 +03:00
ws-hsw
bda8fcb457
addition(3rd_party_board): Add Waveshare-S3-touch-lcd (#10434)
* add waveshare_touch_lcd

* waveshare_touch_lcd

* waveshare_touch_lcd

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-17 02:39:23 +03:00
Me No Dev
9dea05b17f
IDF release/v5.3 707d097b (#10473) 2024-10-17 02:38:25 +03:00
me-no-dev
c676ce7dc0 fix(p4): Move ESP-HOSTED init to WiFiGeneric
@P-R-O-C-H-Y will add the configured pins to periman, so that they can not be assigned to anything else
2024-10-15 21:06:31 +03:00
me-no-dev
f706c27671 Update TinyUSB init method 2024-10-15 20:42:26 +03:00
Me No Dev
592c994817
Merge branch 'master' into release/v3.1.x 2024-10-15 20:21:22 +03:00
Me No Dev
a3f2568a19
IDF release/v5.3 (#10465)
* fix(usb): Update tinyusb init call

* Update esp-insights version (#10456)

* Add support for WiFi to ESP32-P4 (#10463)

* feat(p4): Add support for WiFi to ESP32-P4

Implements support for external MCU connected through SDIO

* fix(p4): Init SDIO host properly on Network boot

esp-hosted has one function marked as "constructor" that did not run in the boot phase of the chip. This calls the function when network is started

* Fix RainMaker dependent versions because Matter requires Insights 1.0.1

* IDF release/v5.3 707d097b

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Mahesh Tupe <tupemahesh91@gmail.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-15 20:20:04 +03:00
Mahesh Tupe
c6bf1b4816 Update esp-insights version (#10456) 2024-10-15 18:07:10 +03:00
Mahesh Tupe
f8e03cfaac
Update esp-insights version (#10456) 2024-10-15 18:06:20 +03:00
Me No Dev
3edf518825
Add support for WiFi to ESP32-P4 (#10463)
* feat(p4): Add support for WiFi to ESP32-P4

Implements support for external MCU connected through SDIO

* fix(p4): Init SDIO host properly on Network boot

esp-hosted has one function marked as "constructor" that did not run in the boot phase of the chip. This calls the function when network is started
2024-10-15 17:25:45 +03:00
Y_hsiao_ch'un
e27a050f5a
Added variant for Waveshare ESP32-S3-Touch-AMOLED-1.8 (#10433) 2024-10-11 16:35:58 +03:00
Jason2866
3733c87c83
replace outdated wrong SOC_I2C_NUM and use SOC_HP_I2C_NUM (#10452)
* SOC_HP_I2C_NUM

* SOC_HP_I2C_NUM
2024-10-11 16:33:49 +03:00
Lucas Saavedra Vaz
81d2cbca96
fix(uart): Add missing HP UARTs for ESP32-P4 (#10447)
* fix(uart): Add missing HP UARTs for ESP32-P4

* fix(comment): Fix macro in comment

* fix(uart): Fix macro guard
2024-10-10 14:27:04 -03:00
Me No Dev
774f2756f1
Merge branch 'master' into release/v3.1.x 2024-10-10 18:38:27 +03:00
Me No Dev
af4099202d
IDF release/v5.3 (#10444)
* IDF release/v5.3 707d097b

* fix(camera): Remove support for face detection and recognition
2024-10-10 17:22:39 +03:00
Hamza Hajeir
f083e2df8d
fix(asyncudp): Fixes and implements tcpip thread locking (#10415)
* fix(asyncudp): Fixes and implements tcpip thread locking

* fix(asyncudp): Adds missing unlock

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-07 19:15:42 +03:00
Rodrigo Garcia
ba9a3a1dbd
fix(arduino): adds ESP32-P4 to the package description (#10426)
* fix(arduino): adds ESP32-P4 to the package description

Updates the Package description to add the P4 in 3.1.0

* fix(arduino): update readme title to add the P4

Adds ESP32-P$ to the list of supported SoC in README.md for Core 3.1.0
2024-10-07 16:58:41 +03:00
Lucas Saavedra Vaz
3445164e2d
test(psram): Add PSRAM test (#10409)
* test(psram): Add PSRAM test

* fix(test): Hide pointer arithmetic warning

* ci(pre-commit): Apply automatic fixes

* fix(json): Remove FQBNs for the test

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-07 15:56:41 +03:00
Rodrigo Garcia
0d5d50eb41
feat(uart): eliminates nonexistent functions (#10428)
loop() calls Serial Events functions when those are declared. The way it was declared was forcing to alway call avalable() to then call an empty function. This commit fixes it.
2024-10-07 15:56:04 +03:00
Lucas Saavedra Vaz
4d1c9bcfa3
Fix partitions for examples 2024-10-07 09:54:13 -03:00
Bharat Pi
630377f7d3
feat(Variants): Add Arduino libraries for Lora 4G Module and Node Wifi o… (#10402)
* feat(esp32): Added support for BharatPi 4G, LoRa & NodeWifi Boards

* fix(variant): Fixed review comments for SPI and I2C Pins

* fix(variant): Fixed review comments and Lora build fix

* fix(variant): Fixed review comments for board name

* fix(review): Fixed review comment for CI

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-07 13:43:51 +03:00
Lucas Saavedra Vaz
765173372f
Add P4 to chip info 2024-10-04 11:33:27 -03:00
Lucas Saavedra Vaz
e12e33c581
Merge branch 'master' into release/v3.1.x 2024-10-04 11:14:57 -03:00
Lucas Saavedra Vaz
8ce5f775fe
ci(compilation): Use default partition and add append to FQBN option (#10392)
* ci(partitions): Use default partition for compilation in CI

* fix(ci): Fix paths for sdkconfig

* Fix build of camera web server

* fix(ci): Fix test requirements check

* ci(append): Add option to append to all FQBNs

* fix(json): Fix JSON files to compile examples

* fix(example): Use requires instead of target in ci.json

fix(zigbee): Improve JSON files

Co-authored-by: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* fix(regex): Trim argument before grep

* docs(ci): Add documentation about FQBNs in CI

* fix(json): Remove redundant FQBNs

* fix(json): Skip requirements if libs are not installed

* fix(partitions): Use rainmaker specific partitions

---------

Co-authored-by: me-no-dev <hristo@espressif.com>
Co-authored-by: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-10-04 16:57:08 +03:00
Jan Procházka
5fd7826d9f
fix(boards): Remove partition scheme from FlashSize (#10400) 2024-10-04 13:52:07 +03:00
Lucas Saavedra Vaz
13511a6b65
ci(tests): Add linpack FPU tests (#10389)
* ci(tests): Add linpack FPU tests

* fix(linpack): Change prints to log_d

* fix(linpack): Fix number of runs check

* ci(pre-commit): Apply automatic fixes

* fix(spelling): Correct spelling mistakes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-04 13:51:47 +03:00
sivar2311
5d873c0787
Add conditional compilation for second I2C interface based on SOC_I2C_NUM (#10408)
The ESP32, ESP32-S and ESP32-H series have two I2C interfaces, while the ESP32-C series has only one.
2024-10-04 13:49:55 +03:00
Me No Dev
6d6a8f8d32
IDF release/v5.3 707d097b (#10416) 2024-10-03 16:35:39 +03:00
me-no-dev
341dc18079 fix(usb): Add support for HighSpeed USB
This commit adds support for HighSpeed USB as present on ESP32-P4
2024-10-03 13:47:24 +03:00
Rodrigo Garcia
733373a049
Update FreeRTOS Symbols in OThreadCLI (#10412)
* Update OThreadCLI.cpp

* feat(openthread): change FreeRTOS names and types

* feat(openthread): change FreeRTOS names and types

QueueHandle_t instead of xQueueHandle
2024-10-03 09:37:44 +03:00
Me No Dev
157b4c8643
IDF release/v5.3 (#10403)
IDF release/v5.3 707d097b
2024-10-02 22:26:26 +03:00
Me No Dev
6c99740374
Merge branch 'master' into release/v3.1.x 2024-10-02 22:21:05 +03:00
Me No Dev
ea50cf6f5f
fix(spiram): Fix OPI PSRAM init (#10406) 2024-10-02 22:18:17 +03:00
me-no-dev
01b256ca1c fix(usb): Enable TinyUSB mode for ESP32-P4 2024-10-02 22:15:40 +03:00
me-no-dev
c3aa74f60a fix(spiram): Fix OPI PSRAM init 2024-10-02 19:42:32 +03:00
Jan Procházka
c5047286a1 fix(example): Use requires instead of target in ci.json 2024-10-02 18:40:04 +02:00
Jan Procházka
b067cd6d7f fix(example): Skip zigbee build for P4 2024-10-02 17:25:15 +02:00
me-no-dev
264c858830 Merge branch 'master' into release/v3.1.x 2024-10-02 17:07:42 +03:00
Jan Procházka
473b8515ac
feat(zigbee): Add Zigbee library (#10265)
* Initial commit - light bulb + switch working

* Add Thermostat + fix enum

* Dev update: roles, cb removal, handlers

Fixed ep_thermostat to compile successfully
Removed cb from all EP, as it have been removed, virtual methods will be used instead.
Moved zigbee handlers out of Zigbee_core to Zigbee_handlers for better readability.
Fixed zigbeeInit to be bool and return status of initialization for begin function.
Updated examples with edited roles and custom method for on_off light

* Dev update: implement on/off light and switch methods

Implemented basic function calls of switch commands to on/off light:
  lightToggle, lightOn, lightOff, ...
Implemented virtual methods for on/off light that have to be override in user code:
  setOnOff, sceneControl, setOnOffTime, setOffWaitTime
APIs can be changed, still early development.

* Dev update: Factory reset, names, multiple EPs

Implemented Factory reset of Zigbee device, in order to connect to new network without reflashing/erasing flash
Implemented optional setting for Manufacturer and Model names
Added option to allow endpoint to have multiple endpoint connected -> switch - 2 lights (tested)
Minor sketches update

* Dev update: Device ID to string

Implemented easy transfer from device it to Device type (0x0000 = ESP_ZB_HA_ON_OFF_SWITCH_DEVICE_ID  -> "General On/Off switch".

* Implement cmd default response handler

* Remove unused _identify_cluster

* Dev Update: Color DImmable light + switch implemented

Implemeted color dimmable light and color dimmer switch HA devices + examples.
Removed unnecessary stored attribute cluster
Renamed on/off light and switch examples

* Implement Network Scanning

Implemented Zigbee network scanning (async) to mostly match WiFi scan APIs.
Added Zigbee_Scan_Networks example

* Dev Update: Thermostat and Temperature sensor EP

Implemeted thermostat and temperature sensor HA devices + examples.
Implemented configure report handler.
Updated READMEs and description of examples.
Minor code updates

* fix(): Replace deprecated function

* Remove ported IDF examples

* Update Zigbee examples with new APIs

* Dev Update: Version setting, Thermostat fix, ...

Simplified bounded device print as the structure is common for any EP type
Allowed setting custom app version for EP, default is 0
Small fixes and code updates

* Remove EP template + add lib to CMakeLists

* Rename classes to have proper naming

* Add check for SOC_IEEE802154_SUPPORTED

* Ignore false positive unused variable/function

* Fix compilation errors in examples

* Fill keyworkds.txt, remove unnecessary defines

* Rename methods, variables + make private/protected

* Remove unnecesary defaults defines

* Remove outdated comments

* Update Scan networks Readme

* fix(example): Use proper naming of func and variables

* Change virtual methods to callbacks (TODO)

* Refactor classes methods + implement Identify command

* Apply suggestions from code review by @lucasssvaz

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* Update READMEs + add openNetwork fucntion

* Use [[maybe_unused]] instead of #pragma

* Use gpio calls for OnOff Light example

* ci(pre-commit): Apply automatic fixes

* fix(): Codespell issues

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-10-02 17:00:39 +03:00
me-no-dev
58c0bbc0e9 fix(usb): Add support for ESP32-P4 to esp32-hal-tinyusb 2024-10-02 16:17:12 +03:00
Rodrigo Garcia
19f611d7ee fix(5.1): ESP32 redefinition to ESP32 2024-10-02 15:44:06 +03:00
me-no-dev
8af91fb4a7 Fix build of camera web server 2024-10-02 15:38:57 +03:00
Me No Dev
e3499bc4b7
Merge branch 'master' into release/v3.1.x 2024-10-02 15:36:56 +03:00
Me No Dev
2ec5584d06
fix(hid): Fix OUTPUT report not received (#10398)
Fixes an issue where the keyboard LEDs will not trigger the proper event
2024-10-02 15:34:27 +03:00
Me No Dev
cd971319cb
Fix WPS example config initialization (#10399)
* fix(wps): fixes wps struct initialization

C99 complaint

* fix(wps): adds memset to 0

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2024-10-02 15:26:32 +03:00
Me No Dev
0db5beffff
Merge branch 'master' into release/v3.1.x 2024-10-01 16:37:04 +03:00
Me No Dev
84ddf0ad28
fix(psram): Do not abort if PSRAM is not found (#10395)
Also add to heap in app_main
2024-10-01 16:34:41 +03:00
me-no-dev
753e2032e7 fix(psram): ESP32-S2 does not like to early debug log 2024-10-01 16:12:13 +03:00
me-no-dev
482c0a3c26 fix(psram): Do not abort if PSRAM is not found
Also add to heap in app_main
2024-10-01 15:45:09 +03:00
me-no-dev
c980fdc996 Update early system init function declaration 2024-10-01 12:34:44 +03:00
Me No Dev
a5a5809eec
Merge branch 'master' into release/v3.1.x 2024-10-01 12:12:04 +03:00
Me No Dev
5a06dd9e57
fix(psram): Init PSRAM before app_main to fix mmu_map (#10390)
* fix(psram): Init PSRAM before app_main to fix mmu_map

Makes sure that PSRAM is part of the map before app_main is called.

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-10-01 12:11:21 +03:00
Luca Burelli
a4cbdaf3a8
fix(HardwareSerial): fix pin remapping in begin() (#10379)
The pin remapping functions have to be called as early as possible in
the begin() function, to immediately convert the input parameters to the
GPIO numbers used everywhere in the core.

This issue has always been dormant since the introduction of pin
remapping in 2.x via 9b4622d, but was exposed by the proper pin muxing
support that is present in the 3.x core.

Move the pin remapping function calls earlier in the begin() function to
fix this issue.
2024-10-01 12:11:03 +03:00
Lucas Saavedra Vaz
a76b22881a
Fix ethernet examples JSON for P4 2024-09-30 19:21:46 -03:00
Lucas Saavedra Vaz
8422b745c2
Fix touch examples JSON for P4 2024-09-30 09:27:10 -03:00
Lucas Saavedra Vaz
69351312e5
Merge branch 'master' into release/v3.1.x 2024-09-30 09:13:12 -03:00
Lucas Saavedra Vaz
e403f0b481
ci(json): Add configuration requirements to ci.json files (#10385)
* ci(json): Add support for checking sdkconfig before running tests

* docs(ci): Add explanation about requires field in JSON

* fix(json): Ignore comments when searching requirements

* feat(json): Add extended regex support to requires field

* change(json): Move to using requirements in JSON

* fix(json): Fix requirements for touch tests

* refactor(json): Fix formatting of JSON files

* fix(spi): Fix SPI example and JSON
2024-09-30 13:43:50 +03:00
Guil-T
1f1de2738b
Added Sparkfun ESP32-S3 Thing Plus board (#10382)
* Create pins_arduino.h

* added board Sparkfun ESP32-S3 Thing Plus

added board Sparkfun ESP32-S3 Thing Plus

* readded last line of hashes in boards.txt

* Update pins_arduino.h

re-added SS pin to pass test

* removed unapplicable flash configurations the sparkfun esp32-s3 thing plus

* added sparkfun esp32-s3 thing plus

removed commented code

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-30 13:14:30 +03:00
Me No Dev
7a0138462d
Merge branch 'master' into release/v3.1.x 2024-09-26 01:37:46 +03:00
vortigont
b05f18dad5
fix: DNSServer Lib - improper startup code in WiFi mode (#10366)
* DNSServer: fix improper startup code in WiFi mode

When running on WiFi-AP mode server's start() method returned true while in fact UDP listening socket was never created
Regression introduced in #8760
Closes #10330

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-26 01:37:00 +03:00
Luca Burelli
55bd1d5ee2
digitalPinToInterrupt: fix double pin remapping (#10373)
The digitalPinToInterrupt() macro currently remaps the pin number to the
GPIO number. This is not necessary, as most users will then use the
returned value in attachInterrupt() or other similar API functions,
which already perform the same remapping.

The first half of the macro (the condition) does indeed require the
remapping to ensure the check operates on GPIO numbers.

Fixes espressif/arduino-esp32#10367.
2024-09-25 23:47:08 +03:00
Lucas Saavedra Vaz
4bb287eaf6
fix(esp32p4): Fix compilation errors (#10371)
* fix(esp32p4): Add missing touchpad definitions

* fix(esp32p4): Add missing target in SPI example

* fix(esp32p4): Start touch driver fix

* fix(esp32p4): Skip touch examples while it is not implemented

* fix(esp32p4): Add missing analog pin definitions

* refactor(formatting): Fix formatting that was broken in P4 PR

* fix(openthread): Add missing targets to skip

* fix(esp32p4): Skip ethernet sketches

* fix(esp32p4): Disable periman test while touch is not implemented

* fix(esp32p4): Disable touch test while touch is not implemented

* fix(esp32p4): Fix UART test

* fix(esp32p4): Skip Wi-Fi test

* fix(esp32): Skip unsupported example

* fix(esp32p4): Fix skip files

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-25 23:38:21 +03:00
me-no-dev
9398d52ddc Update package_esp32_index.template.json 2024-09-25 00:05:49 +03:00
github-actions[bot]
87c0e7763d change(tools): Push generated binaries to PR 2024-09-24 18:19:40 +00:00
Lucas Saavedra Vaz
a4c33e3897
feat(esp32p4): Add initial ESP32-P4 support (#10358)
* feat(esp32p4): Initial changes required for ESP32-P4

* esp32-p4: Initial changes to build with Arduino

Signed-off-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* fix(esp32p4): Fix lib builder errors

* change(esp32p4): Unhide board

* ci(esp32p4): Add ESP32-P4 to workflow

* change(esptool): Update esptool to 4.8.0

* fix(build): Fix redefinition errors

* fix(build): Remove old commands

* change(esptool): Remove unsupported 32-bit tools

* fix(get.py): Force exe generation

* Revert "fix(get.py): Force exe generation"

This reverts commit 979b16b3b19d02917ddccf0139c6913cca618714.

* fix(get.py): Fix system check

* change(tools): Push generated binaries to PR

* ci(esp32p4): Add missing ESP32-P4 entries

* fix(esp32p4): Add chip info

* fix(esp32p4): Fix build commands

* docs(esp32p4): Add missing references to P4

* fix(esp32p4): Fix clock sources definitions

* fix(esp32p4): Set CPU frequency to 360 MHz so it is stable in all chips

* refactor(esp32p4): Change preprocessor conditionals for maintainability

Co-authored-by: me-no-dev <hristo@espressif.com>

* fix(esp32p4): Add missing menu options

* fix(esp32p4): Mark as not in development json in readme

* fix(esp32p4): Add P4 to ci.json files

* ci(pre-commit): Apply automatic fixes

* fix(get.py): Remove unused include

* ci(pre-commit): Apply automatic fixes

* change(tools): Push generated binaries to PR

* ci(pre-commit): Apply automatic fixes

* fix(ci.json): Fix formatting

---------

Signed-off-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: Jason2866 <24528715+Jason2866@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: me-no-dev <hristo@espressif.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-24 21:18:28 +03:00
Ludovic BOUÉ
ae052f414a
Update Matter Light README.md (#10357)
* Update Matter Light README.md

Update Matter Light README.md

* fix(matter): information in the commentaries from SuGlider

* feat(matter): extended formating 

used the same formatting for the whole document and changed a few expresssions.

* fix(matter): missing option idf.py

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2024-09-24 18:26:34 +03:00
Me No Dev
67682088ca
IDF release/v5.3 (#10272)
* IDF release/v5.3 2c46030b

* IDF release/v5.3 cc3203dc

* IDF release/v5.3 4d0db704
2024-09-18 15:56:37 +03:00
me-no-dev
e68b1cca09 Merge branch 'master' into release/v3.1.x 2024-09-18 15:06:31 +03:00
me-no-dev
7018cd114d Update core version to 3.0.5 2024-09-18 14:54:00 +03:00
Me No Dev
ab951cf08a
IDF release/v5.1 (#10320)
* IDF release/v5.1 e026fd1f

* IDF release/v5.1 99775566

* IDF release/v5.1 8af42a08

* IDF release/v5.1 33fbade6

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-18 14:52:03 +03:00
Rodrigo Garcia
8d772d5e89
ESP Matter + Arduino as IDF Component Light example (#10290)
* feat(matter): partition file for matter

The declaration includes a partition for keys and SSL certificates.

* feat(matter): matter light source code

Adds necessary Matter + Arduino source code that will create a Matter compatible Light.

* feat(matter): adds sdkconfig  and CMake files

Adds target sdkconfig files and the CMakeLists.txt in orde to build the application using Arduino+Matter as IDF component

* fix(matter): wrong folder name

* feat(matter): include example into registry

* fix(matter): error with type in wrong place

A declaration was incorrect due to a typo error. Sintax was corrected by deleting `BuiltInLED`.

* feat(matter): add readme documentation

* feat(matter): remove soc with no wifi or no ble

* feat(matter): adjust all sdkconfig files

* feat(matter): improve code and led status

* feat(matter): add button and led gpio with kconfig

* fix(matter): remove commented lines

* fix(matter): remove commented lines

* feat(matter): added a 2.4GHz SSID note 

Both the ESP32 device and the Smartphone running the Matter APP shall be in the same WiFi Network in order to achieve a successful commissioning process.

* feat(matter): arduino managed comonent version

Preparing the Arduino Managed Component to use Core version 3.0.5 or higher.

* feat(matter): adds information about google

Goggle Home Assistant requires special configurtation in order to allow the Light to show up in the GHA APP.

* feat(matter): arduino component version

Set final Arduino Managed Component to 3.0.5 necessary because of -DESP32=ESP32, in order to compile the project.

* ci(pre-commit): Apply automatic fixes

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(typo): typo and commentaries

* fix(matter): spell check ignore for CI

* ci(pre-commit): Apply automatic fixes

* fix(matter): spell check ignore for CI

* fix(matter): spell check ignore for CI

* fix(matter): spell check ignore for CI

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-18 14:51:46 +03:00
wurongmin
462870df24
fix(variant): Rename waveshare esp32-s3 board. (#10355)
* feat(variants): modify the one I successfully merged earlier

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-18 11:20:36 +03:00
TD-er
100b3c67cf
Reduce copy of Strings in WebServer RequestHandler (#10345)
* Reduce copy of Strings in WebServer RequestHandler

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-18 11:20:19 +03:00
ClockeNessMnstr
c55f5aa506
change(esp_now_serial): No teardown on retry limit (#10293)
* change(ESP_NOW_Serial): No teardown on retry limit

After max retries is met once the ESP_NOW_Serial_Class performs "end()". 
This removes the peer from ESP_NOW. 
Further messages to and from ESP_NOW_Serial are not received or sent. 
Peer should stay in ESP_NOW to re-establish connection even with data loss. 
This change will "retry and drop" the data piece by piece instead of aborting the connection.

* feat(espnow): Add remove on fail parameter

* feat(espnow): By default keep the peer when sending fails

---------

Co-authored-by: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-09-17 14:58:01 +03:00
TD-er
e989445b62
Fix missing virtual declarations in Stream.h (#10348)
* Fix missing virtual declarations in Stream.h

Fixes some changes made in PR #10328

* Remove the virtual destructor as Print class has one

As pointed out by @JAndrassy
2024-09-17 11:54:48 +03:00
Lee Leahy
2f89026540
Fix(NetworkEvents): Don't skip event callbacks in NetworkEvents::remo… (#10337)
* Fix(NetworkEvents): Don't skip event callbacks in NetworkEvents::removeEvent

Fixes Issue 10318
Includes pull request 10321 that fixes 10316

This change:
* Adds code to find the event callbacks
* Issues error when duplicate callbacks insertion attempts are made
* Issues error when callbacks are not found during removal

* Fix(NetworkEvents): Don't skip event callbacks in NetworkEvents::removeEvent

Fixes Issue 10318
Includes pull request 10321 that fixes 10316

This change:
* Adds code to find the event callbacks
* Issues warning when duplicate callbacks insertion attempts are made
* Issues warning when callbacks are not found during removal

---------

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2024-09-16 12:28:26 +03:00
TD-er
3978870f9f
[WiFiScan] Allow allocation in _scanDone() to fail and prevent memory leak (#10335)
* [WiFiScan] Allow allocation to fail and prevent memory leak

When there are many AP's seen during a scan, the allocation of `_scanResult` may fail.
Thus add `(std::nothrow)` to the `new` call.

Also it is possible the array was still present before allocating a new one.

* [WiFiScan] Use nullptr instead of 0

As suggested by @me-no-dev
2024-09-16 12:26:43 +03:00
wurongmin
44a484475c
add waveshare_esp32_touch_amoled_241 (#10342)
* feat(variants): add waveshare_esp32_touch_amoled_241

* feat(boards variants): add waveshare_esp32_touch_amoled_241

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-16 12:26:21 +03:00
Lucas Saavedra Vaz
a7cec020df
Merge commit from fork 2024-09-15 20:15:24 -03:00
TD-er
9e60bbe4bc
[WebServer] Mark functions as const + reduce copy of strings (#10339)
* [WebServer] Mark functions as const + reduce copy of strings

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-13 11:39:54 +03:00
Rodrigo Garcia
ac0de431e7
fix(arduino): rain maker common version (#10338)
Fixes Arduino components for Windows 11 with IDF 5.1.4 when building Arduino as IDF component.
2024-09-13 11:30:38 +03:00
me-no-dev
8c25325e18 fix(webserver): OTHER_AUTH will leak memory 2024-09-13 11:10:12 +03:00
TD-er
8a87df3b95
NetworkClientRxBuffer::clear() may not always clear (#10288) (#10331)
Fixes: #10288
2024-09-13 10:50:06 +03:00
Me No Dev
648094c733
fix(api): Update Arduino Stream class (#10328)
* fix(api): Update Arduino Stream class

Upstream code contains some fixes

* Update Stream.h

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-13 10:49:49 +03:00
Me No Dev
eda6d21d87
fix(events): Fix crash in getStdFunctionAddress (#10321) 2024-09-13 10:49:28 +03:00
Me No Dev
855da422ba
Merge branch 'master' into release/v3.1.x 2024-09-11 15:18:38 +03:00
Lucas Saavedra Vaz
4e9eb35752
feat(pre-commit): Add JSON formatter to pre-commit hooks (#10324) 2024-09-11 15:18:03 +03:00
Jan Procházka
1e04762e3a
fix(example): Fix compilation warnings in examples (#10311)
* fix(example): Fix compilation warnings in examples

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-10 16:25:18 +03:00
Me No Dev
d846311344
fix(scan): Make sure that we do not leak memory if reading the APs fails (#10312)
As it was written, it was possible to leak the scan result array if esp_wifi_scan_get_ap_records() failed. Change will ensure that the array is deleted in that case.
2024-09-10 16:18:48 +03:00
Me No Dev
2c4ce95e16
fix(i2c): Ensure that semaphore is properly given if init fails (#10313)
Currently code can return before semaphore is given, which can cause the bus to lock. Change makes sure that it's properly given in case of failure.
2024-09-10 16:18:16 +03:00
Lucas Saavedra Vaz
ef23d52d9b
docs(contrib): Add instructions on how to test changes (#10221)
* docs(contrib): Add instructions on how to test changes

* fix(path): Fix file path

* Remove manual hooks as they do not exist anymore in the repo

* Fix typo
2024-09-10 16:16:29 +03:00
Rodrigo Garcia
cbe0f2ff0d
OpenThread Example Improvement (#10299)
* feat(openthread): add extended example

Creates a new example that mixes different APIs

* feat(openthread): create cj.json file

Adds neessary CI file

* feat(openthread): improve the example

Update ExtendedRoterNode.ino with more use of API

* feat(openthread): improve the example

Adds OpenThread Native calls to the example

* feat(openthread): improve the example 

Update LeaderNode.ino example to add OpenThread Native calls.

* fix(openthread): bad formatting using space

Update keywords.txt to use TAB instead of SPACE in order to recognize correctly the keywords.

* fix(openthread): bad example file name - typo

Changed ExtendedRoterNode to ExtendedRouterNode - Typo error.

* feat(openthread): add extended example ci.json file

Added CI file to the example.

* fix(openthread): deleted bad file names in the example

Delete libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode directory

* fix(openthread): typo in commentaries

* fix(openthread): typo in commentaries

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-09 16:19:14 +03:00
Rodrigo Garcia
532d5f2fad
feat(tone): missing set tone channel implementation (#10305)
Adds the implementation to setToneChannel() declared in Arduino.h, but removed when movin from Arduino 2.x to 3.x.
2024-09-09 12:45:13 +03:00
Jan Procházka
2853b7c0a4
fix(ci): Log default FQBN if not passed (#10302) 2024-09-09 12:44:52 +03:00
Ha Thach
6264d6b72b
feat(esp32-s2/s3): update tinyuf2 for Adafruit board to 0.20.1 (#10300) 2024-09-09 12:40:38 +03:00
Unexpected Maker
c0dce69fc1
Added Unexpected Maker OMGS3 (#10298) 2024-09-09 12:40:23 +03:00
dependabot[bot]
eec855a09f
build(deps): bump cryptography from 42.0.7 to 43.0.1 in /tests (#10284)
Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.7 to 43.0.1.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/42.0.7...43.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-09 12:39:58 +03:00
Me No Dev
e964a2deab
fix(scan): Make sure scan struct is cleared before set (#10282) 2024-09-09 12:39:43 +03:00
Me No Dev
976bda6b49
fix(report): Print correct chip revision (#10277)
It was printed wrongly before. Actual revision is the value divided by 100 in float.
2024-09-09 12:39:30 +03:00
per1234
41cdbd99b7
fix(boards): Remove port property assoc. for non-unique VID/PID pairs (#10271)
The Arduino boards platform framework allows properties of a port to be associated with a board
definition. The Arduino development software will identify a port having the associated properties
as that board.

This should only be done for properties that are unique to the ports produced by that board model.
In cases where a board model does not produce a port with properties unique to that model, it is
irresponsible to associate those properties with the board definition as this will cause other
models to be inappropriately identified.

The authors of these board definitions associated them with non-unique USB VID/PID pairs so those
associations must be removed. The 303a:1001 VID/PID pair is of the hardware CDC serial port of the
native USB ESP32 chips. The others are stock VID/PID pairs of general purpose USB to serial bridge
chips that are used on many different board models.
2024-09-09 12:39:09 +03:00
Rodrigo Garcia
e70f4d3819
Adds HW Serial CDC as IDF component example (#10262)
* feat(hw_cdc): creates documentation for the example

Adds a README file that exaplains the example.

* feat(hw_cdc): create cmake config file

Adds necessary CMakeLists.txt file to the project with the HW CDC defines that will enable it.

* feat(hw_cdc): create sdkconfig.defaults

Adds necessary and minimum sdkconfig settings in order to make Arduino run as IDF Compoenent.

* feat(hw_cdc): create cmake config file

Create the Arduino Sketch source code CMakeLists.txt file that will include all source code files and header files in the proejct.

* feat(hw_cdc): create main.cpp

Adds the minimum Arduino Sketch that will print "Hello World!" in the HW Serial USB CDC port.

* feat(hw_cdc): create idf_component.yml

Adds necessary ESP32 Registry information in order to make ESP32 Arduino to be automatically included in the project as an IDF component.

* feat(hw_cdc): update main.cpp

adds code to wait for the user to open the Serial Monitor

* feat(hw_cdc): formating text code

Applying Code style and formating.

* feat(hw_cdc): adds the example to idf_component.yml

Adds the example to the list of example in the ESP32 Registry.

* ci(pre-commit): Apply automatic fixes

* fix(chw_cdc): typo fix

Fixed Typo in the documentation.

* fix(hw_cdc): fixed a commentary typo

Fixed commantary typo

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-09-02 13:21:05 +03:00
Ludovic BOUÉ
7a4587b4bd
Update variants for M5Dial and M5StampS3 (#10268)
Update variant for M5Dial which comes with 8MB of built-in Flash
Update variant for M5StampS3 which comes with 8MB of built-in Flash
2024-09-02 13:20:39 +03:00
per1234
f06f2d7b07
fix(boards): Correct typos in port prop. associations for "Bee" boards (#10276)
* fix(boards): Correct PID port property in "Bee Data Logger" board def

VID and PID port property values are hexadecimal literals and thus use the standard "0x" prefix.

Previously, this prefix was missing from the PID port property association in the definition of the
board definition of "Bee Data Logger" board. This typo caused ports having the 0x303a, 0x815C
VID/PID pair to not be identified as a "Bee Data Logger" board as intended.

* fix(boards): Correct property names for PID port property associations

These properties are intended to associate values of the PID port property with "Bee" board
definitions. A typo caused them to instead associatiate the values with the VID port property. The
result was that ports with this VID/PID pair were not identified by the Arduino development
software as the board model as intended.
2024-09-02 13:20:23 +03:00
Lucas Saavedra Vaz
0b8eedea5c
ci(release): Make workflows dependent on release completion (#10260) 2024-08-31 18:33:32 +03:00
Me No Dev
254c5e43f1
fix(http): Replace flush() with clear() in HTTPClient (#10269)
Following deprecation of flush()
2024-08-31 18:28:22 +03:00
Lucas Saavedra Vaz
4c1095b23f
ci(push): Use fqbn from ci.json (#10267) 2024-08-31 18:28:04 +03:00
Me No Dev
b2c805a139
fix(ppp): Fix PPP not working after reboot if no RST (#10264)
Modem will try to switch to CMUX and then back to COMMAND in order to allow communication with the modem.
2024-08-30 18:03:56 +03:00
Andreas Merkle
019855ff90
fix(littlefs): Use VFSImpl::exists() to avoid false error log (#10217)
* fix(littlefs): Use VFSImpl::exists() to avoid false error log

* fix(ffat): Use VFSImpl::exists() to avoid false error log

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-08-30 18:01:23 +03:00
Me No Dev
22fb4026de
Merge branch 'master' into release/v3.1.x 2024-08-28 23:15:40 +03:00
Me No Dev
396def3f83
IDF release/v5.1 e026fd1f (#10257) 2024-08-28 23:14:39 +03:00
Rodrigo Garcia
e5394ccef7
fix(arduino): changes definitions in cmakelists.txt file (#10259)
Fixes an issue related to ESP_MATTER component that defines a path using ESP32 as folder. Because Arduino defines ESP32 to 1, it causes an expansion error for folder using ESP32 folder name.
2024-08-28 22:46:48 +03:00
Me No Dev
564612dacc
IDF release/v5.3 0bbd7281 (#10258) 2024-08-28 22:45:33 +03:00
Me No Dev
a8677a074a
Merge branch 'master' into release/v3.1.x 2024-08-28 22:21:42 +03:00
Lucas Saavedra Vaz
ef5c6b94b3
fix(release): Fix install test on release (#10256) 2024-08-28 22:21:17 +03:00
Me No Dev
8352caff08
Merge branch 'master' into release/v3.1.x 2024-08-28 18:50:04 +03:00
Lucas Saavedra Vaz
77d8095472
fix(release): Fix release script to use new archive method (#10255)
* fix(release): Fix release script to use new archive method

* Remove variable
2024-08-28 18:48:27 +03:00
pre-commit-ci-lite[bot]
57518b821c
ci(pre-commit): Apply automatic fixes 2024-08-28 14:11:51 +00:00
Me No Dev
e6dc9db764
Merge branch 'master' into release/v3.1.x 2024-08-28 17:10:24 +03:00
Adriano Konzen
dd4a7d6c5e
feat(LEDC): Adds the ability to set the clock source for the LEDC (#10171)
* Adds the ability to set the clock source for the LEDC

* feat(LEDC): Adjusting function names to more suitable

* feat(LEDC):  Fix clock_source to static

* docs(ledc): Document ledc set and get clock source

* docs(ledc): Update ledcSetClockSource description

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-28 17:09:56 +03:00
me-no-dev
0b842442c9 Update core version to 3.1.0 2024-08-28 16:11:35 +03:00
Me No Dev
75b29fde57
Merge branch 'master' into release/v3.1.x 2024-08-28 15:49:38 +03:00
Lucas Saavedra Vaz
683fea103c
docs(vale): Enable vale and fix errors (#10231)
* docs(vale): Enable vale and fix errors

* Apply suggestions
2024-08-28 15:48:18 +03:00
Lucas Saavedra Vaz
e04f050639
fix(spelling): Fix misspellings detected by codespell and enable it (#10232)
* fix(spelling): Fix misspellings detected by codespell and enable it

* change(tools): Push generated binaries to PR

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-28 15:43:02 +03:00
Me No Dev
fa6711551d
Merge branch 'master' into release/v3.1.x 2024-08-28 11:57:41 +03:00
Rodrigo Garcia
4c4906f470
fix(uart): sleep retention (#10248)
* fix(uart): sleep retention

sets new flag from IDF 5.3 that causes error with Serial.begin(115200).

* fix(typo): typo and commentaries

* feat(uart): adds memset to make structure empty

* fix(uart): missing parentesis - typo

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-28 10:50:49 +03:00
Lucas Saavedra Vaz
5ecda3a7cb
fix(get.py): Remove existing files before extracting (#10247)
* fix(get.py): Remove existing files before extracting

* change(tools): Push generated binaries to PR

* ci(pre-commit): Apply automatic fixes

* change(tools): Push generated binaries to PR

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-28 09:54:52 +03:00
Me No Dev
7633653019
fix(client): Make flush() call clear() and deprecate it (#10242)
This is a compromise for issues caused by https://github.com/espressif/arduino-esp32/pull/9453
2024-08-28 09:54:25 +03:00
Juraj Andrássy
df4518d6a1
fix: WebServer - change occurrence of client.flush() to clear() (#10234) 2024-08-28 09:53:59 +03:00
Juraj Andrássy
6f84a43611
fix: ArduinoOTA - change occurrence of client.flush() to clear() (#10233) 2024-08-28 09:53:43 +03:00
Rodrigo Garcia
99e68a0518
Change "neopixel" references to use RGB LED naming (#10225)
* fix(rgbled): fixes core rgbledWrite()

* fix(rgbled): fixes examples - rgbledWrite()

* fix(rgbled): fixes variants commetaries - rgbledWrite()

* fix(rgbled): examples and doc - use RGB_LED naming

* fix(rgbled): variants - use RGB_LED naming

* fix(rgbled): other places for RGB LED naming

* fix(typo): cores - rgbLed instead of rgbled

* fix(typo): examples - rgbLed instead of rgbled

* fix(typo): variants commentaties - rgbLed instead of rgbled

* fix(rgbled): bad file name

* fix(typo): typo and commentaries

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* fix(rgbled): deprecating neopixelWrite()

* fix(rgbled): use RGB LED naming

* fix(rgbled): document formatting

* fix(rgbled): neopixelWrite() is now deprecated

* fix(rgbled): removed attribute in wrong place

* just a git push test

* restart git bash test

* ci(pre-commit): Apply automatic fixes

* removed wrong test file

* fix(rgbled): new Arduino style depreacted attribute

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-28 09:53:24 +03:00
Me No Dev
0539ebf322
fix(chip): Return correct ESP32 chip model (#10243) 2024-08-26 15:02:22 +03:00
Y_hsiao_ch'un
dbdb40280a
Added variant for Waveshare ESP32-S3-Zero (#10241)
* Added variant for ESP32-S3-Zero

* Added variant for ESP32-S3-Zero

* Fixed CI failures due to I2C and SPI pin definitions

* Fixed custom partitions

* Fix the partition without ota

* Fix waveshare esp32-s3-zero partition table, add 4MB partition content

* Fix waveshare esp32-s3-zero partition table, add 4MB partition content

* Update tools/partitions/max_app_4MB.csv

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* change boards.txt

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-08-26 13:09:48 +03:00
Xylopyrographer
4178e6643b
feat(boards): Add ESP32-2432S028R board support (#10235)
* Add ESP32-2432S028R dev board

Add support for the ESP32-2432S028R, aka Cheap Yellow Display (CYD) dev board.

* Add ESP32-2432S028R variant

Add ESP32-2432S028R, aka Cheap Yellow Display (CYD) variant

* Revise macro defined function names

Append brackets to all macro defined function names

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-26 11:51:18 +03:00
RichardHeltec
edc56a8eb0
feat(board):Add Heltec Vision Master series boards (#10198)
* feat(board):Add Heltec Vision Master series boards

* fix(board): remove VID/PID from all board definitions

* fix(board):change 'heltec_vision_master_xxx.build.board' to uppercase

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-26 11:46:30 +03:00
Me No Dev
0a8888d5d6
Merge branch 'master' into release/v3.1.x 2024-08-22 23:48:51 +03:00
Lucas Saavedra Vaz
cd3d0bf569
fix(tests): Use proper API and check for required token (#10223) 2024-08-22 23:44:49 +03:00
Lucas Saavedra Vaz
60cbb6276a
fix(requirements): Avoid version conflicts (#10222) 2024-08-22 23:44:33 +03:00
Leandro Mattioli
6c4e9ee609
fix(timer): Typo - milis instead of millis (#10193)
* fix(timer): Typo - milis instead of millis.

* fix(doc0: format

fix CI error about format

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2024-08-22 23:44:17 +03:00
Ivan Grokhotkov
00b3941de5
change(build): add -Werror=return-type to default C and C++ flags (#10216) 2024-08-22 21:55:40 +03:00
Me No Dev
7fe4aa672c
Merge branch 'master' into release/v3.1.x 2024-08-21 22:38:41 +03:00
Lucas Saavedra Vaz
4098c53f5f
fix(get.py): Add version checking for installed tools (#10160)
* fix(get.py): Add version checking of installed tools

* change(tools): Push generated binaries to PR

* Fix for different file formats

* change(tools): Push generated binaries to PR

* fix paths

* change(tools): Push generated binaries to PR

* Move to using checksum

* change(tools): Push generated binaries to PR

* Clean code

* change(tools): Push generated binaries to PR

* Add checksum check for libs

* change(tools): Push generated binaries to PR

* ci(pre-commit): Apply automatic fixes

* change(tools): Push generated binaries to PR

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-21 22:37:43 +03:00
Lucas Saavedra Vaz
c7ac06c83a
ci(branches): Remove wildcard from branch triggers (#10210) 2024-08-21 22:37:12 +03:00
Me No Dev
e660261b63
IDF release/v5.1 d38afc77 (#10201) 2024-08-21 22:36:52 +03:00
me-no-dev
c7e01e72a1 add(build): Add initial ESP32-P4 skeleton
Required to start compilation. Board is currently hidden and many options are removed
2024-08-20 13:02:29 +03:00
Davide Perini
66c9c0b1a6
Add ability for boards to provide a custom pixel order in neopixelWrite() (#10128)
* fix(esp32): Fixed the hint for the builtin neopixleWrite() function

* change(esp32): Added neopixelWriteOrdered() function

* change(esp32): Added neopixelWriteOrdered() function

* change(esp32): Added neopixelWriteOrdered() function

* change(esp32): Added the possibility to specify LED color order

* change(esp32): Added the possibility to specify LED color order

* feat(rgbled): add license information

* feat(rgbled): add color order enum

* feat(rgbled): add color order feature

* feat(rgbled): change color order for lolin_s3_mini

* fix(rgbled): suffix

* fix(rgbled): suffix

* ci(pre-commit): Apply automatic fixes

* fix(rgbled): it lacks GRB case

Made GRB default + switch/case exceptions.

* fix(rgbled): add guard for rgb_led_color_order_t

If RGB_BUILTIN_LED_COLOR_ORDER is not defined, the type rgb_led_color_order_t won't be declared.

* fix(rgb-led): Implement rgbLedWriteOrdered()

* ci(pre-commit): Apply automatic fixes

* Remove const to allow changing the order

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: me-no-dev <hristo@espressif.com>
2024-08-20 01:29:13 +03:00
me-no-dev
54f1c22672 fix(build): Fix warning in FFat 2024-08-20 01:16:59 +03:00
me-no-dev
f77ce040db fix(build): Fix many warnings 2024-08-20 00:51:23 +03:00
me-no-dev
e1673e4c0c fix(build): IDF release/v5.3 466a392a and initial changes 2024-08-19 23:28:11 +03:00
Sylvain Quendez
def319add8
Update README.md (#10148)
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-08-16 16:44:39 +03:00
Sylvain Quendez
41f3e5e236
Update url in library.properties (#10147)
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-08-16 16:44:27 +03:00
Rodrigo Garcia
2a971751a7
fix(uart): clock source (#10172)
Problem detected with ESP32 and ESP32-S2 when the baudrate goes to 460600 bps.

REF_TICK (2MHz) seem not to work properly.
Limiting the use of REF_TICK for up to 205 Kbps.
2024-08-16 16:42:18 +03:00
microbots
49a3c10ce0
Adding CodeCell ESP32C3 new 3rd part board (#10177)
* Add CodeCell ESP32C3 variant folder

feat(variants): Add CodeCell ESP32C3 variant folder

Added the `codecell` folder to the `arduino-esp32/variants` directory to support the CodeCell ESP32C3 board. This folder includes the necessary pin mappings and configuration files.

* Update boards.txt for CodeCell ESP32C3

chore(board): Update boards.txt for CodeCell ESP32C3

Updated the boards.txt configuration to include settings specific to the CodeCell ESP32C3 board, such as upload speed and partition schemes.

* Update variants/CodeCell/pins_arduino.h

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* Delete variants/CodeCell directory

* Add codecell ESP32C3 variant folder

feat(variants): Add codecell ESP32C3 variant folder

Added the CodeCell ESP32C3 variant folder to support the CodeCell ESP32C3 board.
This folder contains the necessary pin mappings and configuration files.

* Update pins_arduino.h

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-16 16:40:27 +03:00
Lewis He
b8c9b59b61
Added LILYGO T-Watch-S3 & T-Watch-Ultra variants (#10175)
* Added LILYGO T-Watch-S3 & T-Watch-Ultra variants

* Remove extra line breaks

* Change the maximum upload limit of the rainmaker partition table

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-16 16:40:14 +03:00
Francis Duvivier
f53f2dc975
feat(3rd party board): Add Fri3d Badge 2024 (ESP32-S3-WROOM-1) (#10143)
* feat(3rd_party_board): Add Fri3d Badge 2024 (ESP32-S3 WROOM 1)

Image: https://github.com/Fri3dCamp/badge_2024/blob/main/docs/badge2024.jpg

More info on https://github.com/Fri3dCamp/badge_2024

* fix(3rd_party_board): Fix built in led for fri3d badge 2024

and use less X_ variables

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-16 16:39:57 +03:00
Jacob Williams
a7399e2b68
feat(board): Add Alfredo NoU3 (#10134)
* feat(board): Add Alfredo NoU3

Add board support for Alfredo Systems NoU3.

https://www.alfredosys.com/products/alfredo-nou3/

* fix(board): added I2C and SS pins to alfredo nou3

* fix(board): set SPI and I2C pin defs to -1

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-15 15:00:51 +03:00
Tinyu
124c2141fc
feat(board):Update M5Stack related board and pin configuration (#10144)
* Update M5Stack related board and pin configuration

* Remove redundant definitions

* Roll back the rainmaker partition table related configuration

* delete pid & vid
2024-08-15 09:41:28 +03:00
Me No Dev
16b2d74441
IDF release/v5.1 (#10162)
* fix(prov): Use network_provisioning

* IDF release/v5.1 5c57dfe949

* fix(prov): Add sketch and CMake fixes

* fix(prov): Fix build for ESP32-C2

* ci(pre-commit): Apply automatic fixes

* fix(prov): Improve WiFiProv library and QRcode print

* IDF release/v5.1 c608177cf9

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-15 09:30:45 +03:00
Me No Dev
ae71b2d0f5
fix(boards): Remove duplicate PID/VID 2024-08-14 18:18:42 +03:00
Jan Procházka
4aab8179a2
fix(wifiprov): Fix starting Wifi when already provisioned (#10151) 2024-08-13 15:29:49 +03:00
Jan Procházka
49d9b060ca
feat(RMaker): Register common events for better debugging (#10133)
* feat(rmaker): Register common events for better debugging

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-13 14:30:15 +03:00
per1234
d3f5b9b6ed
fix(ota): Wrap espota --auth flag in quotes (#10126)
When performing an "OTA" upload via a network port, the user may configure the sketch to require
an authentication password.

Arduino IDE presents a "Configure and Upload" dialog when the user triggers an upload to a network
port. The user can provide the authentication password via the field in that dialog. The
`upload.field.password` platform property is then set to the value provided by the user.

The platform uses the `tools.esp_ota.upload.pattern` command template to pass this value to the
espota upload tool via the tool's `--auth` flag.

Since the value of the `upload.field.password` platform property is set by the user via a free text
field, it might contain any characters. Since some characters (e.g., spaces) can be problematic in
a command line, it is essential to wrap it in quotes. This was done for the Arduino IDE 1.x variant
of the command template, but that was not ported when the pluggable discovery variant of the
command pattern was defined. This causes a spurious failure of the OTA upload process if the user
provides an authentication password that contains problematic characters.

For example:

```
"C:\Users\per\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.4\tools\espota.exe" \
-r -i 192.168.254.145 \
-p 3232 --auth=foo bar \
-f "C:\Users\per\AppData\Local\Temp\arduino\sketches\E2D807FABB134A2A60A1B9C7D14FE02B/11973.ino.bin"
usage: espota.exe [-h] [-i ESP_IP] [-I HOST_IP] [-p ESP_PORT] [-P HOST_PORT]
                  [-a AUTH] [-f FILE] [-s] [-d] [-r] [-t TIMEOUT]
espota.exe: error: unrecognized arguments: bar
Failed uploading: uploading error: exit status 2
```

This is prevented by wrapping the `--auth` flag in quotes:

```
"C:\Users\per\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.4\tools\espota.exe" \
a-r -i 192.168.254.145 \
-p 3232 "--auth=foo bar" \
-f "C:\Users\per\AppData\Local\Temp\arduino\sketches\E2D807FABB134A2A60A1B9C7D14FE02B/11973.ino.bin"
Sending invitation to 192.168.254.145
Authenticating...OK

Uploading: [                                                            ] 0%
```
2024-08-13 14:29:18 +03:00
Rodrigo Garcia
da13c038de
fix(doc): analogReadMilliVolts (#10125)
Fixes the documentation. typo. volts->Volts
2024-08-13 14:27:48 +03:00
Rodrigo Garcia
384cc27bba
fix(USB): OTG S2 and S3 debug print (#10123)
* fix(USB): OTG S2 and S3 debug print

ESP32-S2 and S3 using USB CDC OTG (TinyUSB) won't print any log information. This commit fixes that.

* fix(cdc): trying macos

changed Macro testing

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-13 14:27:06 +03:00
Patrik Andersson
7f1ab63053
Fix use after free in SD library (#10122)
* fix(sd): Fix use after free

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-13 14:25:48 +03:00
Y_hsiao_ch'un
8792145c01
Added variant for Waveshare ESP32-S3-Touch-LCD-1.69 & ESP32-S3-LCD-1.69 board (#10118)
* Added Waveshare ESP32-S3-Touch-LCD-1.69 & ESP32-S3-LCD-1.69 board

* Added Waveshare ESP32-S3-Touch-LCD-1.69 & ESP32-S3-LCD-1.69 board

* Change the default PSRAM OPI mode to disabled

* Change the default PSRAM OPI mode to Enabled

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-13 14:25:12 +03:00
Xylopyrographer
f1df088789
docs: correct Float type size in Preferences API and Tutorial documentation (#10113)
* Correct Float type size

Correct in the data type table and the API call the size of the Preferences `Float` type and returned value for `putFloat()`.

* Update Float call prototype

* Correct Float type size

Correct Float type size in the Preferences Types table.
Revise text to use `float_t` in place of `float`.

* Correct doc build error

Correct the `Explicit markup ends without a blank line; unexpected unindent.`
2024-08-13 14:24:36 +03:00
Matthias Hertel
5b05a34dff
Improving WebServer Example (#10111)
* Update WebServer.ino

* Enable FAT and LittleFS filesystems as configured.
* use new versions of RequestHandler::canHandle and RequestHandler::canUpload

* Update Documentation

* Documentation changed accoring review comments.

* README.md changed accoring to review comments.
2024-08-13 14:23:54 +03:00
CircuitART
c4cbc3e67c
feat(board): Add CircuitART Zero S3 board (#10108)
* new board esp32s3

* Update boards.txt

add circuitart_zero_s3 details

* Update pins_arduino.h

 removed unnecessary pin definitions pins_arduino.h as suggested by P-R-O-C-H-Y

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-13 14:23:14 +03:00
me-no-dev
70786dc5fa feat(core): Add version 3.0.4 to issue template 2024-08-02 14:33:06 +03:00
me-no-dev
1a42b87fb5 fix(release): Install pyserial for release test build 2024-08-02 12:53:00 +03:00
me-no-dev
a4fb227b06 fix(release): Use correct FQBN for release test 2024-08-02 12:36:09 +03:00
me-no-dev
cddaba6c3f fix(release): Fix arduino-cli path 2024-08-02 12:28:45 +03:00
Me No Dev
0d4ffcf74b
fix(core): Update versions to 3.0.4 (#10106) 2024-08-02 12:18:35 +03:00
CIncinnatus
38d6ed5f12
Enabled the onboard ceramic antenna by default when creating a new project with XIAO_ESP32C6 (#10066)
* Create variant.cpp

* Update variant.cpp

* Update variant.cpp

* Update pins_arduino.h

* Update variant.cpp

* Update variant.cpp

* Update variant.cpp

* Update variants/XIAO_ESP32C6/variant.cpp

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-02 11:36:46 +03:00
Me No Dev
dd86244b4f
feat(net): Add NAPT examples (#10100)
* feat(net): Add NAPT examples for STA and ETH

* feat(net): Add NAPT example for PPP

* feat(net): Add CI configs to skip H2

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-02 11:28:36 +03:00
Lucas Saavedra Vaz
9339c00d34
ci(release): Add JSON install test (#10104) 2024-08-02 11:21:52 +03:00
Jan Procházka
5aaa49e76d
fix(ESP-NOW): Remove all peers on ESP_NOW.end() (#10102)
* fix(esp-now): Remove all peers on ESP_NOW.end()

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-02 11:21:32 +03:00
Me No Dev
23b84e5bdd
fix(ssl): Add size arg to NetworkClientSecure::setCACertBundle (#10101) 2024-08-01 15:06:24 +03:00
Jan Procházka
2aa4828dcb
fix(example): Update RainMaker examples to work with ESP32C6 (#10096)
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2024-08-01 12:26:09 +03:00
Rodrigo Garcia
b1b62286db
fix(uart): Sets XTAL as clock source for uart (#10087)
* fix(uart): Sets XTAL as clock source for uart

C6 and H2 have problems after returning from light sleep. The baud rate seems to be off when APB is used as clock source.

This fix solves the issue using a steady clock source.

* fix(typo): Typo and commentaries

Adds C2 in the XTAL list.

* fix(uart): adjust get/set baudrate

Fixes the functions for reading/writing UART baudrate by using IDF functions instead of HAL/LL.

* fix(uart): uses REF_TICK for ESP32/S2

* fix(uart): esp32/s2 baudrate > 1MHz

Fixes the baudrate for ESP32 and ESP32-S2 when the baud rate is higher than 1MHz.
REF_TICK is just 2MHZ and can handle up to 1MHZ baudrate.

* fix(uart): rxTimeout minimum

Default RxTimeout changed to the minimum = 1.
When TICK_REF is used as clock source, this is mandatory,

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-01 12:09:59 +03:00
Me No Dev
393681c1ee
IDF release/v5.1 (#10098)
* IDF release/v5.1 5a26d8ae8e

* IDF release/v5.1 b6b4727c58
2024-08-01 12:09:25 +03:00
Xylopyrographer
6244d9a45b
feat: Print chip features bitfield (#10080)
Prints the value of the chip features bitfield to printChipInfo() to facilitate debugging.

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-07-31 21:44:13 +03:00
Chris Dailey
ad5aaf86b6
fix(lwip): Add early out in NetworkUDP::parsePacket() when socket has no data (#10075)
* fix(lwip): Add early out in `NetworkUDP::parsePacket()` when socket has no data

Previously, `NetworkUDP::parsePacket()` would take the time to allocate a 1460 byte buffer
to call `recvfrom()` with, immediately freeing it if there was no data read.

This change has it check if there is available data via `ioctl()` with `FIONREAD` first,
saving the allocation and thus significantly increasing performance in no data situations.

* fix(lwip): Initialize `len` to ensure it's set before check
2024-07-31 16:00:13 +03:00
Jan Procházka
7d731e0f34
fix(readme): Update badge for Build status (#10097) 2024-07-31 15:17:11 +03:00
Jan Procházka
3722dbad6c
fix(ledc): Fix freeing channel if not used anymore (#10094) 2024-07-31 15:16:55 +03:00
Jan Procházka
3a7eda1ef0
ci(wokwi): Pass diagram.json file if exists to pytest (#9720)
* ci(wokwi): Pass diagram.json file if exists to pytest

* ci(wokwi): Rename diagrams to enable editing in Wokwi editor

* ci(tests): Use newest pytest version

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-07-31 14:16:43 +03:00
Jan Procházka
9065342f53
feat(wifi): Allow setting minimum time for wifi scan (#10083)
* feat(wifi): Allow setting minimum time for wifi scan

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-07-31 14:16:10 +03:00
Jan Procházka
f5be003d0b
fix(timer): Add check to avoid crashing (#10069) 2024-07-29 13:09:22 +03:00
Xylopyrographer
9e01ebdb3a
feat(board): add Waveshare ESP32-S3-Matrix (#10072)
* feat(board) add Waveshare ESP32-S3-Matrix

Adds support for the Waveshare ESP32-S3-Matrix board. Includes changes to the Rainmaker partitions as per PR #10046 .

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-07-29 12:50:47 +03:00
Jan Procházka
b33fbca9b7
fix(gpio): Add missing include for digitalPinCanOutput (#10070) 2024-07-29 12:49:45 +03:00
Lucas Saavedra Vaz
0f1f947a72
ci(tests): Fix workflow errors (#10067) 2024-07-29 12:49:18 +03:00
lbernstone
b91e453707
fix(wfcs): Replaced expired certificate for howsmyssl.com (#10063) 2024-07-29 12:49:03 +03:00
Jan Procházka
0670e20421
fix(rainmaker): Add new partition tables that fits the binary size (#10046)
* fix(rainmaker): Add new partition tables

* fix(rainmaker): Update readme file for RM examples

* fix(rainmaker): Hide RM partitions for esp32h2
2024-07-29 12:48:40 +03:00
WebDust21
0fa4aa632c
PPP: add "battery status" read stub functions (#10043)
* add "getBattery" functions + #define simplicity

replaced all function protections with a #define to simplify code functionality.  Also added "getBattery" functions to leverage "esp_modem_get_battery_status" call in ESP-MODEM.

* add "getBattery" function defs to PPP.h

* fix(ppp): uncomment error logging, change new function naming

* fix(ppp): rename new functions for naming conformity

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-07-22 11:59:40 +03:00
Marek Knosala
b2e67ca278
Update analogContinuous function for passing pins as const and constexpr (#10044)
* Update esp32-hal-adc.c

* Update esp32-hal-adc.h

* Update adc.rst
2024-07-22 11:59:18 +03:00
Lucas Saavedra Vaz
690bdb511d
docs(lib-builder): Add missing requirements and examples (#10040) 2024-07-17 16:04:55 +03:00
Me No Dev
e5ea4da382
add(template): Add version 3.0.3 to the Issue template (#10042)
To be merged after release
2024-07-17 16:04:39 +03:00
Me No Dev
7a82915de2
fix(release): Fix wrong filename for copy 2024-07-17 15:47:53 +03:00
Me No Dev
614c72b4d3
fix(libs): Update all libraries to match the core version (#10041)
From now on core libraries will have the same version as the core
2024-07-16 23:04:43 +03:00
me-no-dev
bd0abb3474 Update core versions to 3.0.3 2024-07-16 21:55:50 +03:00
Me No Dev
77ca7ea7e5
IDF release/v5.1 (#10038)
* IDF release/v5.1 dc859c1e67

* fix(lwip): Filter out V6 packets if V6 is not enabled

the ESP might accept and act on some IPv6 packets, even though IPv6 is not enabled for the interface in Arduino. This change makes the ESP ignore all IPv6 packets if IPv6 address is not available.

* fix(lwip): DNS header is not required

* fix(ot): Add LWIP_HOOK_IP6_INPUT_CUSTOM support
2024-07-16 19:35:06 +03:00
Jan Procházka
3c1e5a9189
feat(ledc): Allow attaching multiple pins to 1 channel (#10032)
* feat(ledc): Allow attaching multiple pins to 1 channel

* feat(ledc): Add ledcWriteChannel function

* feat(ledc): Print info about already set channel

* docs(ledc): Add ledcWriteChannel function and attach update

* feat(ledc): Add example and fixes

* feat(ledc): Remove commented code

* feat(ledc): Fix missing new line at end of file

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-07-16 15:52:45 +03:00
Martin Hübner
e850afb15e
SDMMC: Fix example code (#10035)
The setPins() function obviously comes from the SD_MMC lib. Not prepending
that lib, this code won't compile.

Signed-off-by: Martin Hübner <martin.hubner@web.de>
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-07-16 11:52:11 +03:00
Ludovic BOUÉ
2db730630e
add(board): Add M5Stack NanoC6 Dev Kit (#9942)
* add(board): Add M5Stack NanoC6 Dev Kit

M5Stack NanoC6 Dev Kit
https://shop.m5stack.com/products/m5stack-nanoc6-dev-kit

* add(board): Add M5Stack NanoC6 Dev Kit

* add(board): Add M5Stack NanoC6 Dev Kit

* Update boards.txt

* add(board): Add M5Stack NanoC6 Dev Kit

* Rename variants/m5stack_stickc_plus/m5stack_nanoc6/pins_arduino.h to variants/m5stack_nanoc6/pins_arduino.h

* Update boards.txt

* Update pins_arduino.h

* Update pins_arduino.h

* Update boards.txt

m5stack_nanoc6.build.board was not uppercase
2024-07-16 11:24:54 +03:00
Lucas Saavedra Vaz
e54fb9e31f
ci(tests): Fix conclusion status and badge pushing (#10013)
* ci(badge): Push only when changes happened to badge

* ci(tests): Fix conclusion status
2024-07-15 15:23:58 +03:00
tutotio
f3968897e6
Update boards.txt (#10016)
Add default 16MB partition to esp32wroverkit
2024-07-15 12:02:53 +03:00
Ludovic BOUÉ
b57fe57a7f
Update Zigbee_Temperature_Sensor.ino (#10030) 2024-07-15 11:59:26 +03:00
WEMOS Electronics
f8232bb9fd
add(board): Add LOLIN S3 Mini Pro (#10021)
* add(board): Add LOLIN S3 Mini Pro

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-07-15 11:59:05 +03:00
Me No Dev
4b7b5d3d09
fix(nodemcu-32s): Fix Upload Speed menu on Windows (#10012)
* fix(nodemcu-32s): Fix Upload Speed menu on Windows

The board definition had 460800 as default upload speed, but that is invalid on Windows, so the menu did not show. This change puts 115200 as default, which will make the menu appear

* fix(board): Make build.board uppercase
2024-07-11 15:29:49 +03:00
Me No Dev
676a62c7c2
fix(report): Add 3.0.2 to list of versions 2024-07-11 13:37:23 +03:00
Jan Procházka
792ad7bc33
docs(component): Update to IDF 5.1 and add component manager instructions (#10005)
* docs(component): Update to 5.1 and add component manager

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-07-10 14:18:05 +03:00
Lucas Saavedra Vaz
1923f82a0f
docs(badge): Generate runtime tests badge (#9979) 2024-07-10 14:17:47 +03:00
Me No Dev
874e2a1a1b
fix(example): Add better WPS logging (#9999)
* fix(example): Add better WPS logging

Provides a better log of what went wrong when using WPS

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-07-10 14:01:04 +03:00
drmpf
0ab2c58b6c
FS library position() to return (size_t) -1 on error (#10002)
* position_fix

Fix for error return from position()
Issue #9992

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-07-10 13:50:09 +03:00
Me No Dev
0adf7873d1
feat(eth): Allow setting the RX task stack size (#10003)
* feat(eth): Allow setting the RX task stack size

Default stack size of 2K might not be enough in some cases. Increase the default to safer 4K and allow setting it to custom value.

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-07-10 13:49:33 +03:00
Me No Dev
60b6faacf6
fix(httpc): Fix data read was less than expected (#9998) 2024-07-10 13:49:09 +03:00
TD-er
6debc5c902
Fix timeout in WebServer::_uploadReadByte and handleClient() (#9990) (#9991)
* Fix timeout in WebServer::_uploadReadByte and set timeout handleClient()

Fixes: #9990

* Set HTTP_MAX_CLOSE_WAIT equal to other HTTP_xxx_WAIT values

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-07-10 13:48:46 +03:00
Lucas Saavedra Vaz
4e3523c212
docs(lib-builder): Add instructions to use the UI (#9977) 2024-07-03 00:46:29 +03:00
Limor "Ladyada" Fried
762d1a0f69
feat (3rd_party_board): Add new Adafruit Feather C6 - rev B (#9961)
* add new feather c6 rev B :)

* remove the -lzboss_stack.ed.trace per review

* fix pre-commit

---------

Co-authored-by: hathach <thach@tinyusb.org>
2024-07-02 10:32:22 +03:00
Rodrigo Garcia
5f663e708a
fix(uart): Set back Pin signal polarity (#9950)
* fix(uart): Set back Pin signal polarity

Fixes a problem related to inverting signal polarity back to normal after a previous inversion.

This shall set the correct polarity in Serial.begin().

* fix(uart): Remove useless commentary

Removes a commentary with a question about the inversing polarity function.

* fix(uart): Update comment

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

---------

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-07-01 13:11:15 +03:00
Dawid Strzybny
88ad677f00
fix(docs): Correct i2s.srt api example (#9968) 2024-07-01 12:00:11 +03:00
Lewis He
bc5efee6cb
Added LilyGo T3S3 variants (#9956)
* Added LilyGo T3S3 variants

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-07-01 11:55:42 +03:00
Me No Dev
fef3c7369d
feat(net): Enable IPv6 immediately if already connected (#9948)
If the interface is already connected, try to enable IPv6 immediately. Otherwise the interface would need to go through disconnect/connect cycle for IPv6 to be enabled.
2024-07-01 11:20:05 +03:00
Rodrigo Garcia
337058ac94
Fixes WiFiProv.ino (#9946)
* Update WiFiProv.ino

* fix(wifiprov): Uses BLE for provisioning

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-28 16:34:06 +03:00
Rodrigo Garcia
36863449e4
RMT Legacy Driver option (#9941)
* feat(rmt): allow legacy driver

* feat(rmt): legacy driver example

* fix(rmt): legacy driver example

* fix(rmt): ESP32_ARDUINO_NEW_RMT_DRV_OFF

* fix(rmt): ESP32_ARDUINO_NEW_RMT_DRV_OFF

* fix(rmt): ESP32_ARDUINO_NEW_RMT_DRV_OFF

* fix(rmt): GPIO HAL only

* fix(rmt): error case

* fix(rmt): not necessary change

* ci(pre-commit): Apply automatic fixes

* ci(pre-commit): Ignore build_opt in clangformat

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-06-28 12:06:58 +03:00
Lucas Saavedra Vaz
4a6437d3ea
ci(tests): Fix cache cleaning (#9932) 2024-06-25 16:31:52 +03:00
Amir Reza Mohammadi
09b30e9d77
feat(3rd party board): Adding ViraLink IoT Gate Boards (#9841)
* feat(board): Adding ViraLink IoT Gate Boards

* feat(board): Adding ViraLink IoT Gate Boards

* feat(board): Adding ViraLink IoT Gate Boards

* feat(board): Adding ViraLink IoT Gate Boards added spi pins

* feat(board): Adding ViraLink IoT Gate Boards added spi pins

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-25 16:31:39 +03:00
Me No Dev
777d0d7004
fix(idf): Require openthread on H2 and C6 (#9934)
Fixes IDF builds for H2 and C6 when OpenThread is enabled
2024-06-25 09:36:43 +03:00
Me No Dev
65204d9e6b
IDF release/v5.1 bd2b9390ef (#9928) 2024-06-24 22:34:00 +03:00
Rodrigo Garcia
5a078de8ad
fix(boards): boards.txt error (#9930)
Fixes XIAO C6 board name in boards.txt file
2024-06-24 19:27:04 +03:00
Rodrigo Garcia
d891ddfec7
New OpenThread CLI Arduino Library for ESP32-C6 and ESP32-H2 (#9908)
* feat(OThread): Add Library

* fix(OpenThread): fixes file list in CMakeLists.txt

* fix(openthread): Fixes JSON CI Files

* fix(openthread): Fixes JSON CI Files

* fix(openthread): Include Openthread guarding

* fix(openthread): COAP parametrization

* fix(openthread): Include Openthread guarding

* fix(openthread): Improves commentaries and code

* fix(openthread): Improves code

* fix(openthread): Includes StreamString.h

* feat(openthread): New Scan Example

* feat(openthread): Improved Scan Example

* feat(openthread): README.md

Initial documentation for ESP3 Arduino OpenThread CLI API.

* feat(openthread): helper functions documentation

Create helper_functions.md for ESP32 Arduino OpenThread API

* fix(openthread): begin end

* feat(openthread): onReceice example

* fix(openthread): tx queue error

* fix(doc): fixing documentation apresentation

Fixes the documentation first paragraph in order to make it easier fore reading. It also displays in the very top which SoC are supported by the library.

* fix(doc): documentation format

* feat(openthread): commentary

* fix(openthread): Typo, start/stop console

* fix(openthread): library properties

* ci(pre-commit): Apply automatic fixes

* feat(openthread): formatting text

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-24 19:26:42 +03:00
TimL
9e55ccd98e
PPP: Make modem reset delay configurable (#9910)
* fix(ppp): Make modem reset delay configurable

The delay required to reset Simcom modem modules varies significantly across
different models, even where they have otherwise identical AT command
sets.

Simcom A7672 was failing to reset with the default 200ms delay. Make the reset
delay configurable to allow customising this for a specific modem.
Default delay, if not specified is kept at 200ms.

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-24 12:00:58 +03:00
Rodrigo Garcia
47298ffa3d
fix(doc): Update boards.rst (#9925)
Fixes documentation for ESP32 family. Arduino Core 3.0.x has 6 supported SoC and each has a different radio specification.
2024-06-24 11:55:05 +03:00
Me No Dev
ad1de0b37c
feat(net): Switch to typedefs for WiFiClient, WiFiServer, WiFiUdp and WiFiClientSecure (#9909)
* feat(net): Deprecate old WiFi APIs

Deprecates WiFiClient, WiFiServer, WiFiUdp and WiFiClientSecure

* fix(net): add defines to WiFi.h

Defines are added to not cause deprecation warnings. Will be removed in the future

* fix(net): Use typedefs instead to help with forward declarations

Defines do not allow forward declarations
2024-06-24 10:26:22 +03:00
Lucas Saavedra Vaz
1f2ba1f87f
docs(i2s): Fix I2S documentation example (#9916)
* docs(i2s): Fix I2S documentation example

* docs(idf): Fix name of Arduino as component link
2024-06-24 10:23:47 +03:00
Lucas Saavedra Vaz
26db8cba32
ci(tests): Avoid the use of pull_request_target where possible (#9899) 2024-06-24 10:23:24 +03:00
Rodrigo Garcia
0ef2986874
feat(rmt): Solve neopixel issue (#9906)
* feat(rmt): Solve neopixel issue

if neopixelWrite() is used from different tasks/isr_callbacks, it may result in a concurrency problem and many detach/attach calls in sequence, but not in synch.

This commit avoids initializing the neopixel GPIO again and improves the respomse time of neopixelWrite().
2024-06-20 16:33:06 -03:00
vortigont
1079f4c855
HTTPClient lib - add HTTPCLIENT_NOSECURE build flag (#9893)
* HTTPClient lib - add HTTPCLIENT_NOSECURE build flag

`HTTPCLIENT_NOSECURE` build flag disables TLS support in HTTPClient library by
excluding `NetworkClientSecure.h` header.
This allows linker to strip down mbedTLS lind and certificates bundle,
which in turn reduces firmware image for about ~80kib.

* Update HTTPClient.cpp

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-20 14:13:15 +03:00
Vincentius Adrian
d708438b8c
feat: reduce bluetooth serial flush delay to 2 ms (#9905) 2024-06-19 21:10:11 +03:00
Rodrigo Garcia
206c0c71ab
Deep Sleep Example Fix (#9904)
* fix(example): EXT0 and EXT1 wakeup

Fixes the Deep Sleep wakup example to run with IDF5.1. The API has changed and a adjustment was necessary.

* feat(wakeup): Use Macro for GPIO_NUM

Changed the example to use a #define for the RTC IO Pin (GPIO) used in the example.

* fix(typo): typo and commentaries

Fixes the commentary to the correct IDF terms.

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-19 19:19:39 +03:00
Me No Dev
b77b38e40e
fix(version): Update version to 3.0.2 (#9902) 2024-06-19 16:23:29 +03:00
Ludovic BOUÉ
e7dd6e2ca7
Add variant for Elecrow CrowPanel 7.0" (#9897)
* * feat(esp32): Add variant for Elecrow CrowPanel 7.0

Add variant for Elecrow CrowPanel 7.0"

* * feat(esp32): Add variant for Elecrow CrowPanel 7.0

Add variant for Elecrow CrowPanel 7.0"

* * feat(esp32): Add variant for Elecrow CrowPanel 7.0

Elecrow CrowPanel 7.0" has 4MB flash
2024-06-19 16:23:09 +03:00
Jan Procházka
bdabb9987d
docs(preferences): Fix getBool function (#9901) 2024-06-19 15:02:13 +03:00
Me No Dev
0bb59a87d8
IDF release/v5.1 c00dad83c1 (#9900) 2024-06-19 13:27:26 +03:00
Junxiao Shi
3f6c34abd2
fix(boards): set XTAL 26MHz for Heltec WiFi & LoRa V1 (#9889) 2024-06-19 09:56:51 +03:00
Me No Dev
a992967079
fix(time): Fix SimpleTime to also use DHCP (#9886) 2024-06-19 09:55:54 +03:00
Lucas Saavedra Vaz
96c2c71cb3
ci(tools): Fix tools workflows (#9846)
* ci(tools): Remove ARM64 runner and use get.exe

* ci(tools): Optimize get.py and verify extraction

* change(tools): Push generated binaries to PR

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-06-19 09:55:37 +03:00
Rodrigo Garcia
99750cd37e
Adds BLE Characteristic User Description 0x2901 Descriptor (#9883)
Adds a class for 0x2901 - Characteristic User Descriptor.
This Descriptor is usual in BLE and describes with text what each characteristic is about.
Improve Notify.ino example by adding the 0x2901 descriptor
2024-06-18 14:45:22 -03:00
Earle F. Philhower, III
6b223391c1
fix(netbios): Return interface address for NetBIOS name lookup (#9885)
* fix(netbios): Return interface address for NetBIOS

When NetBIOS returns a match, it should return the IP address of the device.
Presently, however, it returns the address of multicast IP for the subnet
since the incoming NBNS packet's UDP target will be multicast
(i.e. 192.168.1.255).

Iterate over the active network interfaces and check netmasks to determine
where the packet came from, and return the appropriate IP interface address
instead.

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-18 12:35:56 +03:00
Ashley Grealish
76b6ff6500
fix: Updated the BasicHttpsClient example root certificate (#9857)
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2024-06-18 07:47:52 +03:00
Rodrigo Garcia
32def87c0b
fix(BLE): Arduino String shall not be used within std::map<> (#9875)
* fix(BLE): std::map()

* Update libraries/BLE/src/BLERemoteService.cpp

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-18 00:26:21 +03:00
Me No Dev
c43187a386
fix(wifi): Fix WiFi setTxPower and getTxPower (#9862)
* fix(wifi): Fix WiFi setTxPower and getTxPower

We need to wait for the interface to be started in order to be able to set/get TX Power. Code was returning too early, so calling the functions after `begin()` resulted in failure.

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-17 22:47:12 +03:00
Juraj Andrássy
5c22402025
fix: ClientSecure.available() fix for connection closed by remote socket (#9869) 2024-06-17 22:40:10 +03:00
Me No Dev
1efab83432
feat(http): Allow to set Accept-Encoding header (#9863)
Similar to setUserAgent
2024-06-17 22:32:52 +03:00
Me No Dev
2c7f722e70
add(board): Add LILYGO T-ETH-Lite (#9865)
* add(board): Add LILYGO T-ETH-Lite

Adds board support for Lilygo T-ETH Lite

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-17 22:32:30 +03:00
Jan Procházka
5b7c615a0a
ci(boards): Add cache for libs (#9877) 2024-06-17 22:32:05 +03:00
Thibo Verheyde
7d73a74d65
Add Walter board support (#9817) 2024-06-17 22:31:04 +03:00
Lesords
cbf1e94dd5
chore: delete the definition of pin A3 (#9798)
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-06-14 00:27:49 +03:00
Me No Dev
f22ddb30b7
feat(uart): Add esp-modbus to the included components (#9855)
It used to come with IDF 4.x
2024-06-14 00:26:59 +03:00
Me No Dev
f33cc7e944
fix(ota): Allow password and partition change while idle (#9853)
Previously it was allowed only once before begin() was called
2024-06-14 00:26:36 +03:00
Me No Dev
a8ce679d81
fix(ota): Magic byte check fails with encrypted firmware (#9852) 2024-06-14 00:26:11 +03:00
Ayush Sharma
08ef62531d
fix: removeRoute should remove all matching routes (#9851) 2024-06-14 00:25:49 +03:00
Ayush Sharma
3428eb6a9e
feat: added support for filters in WebServer library (#9842)
* feat: added support for filters in webserver

* feat: add setFilter function in StaticRequestHandler

* fix: ON_STA_FILTER & ON_AP_FILTER

* fix: make request handlers backward compatible

* fix: ON_STA_FILTER & ON_AP_FILTER

* fix: more filters to their own example

* chore: grammar

* fix: remove filters from header file

* fix: use same root route for both interfaces

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-14 00:25:20 +03:00
Me No Dev
1d895e58e7
fix(xtal): Add a way to change the XTAL frequency for SparkFun ESP32 Thing (#9844)
* fix(xtal): Add a way to change the XTAL frequency

Add support for boards like SparkFun ESP32 Thing that use 26MHz XTAL

* ci(pre-commit): Apply automatic fixes

* feat(dbg): Print the XTAL frequency in the debug report

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-13 10:26:54 +03:00
Ayush Sharma
849ec57ca6
Added support for removing routes in WebServer library (#9832)
* feat: added removeRoutes and removeHandler methods

* feat: added removeRoute and removeHandler methods

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-13 08:51:32 +03:00
Me No Dev
211520b4ba
fix(client): Fix NetworkClient::localIP() (#9845)
It was returning zero, because it was not able to handle IPv4 mapped address into IPv6 address
2024-06-13 08:40:06 +03:00
Me No Dev
bc79feb217
fix(client): Implement readBytes in NetworkClient for faster downloads (#9824)
* fix(client): Implement readBytes in NetworkClient for faster downloads

* fix(client): Implement readBytes to obey the client timeout

* fix(clieant): use getTimeout() instead

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-13 08:39:04 +03:00
Me No Dev
1ef2208349
feat(crypto): Add libsodium to the included components (#9821) 2024-06-13 08:38:25 +03:00
Lucas Saavedra Vaz
a31a5fca17
fix(ci): Fix issues found in workflows (#9829)
* ci(tests): Swap cache to artifacts to avoid errors between OSes

* ci(push): Fix chunk generation for compilation

* ci(tests): Fix error code propagation

* ci(push): Add shebang to new script

* ci(push): Fix sizes upload if there is no changes

* ci(bot): Fix GitHub actions bot commit info
2024-06-13 07:53:42 +03:00
lbernstone
e382746b95
feat(sdmmc): Add RAW disk functions (#9796)
* feat(sdmmc): Add RAW disk functions

feat(sdmmc): fixed printf mismatches and missing callback

feat(sdmmc): added ci.json

Removed excess log_i

* ci(pre-commit): Apply automatic fixes

* Fixed sdmmc host check to pass CI

* feat(sdmmc): fixed example USB check

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-06-12 08:53:54 +03:00
Rodrigo Garcia
575a415719
fix (adc): fixes limit test (#9807)
Fixes analogContinuousSetWidth() border test.
2024-06-10 15:31:30 +03:00
Lucas Saavedra Vaz
034d568d7c
ci(wifi): Add scan to wifi test (#9805) 2024-06-10 15:30:46 +03:00
Lucas Saavedra Vaz
2928654027
change(idf): Rename component example and fix compilation warnings (#9801)
* change(idf): Rename component example

* ci(push): Fix steps conditions

* ci(tests): Remove unnecessary concurrency

* ci(push): Fix step condition

* fix(idf): Fix compilation warnings when as component
2024-06-10 15:30:18 +03:00
Lucas Saavedra Vaz
e3fedc5e8c
ci(refactor): Fix workflows and small improvements (#9793)
* ci(fix): Fix new workflows

* ci(pre-commit): Properly cache python modules

* fix(get.py): Verify files after extraction and make it more readable

* ci(idf): Compile as component when libs change

* ci(wokwi): Re-enable cache for wokwi tests

* ci(tests): Run scripts only from master

* Revert "fix(get.py): Verify files after extraction and make it more readable"

This reverts commit cc40edb40766ea8a013c0d76326bc57314418bff.

* ci(compilation): Fix changed files check

* ci(wokwi): Disable tests that use scenarios
2024-06-07 12:29:27 -03:00
Unexpected Maker
5d9cd9ac58
Added new UM FeatherS3 Neo board. (#9788)
* Added new UM FeatherS3 Neo board.

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-06 23:25:43 +03:00
Lucas Saavedra Vaz
297757a6bf
fix(readme): Fix tests badge (#9781) 2024-06-05 21:12:06 +03:00
Me No Dev
2ba3ed33c1
IDF release/v5.1 3f9ab2d6a6 (#9770) 2024-06-05 15:25:36 +03:00
Lucas Saavedra Vaz
f5b8e27df7
ci(refactor): Refactor workflows and skip files (#9696)
* ci(refactor): Refactor workflows and skip files

* ci(refactor): Refactor workflows and skip files

* ci(refactor): Improvements and compilation of only related files

* ci(refactor): Delete duplicated steps

* ci(refactor): General improvements

* ci(refactor): Delete duplicated lines

* ci(refactor): Rename jobs
2024-06-05 15:19:25 +03:00
Me No Dev
ebb77c4611
Update Issue-report.yml with version 3.0.1 2024-06-05 10:54:11 +03:00
Ha Thach
cc50d90ce4
add upload_port vid/pid for adafruit boards (#9779) 2024-06-05 09:52:14 +03:00
Paul Price
e99f40cadd
Updated Smart Bee Boards for ID2 & CLI (#9778) 2024-06-05 09:51:59 +03:00
SooDragon
640523827b
fix: Changed Board name (#9773)
fix: Changed Board name
2024-06-04 21:14:44 +03:00
Me No Dev
dc5bd3814c
fix(release): Shorten all toolchain names/versions (#9760)
Helps to overcome the limit of windows path, when the usernames are long.
2024-06-04 09:46:50 +03:00
Me No Dev
04427c9934
feat(partition): Add 4MB No File System partition scheme (#9769)
Adds partition scheme with two apps, 2MB each.
2024-06-04 07:58:39 +03:00
Me No Dev
55ec22f2e5
fix(ssl): Fix load stream memory leak (#9767)
* fix(ssl): Fix load stream memory leak

Loading Ca Cert/Certificate or Private Key from stream was leaking memory, due to buffers not being freed.

* fix(ssl): Cast the buffers to non-const
2024-06-04 07:58:21 +03:00
Lucas Saavedra Vaz
ce229a1708
docs(component): Improve Arduino as component documentation (#9765) 2024-06-04 07:58:05 +03:00
Me No Dev
546ce3806b
fix(tls): do not attach bundle from runtime (#9763)
* fix(tls): do not attach bundle from runtime

* fix(ssl): Make the bundle callback per context
2024-06-04 07:57:47 +03:00
Me No Dev
de2fc251db
fix(idf): Require MDNS as public (#9764)
* fix(idf): Require MDNS as public

Included in Arduino's public headers

* fix(idf): Switch to require through the component yaml
2024-06-03 20:22:40 +03:00
Me No Dev
f742b742f1
feat(idf): Require esp_psram when as component (#9762)
* feat(idf): Require esp_psram when as component

* fix(idf): Move requirement to private
2024-06-03 20:22:09 +03:00
Me No Dev
8b4c1303f4
feat(usb): Support the new USB IDF API (#9761)
* feat(usb): Support the new USB IDF API

Required for the latest ESP-IDF release/v5.1

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-03 15:45:31 +03:00
me-no-dev
97c98eb0cb Update core version to 3.0.1 2024-06-03 13:09:02 +03:00
Me No Dev
ffeebf8da8
fix(esp): Fix getFlashChipMode breaking on S3 and C3 (#9758) 2024-06-03 13:04:42 +03:00
Me No Dev
e33022f3f0
fix(boards): Add missing parameter to esp32_family for IDE1 (#9759) 2024-06-03 13:02:33 +03:00
Jan Procházka
a62ad55c31
feat(boards): Add Zigbee menu for C6/H2 boards (#9754) 2024-06-03 10:42:02 +03:00
Jan Procházka
f447a92724
ci(sizes): Sites test between master and 2.x branch (#9755)
* ci(sizes):  Sites test between master and 2.x branch

* ci(sizes): Remove if as its manual trigger
2024-06-03 10:19:51 +03:00
Me No Dev
21228117ff
feat(scan): Allow setting scan timeout in milliseconds (#9738) 2024-06-03 10:10:08 +03:00
Juraj Andrássy
58e61efa44
ci(external_libs): Add EthernetESP32 to ext. libraries compilation test (#9747) 2024-06-03 10:05:08 +03:00
Me No Dev
00fb7993ad
feat(tools): Updated get.py with ability to verify extracted files and skip if ok (#8720)
* Updated get.py with ability to verify extracted files and skip if ok

* Updates

* Minor fixes

* Push binary to tools

* Fix formatting and add checksum comparison

* Push binary to tools

* Skip checksum for libs

* Push binary to tools

* ci(pre-commit): Apply automatic fixes

* Push binary to tools

* Make the linter happy

* Push binary to tools

* refactor(get.py): Small improvements

* fix(get.py): Fix parent folder name

* ci(pre-commit): Apply automatic fixes

* Push binary to tools

* fix(get.py): Fix header comment

* Push binary to tools

---------

Co-authored-by: Tomas Pilny <tomas.pilny@espressif.com>
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: lucasssvaz <lucasssvaz@users.noreply.github.com>
2024-06-03 10:04:22 +03:00
Unexpected Maker
c16a325439
Updated UM boards for IDE2 & CLI (#9726)
* Updated UM boards for IDE2 & CLI

* Removed unwanted UM_RMP folder.
2024-05-30 14:19:03 +03:00
Mathieu Carbou
16b1aeb745
fix(net): Fix IPv4 address construction from ip_addr_t and comparison (#9724) (#9725) 2024-05-30 14:18:46 +03:00
Juraj Andrássy
f1cb6b83fa
fix(variant): Arduino Nano ESP32 variant fix for version 3 (#9722) 2024-05-30 14:18:31 +03:00
per1234
79b835059f
feat(tools):Use Windows native path separator in ESP_SR model copy command pattern (#9649)
* fix(platform): Use Win path separator in ESP_SR copy command pattern

Although Windows generally supports the use of the POSIX compliant slash path separator in addition
to the Windows native backslash separator, in the specific use case where a path is present in a
native command executed via an argument to `cmd /c` in a platform command pattern, it is mandatory
to use backslash path separators.

Previously, a slash path separator was used in the `tools.esp32-arduino-libs.path` and
`compiler.sdk.path` platform properties, which were referenced in a `copy` command in the `cmd /c`
argument part of the platform's `recipe.hooks.objcopy.postobjcopy.2.pattern.windows` command
pattern. This caused compilation to fail with a "The syntax of the command is incorrect." error
under the following conditions:

- The compilation is performed on a Windows machine
- The compiled sketch uses the ESP_SR library

This is fixed by adding Windows override variants of the properties, with backslash path separators.

* fix(release): Remove windows path to libs when releasing

---------

Co-authored-by: me-no-dev <hristo@espressif.com>
2024-05-29 14:26:51 +03:00
Jan Procházka
55e340ce47
docs(libraries): Add new SoCs H2 and C6 to missing parts in docs (#9709)
* docs(libraries): Add new SoCs

* docs(): Add C2 and H2 to USB and getting started

* docs(): Fix table format

* docs(extension): Add sphinxemoji support

* docs(): Lower emoji version

* Revert "docs(): Lower emoji version"

This reverts commit 3f3e0adf3c3c585bb439b182c77708fce23bd0b9.

* Revert "docs(extension): Add sphinxemoji support"

This reverts commit e903da689d4531f7fa7327e042206a4cdc3422a8.

* docs(): Shrink peripherals table

* docs(): Shrink table even more

* docs(): Shrink table more and more

* docs(): Shrink table the most I am able to
2024-05-29 13:04:46 +03:00
Me No Dev
f772fcadfd
fix(boards): Remove duplicate VID/PID from boards.txt and add default CDC/JTAG board (#9717)
* fix(boards): boards must define unique VID/PID

Also adds a hidden board with the default VID/PID of USB CDC/JTAG in order to always show that in IDE when ESP32 CDC/JTAG device is connected

* fix(boards): Skip test for the generic board

* Trigger board test

* fix(boards): Make discovery work on IDE2
2024-05-29 13:00:07 +03:00
Me No Dev
a4ee652506
fix(net): Don't unregister events if there are interfaces still open (#9706)
* fix(net): Don't unreg events if there are netifs

Unregister IP events only if all other netifs are stopped.

* fix(eth): Delete mac and phy on end

* fix(net): Update pin naming and log levels
2024-05-29 07:43:28 +03:00
Brent Picasso
10a48f52e8
Addition (3rd_party_board): Add board support for Autosport Labs ESP32-CAN-X2 development board (#9683)
* add board support for Autosport Labs ESP32-CAN-X2 development board

* change(board-support): Add board support for Autosport Labs ESP32-CAN-X2 development board

* change(board-support) - remove entries that are already globally defined

* change(board-support) rename board name

* change(board-support) switch ASL-CAN-X2 to ASL_CAN_X2

* change(board-support) fix formatting, correct USB VID/PID to match our own product

* Update variants/aslcanx2/pins_arduino.h

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* Update variants/aslcanx2/pins_arduino.h

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-05-29 07:42:45 +03:00
Adrian Immer
d8e1374dc3
ci(external_libs): Add ZACwire to External libraries compilation test (#9705)
* Add ZACwire to External libraries compilation test

* fix example path

* fix(lib): fixed link to right examples

The previously linked example wasn't working, so I linked two other examples, which are more up to date
2024-05-28 22:33:21 +03:00
Jan Procházka
3267469015
fix(ci): Compare correct name of the artifact (#9708) 2024-05-28 16:39:34 +03:00
Me No Dev
62bf719186
fix(IDF): Define max IDF version for the component (#9703)
Fixes the issue, where the component is shown as compatible with ESP-IDF 5.2, while in fact isn't.

cc: @igrr
2024-05-28 14:40:47 +03:00
Lucas Saavedra Vaz
d45f35a2c8
ci(wokwi): Self host Wokwi CLI server (#9701)
* ci(wokwi): Self host Wokwi CLI server

* ci(event_file): Fix file upload

* change(tests): Re-run once on test failure
2024-05-27 21:35:57 +03:00
Me No Dev
3925d51839
fix(release): install missing 'packaging' package (#9698)
* fix(release): install missing 'packaging' package

Necessary to combine the json files

* Update .github/workflows/release.yml

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-05-27 19:28:00 +03:00
Lucas Saavedra Vaz
dcfb257496
change(readme): Update C6 and H2 support (#9697) 2024-05-27 19:07:27 +03:00
Me No Dev
2b0404bf1c
feat(reports): Update Issue-report.yml with new versions (#9699)
Adding missing versions from Issue Report form
2024-05-27 19:07:06 +03:00
Me No Dev
b3ad98cbf6
fix(release): Update merge_package.py (#9694)
Use packaging.version instead of the deprecated distutils.version
2024-05-27 17:13:59 +03:00
Matti Airas
d94b32ed20
fix(esp-hal-log):Provide a default TAG name for USE_ESP_IDF_LOG logging macro (#9686)
* change(logging): Provide a default TAG name for USE_ESP_IDF_LOG

The ESP-IDF logging library has some nice features such as log
forwarding. esp32-hal-log.h has long supported the USE_ESP_IDF_LOG
macro, but due to subsequent changes, it requires a global TAG
preprocessor macro to be defined. The macro name is too generic and
just having a sane default would be preferable.

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-05-27 16:34:40 +03:00
Tarosa
8091b7a77c
feat(3rd_party_board):Add GPIO pin mappings for M5Stack CamS3 Unit and select OPI PSRAM by default (#9688)
* feat(camera): Add GPIO pin numbers for M5Stack CamS3 Unit

* docs(troubleshooting): Update guide for M5UnitCamS3 PSRAM configuration

* fix(): Remove QSPI option from M5Stack CamS3

* ci(pre-commit): Apply automatic fixes

* fix(): Make OPI PSRAM option as default

* fix(): Revert troubleshooting addition

---------

Co-authored-by: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-05-27 16:34:24 +03:00
Jan Procházka
ca28e65f4d
fix(adc): Remove masking for channel number (#9692) 2024-05-27 15:30:18 +03:00
Me No Dev
4717585421
fix(eth): Fix ETH.stop() with IDF SPI (#9693) 2024-05-27 15:30:01 +03:00
Leandro Mattioli
097f2ab903
docs(ledc):Fixed outdated function signature (void ledcWrite instead of bool ledcWrite) (#9680) 2024-05-27 12:09:20 +03:00
monte-monte
316c021b44
Update Kconfig.projbuild (#9684)
Fix selective compilation to include LittleFS library when checked in menu.
2024-05-27 12:08:47 +03:00
Luca Burelli
d164df89de
fix: remove "programmer.default" from Nano ESP32 (#9666)
Setting programmer.default has unfortunately multiple effects:
- sets the tick by default in the Tool menu in the IDE (which was the
  expected behavior),
- forces the CLI to use the specified programmer every time an upload is
  attempted (which is confusing users).

For this reason, it is better to remove the "programmer.default" setting
from the board definition and let the user choose the programmer in the
IDE menus, as it was before.
2024-05-22 13:59:07 +03:00
Me No Dev
ee081b988f
fix(eth): Fix ETH.end() (#9661)
* fix(eth): Fix ETH.end()

* fix(eth): set glue handle to NULL
2024-05-22 09:51:20 +03:00
Me No Dev
b1c9506489
feat(eth): Enable the possibility to use SPI ETH with only 4 wires (#9659)
This PR enables ETH_SPI_SUPPORTS_NO_IRQ to support connection by only 4 wires (SCK, MISO, MOSI and SS) with IRQ and RESET being set as -1
2024-05-21 23:10:06 +03:00
Me No Dev
f2e064d0c2
fix(eth): Attach ETH events at the correct place (#9658)
This is to ensure that stack events are called before ours, because callbacks are called in order of attaching
2024-05-21 23:09:39 +03:00
ZY
82c36a2fcc
feat: add support for WeAct Studio ESP32C3 (#9653) 2024-05-21 16:45:26 +03:00
Alex
196e4409c7
updated ESPDuino with extra options (#9642) 2024-05-21 16:45:11 +03:00
Jan Procházka
50ef6f4369
Zigbee examples update (#9627) 2024-05-15 18:13:41 +02:00
Me No Dev
356e738ee3
Add support for specifying a WPA2 EAP-TTLS phase 2 method to WiFi.begin (#9639) 2024-05-15 18:12:52 +02:00
Me No Dev
f6cbea13b7
feat(usb): Remove redundant absolute mouse support (#9640) 2024-05-15 18:12:18 +02:00
Me No Dev
6adeca446b
fix(cdc): Disable SOF interrupt and CDC reset on begin() (#9628)
* fix(cdc): Disable SOF interrupt and CDC reset on begin()

* feat(jtag/hwcdc): uses SOF detection from IDF

Restores back IDF 5.1 SOF detection method in order to fix the HW CDC uploading process.

Enabling SOF mask in the ISR routine causes a problem with esptool uploading when using CDC/JTAG port.

* feat(jtag/hwcdc): uses SOF detection from IDF

Restores back IDF 5.1 SOF detection method in order to fix the HW CDC uploading process.

Enabling SOF mask in the ISR routine causes a problem with esptool uploading when using CDC/JTAG port.

* feat: revert include 

This include is not necessary here.

Moving it back to the HWCDC.cpp file.

* feat: adding a necessary include 

Adding the IDF 5.1 SOF check include file.

Necessary to make it compile. Moved from HWCDC.h file to here.

* feat: move function call to header file

* feat: Moved SOF function

* feat: Removed unused header file

* fix: Use correct SOF header file

* ci(pre-commit): Apply automatic fixes

* Small fixes for Debug prints on C3, C6 and H2

* fix(usb): Fix log prints

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-05-15 13:58:45 +02:00
Jan Procházka
7acd875b78
fix(ledc): Match channel number with groups (#9638) 2024-05-15 13:16:28 +02:00
Juraj Andrássy
3d92edecf1
fix: NetworkClientSecure - copyability improvements (#9632)
and _timeout shadowing fixed
2024-05-15 13:16:06 +02:00
Rodrigo Garcia
c7b98a51aa
Update esp32-hal-uart.c (#9637) 2024-05-15 13:15:28 +02:00
Me No Dev
a3c8a48eed
fix(net): Add back the friend classes required for Ethernet.h to work (#9635) 2024-05-15 13:15:10 +02:00
Lucas Saavedra Vaz
4db2eddd22
docs(c2): Add note about ESP32-C2 support to documentation (#9629) 2024-05-14 23:00:31 +02:00
Lucas Saavedra Vaz
5de054b47a
ci(wokwi): Fix concurrency (#9625) 2024-05-14 12:50:18 +02:00
Lucas Saavedra Vaz
5dd46926c9
docs(lib-builder): Add docker image documentation (#9621)
* docs(lib-builder): Add docker image documentation

* docs(lib-builder): Add note about git

* docs(lib-builder): Fix windows command

* Apply suggestions from code review

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-05-14 12:46:03 +02:00
OlimexSupport
cb968a7763
Reduced GPIO17 (Ethernet clock GPIO) signal strength to reduce noise. (#9623)
* Create variant.cpp

Reduced Ethernet clock GPIO signal strength to reduce noise.

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: DanKoloff <lubchoh@yahoo.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-05-14 03:44:00 -03:00
Me No Dev
0c4b35e07e
IDF release/v5.1 (#9613)
* IDF release/v5.1 01b912a9e5

* Fix USB OTG Init on new IDF

* Delete libraries/TFLiteMicro/examples/micro_speech directory

Done in order to fix a CI problem created by an entire folder that was removed in original Library Repository.

* IDF release/v5.1 442a798083

* Update esp32-hal-tinyusb.c

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2024-05-14 01:04:12 +02:00
Lucas Saavedra Vaz
e10de73e61
ci(qemu): Add QEMU emulator to CI (#9558)
* ci(qemu): Add QEMU emulator to CI

* ci(qemu): Fix windows build

* ci(qemu): Fix skips

* ci(qemu): Skip performance tests

* ci(qemu): Disable QEMU tests for now

* fix(platform): Fix build script recipe number
2024-05-13 23:09:10 +02:00
Juraj Andrássy
ea27a98252
NetworkClientSecure made copyable (#9612)
* NetworkClientSecure made copyable

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-05-13 17:36:59 +02:00
Happy Code Farm
a04fceee2f
feat(usbmsc): Add is_writable function to the USBMSC class. (#9569)
* (feat)usbmsc: Add is_writable function

Add is_writable function to the USBMSC class.
Allows USBMSC to be mounted in read-only mode.

* Update USBMSC.ino

Changes to USB Mass Storage (MSC) example code in Arduino USB library

* Added MSC.isWritable(true) line to set the disk as writable

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-05-13 15:10:45 +02:00
Juraj Andrássy
e8e251abc6
NetworkClient - close the connection in stop() method (#9542)
* fix: NetworkClient - close the connection in stop() method

for all copies referring it

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-05-10 16:49:34 +02:00
Deadolus
78bb452f8b
BLEAdvertising.h: Fix spelling mistake in setScanFilter parameter (#9609) 2024-05-10 14:15:41 +02:00
SooDragon
e1cec30494
fix: I2C pin are relocated for arduino nano compatability (#9610)
fix: I2C pin are relocated for arduino nano compatability
2024-05-10 14:10:42 +02:00
Rob58329
afa5f41328
Arduino core for the esp32 - Add new function "bool isDirty()" to EEPROM.h and EEPROM.cpp (#9611)
* Update EEPROM.h - Added new function: bool isDirty()

* Update EEPROM.cpp - Added new function: bool isDirty()
2024-05-10 14:10:29 +02:00
Jan Procházka
84376a765a
ci(hil): Touch skip file whe platform is skipped (#9605) 2024-05-09 13:52:50 -03:00
Craig Link
e883a2ccfa
define HTTP_METHOD_STR as static const to save RAM (#9594) 2024-05-08 08:08:18 +03:00
Me No Dev
c2971f5fe6
IDF release/v5.1 d06c758489 (#9603) 2024-05-08 08:07:32 +03:00
Lucas Saavedra Vaz
789b1a8425
ci(wokwi): Add Wokwi emulator to workflow (#9540)
* ci(wokwi): Add wokwi emulator to CI

* feat(wokwi): Support scenario

* feat(wokwi): Add simple CI test for push button

* sudo apt command

* sudo both apt commands

* Add missing test.py file

* Test pytest path changes

* empty push

* move wokwi cli token variable

* move token back to wokwi job

* Update hil.yml

* Update hil.yml

* revert run on pr

* run on PR target

* run only on master

* ci(wokwi): Support wokwi

* ci(wokwi): Skip unsupported and performance test

* ci(wokwi): run wokwi tests without label

* debug: run build on windows

* RUN WIFI WITH PSRAM ON-OFF

* fix psram for S3

* Revert "debug: run build on windows"

This reverts commit bc085e50502eb470836276097fa45ee0e2374ed1.

* ci(wokwi): Run workflow only if build was sucessful

* ci(pre-commit): Apply automatic fixes

* ci(wokwi): Add generated files to gitignore

---------

Co-authored-by: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-05-07 18:46:19 +03:00
Jan Procházka
b59a3687c2
feat(ci): Run Wokwi tests on PR (#9597)
* feat(ci): Run Wokwi tests on PR

* fix(ci): Concurrency change to wokwi

* ci(wokwi): Fix skipped tests
2024-05-07 14:36:36 +02:00
Lucas Saavedra Vaz
1299582047
ci(performance): Add performance tests to CI (#9560)
* ci(performance): Add performance tests to CI

* ci(req): Fix requirements

* ci(pre-commit): Apply automatic fixes

* ci(pre-commit): Increase maximum allowed complexity for python

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-05-07 13:16:13 +02:00
Me No Dev
c396834696
fix(config): Fix wrong names in Kconfig that cause Network and NetworkClientSecure to fail (#9583) 2024-05-03 12:09:45 +03:00
Vojtěch Bartoška
5a023568a6
Typo_fix_installing_guide (#9581) 2024-05-02 13:17:30 +03:00
Gareth Coleman
2f7e7ad730
change(variant): add additional pin mappings and #define (#9577) 2024-05-02 13:17:01 +03:00
Lucas Saavedra Vaz
54d996eb03
docs(flags): Add build system breaking changes to migration guide (#9574) 2024-05-02 13:16:38 +03:00
Rodrigo Garcia
7e7c01aadf
feat (hwcdc): ports changes made in 2.0.15 (#9565)
* feat (hwcdc): ports changes made in 2.0.15

Ports many changes, fixes and improvements made in 2.0.15:
- correct use of timeout
- avoids problems with CDC ISR not reading data
- fixes problems with transmitting many bytes to USB Host
- changes how USB SOF and CDC connection is detected

* feat (HWCDC) : port 2.0.15 

Changed header for a few functions.

* feat (HWCDC): port 2.0.15 upwards

Fixes include file that is not necessary any more.

- SOF is used directly now.

* fix (HWCDC): removes left over

Removes a left over function from previous 3.0.0 code.

- just removing unused code.

* ci(pre-commit): Apply automatic fixes

* fix: typo and commentaries

This fixes a few commentaries.

Just a typo error.

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-04-29 18:16:37 +03:00
Rodrigo Garcia
84086cd4a2
feat (uart): change log level of UART events (#9563)
Changes from Warning to Verbose UART errors/warnings in order to make debugging easier, specially with UART BREAK.
2024-04-29 18:15:40 +03:00
Unbinilium
b6f7d403d1
fix(hal-uart): truncated tx/rx buffer size (uint16_t -> uint32_t) (#9554) 2024-04-29 18:14:22 +03:00
Juraj Andrássy
cf448906b3
Ethernet - MAC address parameter for beginSPI (#9539)
* feat: Ethernet - MAC address parameter for beginSPI

and `friend class EthernetClass`
as support for potential Arduino API compatibility layer

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-04-20 03:05:05 +03:00
Lucas Saavedra Vaz
86b3163c62
ci(install): Change "arch" to distro-agnostic "uname -m" (#9537) 2024-04-19 21:34:47 +03:00
Me No Dev
ae0dc17339
fix(release): Temporary halt JSON uploads on release, until generator is fixed (#9536)
* fix(release): Temporary halt JSON uploads on release, until generator is fixed

* fix(script): enable JSON upload to release page
2024-04-19 19:52:01 +03:00
Lucas Saavedra Vaz
6bfcd6d9a9
refactor(style): Change some style options (#9526)
* refactor(style): Change some style options

* refactor(style): Apply style changes
2024-04-19 18:16:55 +03:00
Lucas Saavedra Vaz
8cab8c9b31
ci(libs): Add concurrency group to external libs test (#9535) 2024-04-19 17:40:33 +03:00
Jan Procházka
9db4a4b72f
Fix External libs test to not upload PR number if not labeled (#9534) 2024-04-19 16:09:49 +03:00
SooDragon
8e75498841
fix: add variable for support internal built in switch (#9499)
fix: add variable for support internal built in switch

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2024-04-19 15:56:20 +03:00
Lucas Saavedra Vaz
2c39877468
ci(pre-commit): Fix PR checks and cache (#9531) 2024-04-19 15:53:45 +03:00
Me No Dev
4960d86ba2
Add support for PPP Modems to Arduino (#9518)
* feat(ppp): Add support for PPP Modems

* feat(sdk): Add libs with PPP enabled

* ci(pre-commit): Apply automatic fixes

* IDF c432c692fa (#9527)

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-04-19 15:50:50 +03:00
Darkl0ud
6b3a9a9bff
Fixed typo for adc_continuous_data typedef in esp32-hal-adc.h/.c (#9529)
* Fixed typo in adc_continuous_data typedef

Fixed typo in adc_continuous_data typedef

* Additional typo fix for adc_continuous_data typedef

Additional commit for previous commit (#9529) adding typo corrections within

1. /docs/en/api/adc.rst
2. /libraries/ESP32/examples/AnalogReadContinuous\AnalogReadContinuous.ino
3. tests/periman/periman.ino

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-04-19 12:42:41 +03:00
Me No Dev
4070a8799f
IDF release/v5.1 (#9528)
* fix(ble): rename esp_ble_gap_ext_adv_report_t

* IDF release/v5.1 d23b7a0361

* IDF release/v5.1 c432c692fa
2024-04-18 13:42:35 +03:00
Jan Procházka
0219c213ce
[CI] Get sizes from push workflow, updated build scripts (#9524)
* Remove event-file from External libs wf

* Add compilation log to the build scripts

* Add 2nd compilation run on base branch

* Fix sketch_utils script

* Update on-push.sh

* Update Push workflow

* Upload pr number in lib.yml

* Fix PR number in publish sizes

* Update external libs results with pr num file
2024-04-18 12:52:39 +03:00
Lucas Saavedra Vaz
e33543c7ea
ci(pre-commit): Enforce that the pre-commit checks are run before merge (#9525)
Fix
2024-04-17 20:27:39 +03:00
Jan Procházka
66c96dd3d1
[CI] Add Sizes Results workflow + fix of External lib results (#9523)
* Add Sizes Result workflow

* Fix External Libs results workflow
2024-04-17 13:51:26 +03:00
Lucas Saavedra Vaz
8d21d6180a
ci(touch_test): Change released test value for ESP32 (#9521) 2024-04-17 13:49:22 +03:00
Lucas Saavedra Vaz
a45b5af489
feat(doc): Add note about default pin changes to migration guide (#9507) 2024-04-15 23:09:34 +03:00
Jason2866
9caa3638f0
add LittleFS as partition type (#9354)
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-04-15 23:08:52 +03:00
Lucas Saavedra Vaz
da5c6ab9ae
Refactor repository with pre-commit hooks (#9515)
* Add Config

* Add Cache and remove pre-commit action

* [pre-commit.ci lite] apply automatic fixes

* Remove freeze

* Fix

* Update action

* Use latest stable Python 3 version

* Improve caching

* Improve cache tag

* Improve bot message

* fix(typos): Fix typos

* fix(typos): Fix more typos

* refactor(udp_server): Convert script from Python 2 to 3

* Fix whitespace

* Clang-format fixes

* Prettier fixes

* Black formatting

* Manual fixes

* Line endings

* Fix flake and make Vale manual

* Fix flake and reformat

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2024-04-15 19:40:56 +03:00
Lucas Saavedra Vaz
4909decbff
Style Checker and Pre-commit hook CI (#9132)
* Add Config

* Add Cache and remove pre-commit action

* [pre-commit.ci lite] apply automatic fixes

* Remove freeze

* Fix

* Update action

* Use latest stable Python 3 version

* Improve caching

* Improve cache tag

* Improve bot message

* Fix flake and make Vale manual

* Add filter

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2024-04-15 18:41:51 +03:00
Lucas Saavedra Vaz
557380682c
refactor(udp_server): Convert script from Python 2 to 3 (#9513) 2024-04-15 17:44:38 +03:00
Evgeni Melan
05967332e5
change(roboheart): Update of LED_ROBOHEART in RoboHeart Hercules pins_arduino.h (#9494) 2024-04-15 14:48:02 +03:00
Ikko Eltociear Ashimine
394ebb673b
Fix typo in Updater.cpp (#9511)
arguement -> argument
2024-04-15 12:00:31 +03:00
Lucas Saavedra Vaz
908ca9f022
fix(ftm): Fix compilation warning (#9508) 2024-04-15 11:07:08 +03:00
Me No Dev
49b94644c6
IDF release/v5.1 (#9498)
* fix(ble): rename esp_ble_gap_ext_adv_report_t

* IDF release/v5.1 d23b7a0361
2024-04-12 18:21:27 +03:00
Sly Gryphon
3a0dd1cbe5
fix(dns): Fix IPv6-only network, by checking IPv6 first if you have public address (#9443)
Work around because AF_UNSPEC does not check available addresses when
determining result.

If you have a global scope IPv6 address, then first check for IPv6 DNS result;
if you don't have an IPv6, or there is no IPv6 result, then check IPv4.

This allows IPv6-only networks to connect to dual-stack destinations, as they
will get the IPv6 address (rather than the unusable IPv4).

It also means a dual-stack host to a dual-stack destination will preference
IPv6.

There is no effect if you are on an IPv4-only network, or it is an IPv4-only
destination.
2024-04-12 12:28:12 +03:00
Rodrigo Garcia
04b70bbf6a
Change name to HWCDC_Events.ino (From HWSerial_Events.ino) (#9483)
* Create HWCDC_Events.ino

* Delete libraries/ESP32/examples/HWSerial_Events/.skip.esp32

* Delete libraries/ESP32/examples/HWSerial_Events/.skip.esp32s2

* Delete libraries/ESP32/examples/HWSerial_Events/HWSerial_Events.ino

* Create .skip.esp32

* Create .skip.esp32s2

* Fixes HWCDC_Events.ino

* Fixes CI for S3
2024-04-11 18:19:11 +03:00
Nathan Nau
93448d7f34
Handle large octet-stream (master branch) (#9440)
* Handle large octet-stream

* Add exemple Upload Huge File

* Remove unuse function printDirectory

* Fix upload path

* Simplify and generalize the body parsing.

* Create .skip.esp32h2

---------

Co-authored-by: me-no-dev <hristo@espressif.com>
2024-04-11 14:42:31 +03:00
s-hadinger
f7b4959994
fix(ethernet): move event listener earlier to avoid missing event ETH_CONNECTED (#9481)
* Ethernet: Move event listener earlier

* fix(ethernet): move network listener after initNetif
2024-04-11 01:55:32 +03:00
Me No Dev
8c75c35290
feat(wifi): Add support for NAPT to WIFI AP (#9478)
Allows another interface's connection to be shared to the AP
2024-04-10 15:09:22 +03:00
Rodrigo Garcia
8ceb4bacb2
fix: USB HID Keyboard raw report (#9473) 2024-04-10 11:54:31 +03:00
Sly Gryphon
858b107bdf
feat(dns): Check type of IP addresses and clear DNS cache if they changed (#9476) 2024-04-10 11:53:16 +03:00
Sly Gryphon
17888679c7
fix(tls): Enable IPv6 support in ssl_client connect (#9470)
Similar to NetworkClient, check the family of the passed in address and configure the socket and socket address accordingly, for both IPv6 and IPv4 support.
2024-04-09 16:33:51 +03:00
Jan Procházka
b6ca5a8630
fix(sd): AquireSPI lock in sdcard_uninit (#9468) 2024-04-09 14:01:43 +03:00
Rodrigo Garcia
34f5456f51
fix: HW CDC write() (#9401)
When writing a stream of data to the HW CDC of S3/C3/C6/H2, the SoC looses some bytes and don't send them all.

This fix makes it work fine.
2024-04-08 15:17:40 +03:00
Me No Dev
8dbb7c0c13
feat(net): Add support for esp_netif flags (#9460)
* feat(net): Add support for esp_netif flags

Provides better automation for setting IP/DNS

* feat(net): Show DHCPC status as OFF when static IP is used
2024-04-08 12:10:11 +03:00
Juraj Andrássy
0a47f34b34
docs migration guide: WiFiServer changes (#9458)
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-04-07 02:01:47 +03:00
Me No Dev
d805b88c32
feat(net): Add support for selecting the default network interface (#9457) 2024-04-05 15:38:11 +03:00
Juraj Andrássy
9b32541c0c
WiFiClient - rename flush() to clear() (breaking) (#9453)
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-04-05 14:41:26 +03:00
Me No Dev
cff2a18aa2
Add option to specify AP auth mode and cipher (#9454) 2024-04-04 13:27:06 +03:00
Lucas Saavedra Vaz
78820f2236
ESP-NOW: Fix examples and improve logging (#9455) 2024-04-04 13:25:01 +03:00
Lucas Saavedra Vaz
dcc307665f
Fix NetworkManager compilation warning (#9452) 2024-04-04 00:04:43 +03:00
Sly Gryphon
64235dc6d6
Network refactoring - fix some IPv6 DNS issues (#9439)
* fix(dns): Handle IPv6 DNS server address results

If the result from esp_netif_get_dns_info is an IPv6 address, then parse to an IPAddress.

* fix(dns): Use getaddrinfo for DNS, to fix some IPv6 issues

Replace hostbyname with getaddrinfo for better IPv6 support. The API is also
simpler, as it has no callbacks (they are handled internally). Allows
dual-stack networks to connect to IPv6-only destinations.

Still does not work for IPv6-only networks, as IPv6 DNS is not enabled in the
pre-built ESP-IDF libraries.
2024-04-03 18:23:11 +03:00
Jan Procházka
1a80829435
Add ESP-NOW Arduino library (#9395)
* feat(libs): Add ESP-NOW Arduino library

* Update libraries/ESP_NOW/src/ESP32_NOW.cpp

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* Update libraries/ESP_NOW/src/ESP32_NOW.cpp

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* fix(esp-now): Add check if Wifi is started.

* Fix ESP_NOW_Serial

* Add ESP NOW Serial Example

* Add comment

* Skip esp-now example for esp32h2

* Add broadcast address constant

* Change return value to align with other APIs

* Apply suggested changes

* Improve example

* Fix example

* Improve serial example

* Add argument to receive callback to know if a message was broadcasted

* Update libraries/ESP_NOW/src/ESP32_NOW_Serial.cpp

* Simplify example

* Add broadcast example

* Change comments

* Change comment

* Improve broadcast master example

* Remove examples using IDF's API

* Fix example

* Add network example

* Add skip file

* Add LMK back

* Add logs

* Improve example

* Fix example

* Apply @suglider suggestions from code review

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>

* Add documentation

* fix examples links in docs

* Apply @lucasssvaz suggestions to docs

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

* Update espnow.rst

* Update examples

* make onSent optional and remove underscores for virtual functions

* Make onRecieve also optional and make constructor protected

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: me-no-dev <hristo@espressif.com>
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2024-04-03 18:18:57 +03:00
Stanimir-Petev
6c6666adc2
ESP32-DevKit-LiPo PSRAM (#9451)
Added PSRAM menu (WROOM/WROVER option)
2024-04-03 10:34:13 +03:00
Juraj Andrássy
205781b921
core Server class back to Arduino Core API version (#9447) 2024-04-02 20:40:37 +03:00
Rodrigo Garcia
e709b9a388
Set Apache license to Update Library (#9446)
* feat: update license

* feat: update license

* feat: update license

* feat: update license

* feat: license

* Update Update.h

* Update HttpsOTAUpdate.h

* Update HttpsOTAUpdate.cpp

* Update HttpsOTAUpdate.cpp

* Update HttpsOTAUpdate.cpp

* Update HttpsOTAUpdate.cpp

* Update HttpsOTAUpdate.cpp

* Update HttpsOTAUpdate.h
2024-04-02 19:35:05 +03:00
Me No Dev
e4a57854a6
Ensure that Static IP configuration for network interfaces is kept until STOP (#9445) 2024-04-02 19:18:46 +03:00
Juraj Andrássy
3c1885f8ef
WiFi.config handle Arduino parameters ordering and auto dns,gw,mask (#9425)
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2024-04-02 18:36:54 +03:00
Ludovic BOUÉ
0523b94e1a
Add board definition for Wemos C3 Pico V1.0.0 - Lolin (#9442)
* Add board definition for Wemos C3 Pico V1.0.0 - Lolin

Add board definition for Wemos C3 Pico V1.0.0 - Lolin
https://www.wemos.cc/en/latest/c3/c3_pico.html

* Add board definition for Wemos C3 Pico V1.0.0 - Lolin (9442)

* feat(esp32): Add board definition for Wemos C3 Pico to boards.txt

* Wemos C3 Pico V1.0.0 - Lolin: Add SS pin to fix CI build

Wemos C3 Pico V1.0.0 - Lolin: Add SS pin to fix CI build

* Update boards.txt
2024-04-02 16:03:16 +03:00
Me No Dev
7bdf67e518
Use WiFi.mode to enable/disable the Network Interfaces (#9436) 2024-04-02 12:26:17 +03:00
Juraj Andrássy
7b29bac625
WiFi BSSID getter fix (#9434)
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2024-03-29 12:28:05 +02:00
powerfeatherdev
baca007957
Define Wire1 pins for ESP32-S3 PowerFeather (#9398) (#9431) 2024-03-29 12:13:26 +02:00
lbernstone
654aeada0a
Matched pin numbers in doco to numbers in variants files (#9422)
* Matched pin numbers in doco to numbers in variants files

* Non-breaking dashes

* Changed SD examples to make REASSIGN_PINS more transparent. Fixes #9082

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-03-27 12:07:12 +02:00
Jan Procházka
91c9ecd3c4
[DOC] Add core compatibility guide (#9417)
* docs(): Add core compatibility guide

* Update core_compatibility.rst

* Update core_compatibility.rst

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-03-27 12:06:49 +02:00
Me No Dev
f2026f1e34
3.0.0 Network Refactoring (#8760)
* Create ESP_NetworkInterface class and have Ethernet extending it

* Update CMakeLists.txt

* Split networking from WiFi (H2 can now use Ethernet)

Now all libs have been checked yet. More to do on WiFi side

* Fix build errors

* Guard WiFi classes and fix RMII ETH examples

* Decouple network related libraries from WiFi

* Fix examples and WiFiUpdate

* Guard WiFiProv lib to compile only on WiFi chips

* Add periman string for network and "fix" mdns on the first ETH

* Revert back location of Client/Server/Udp in order to accept some PRs

* Fix periman

* Some fixes from merging master

* Fix web server missing fs.h

* Move Client, Server and Udp out of WiFi

* More fixes

* more fixes

* Fix CMakekLists and rework lib menu dependencies

* Fix CMake issues

* move back WiFiClient to rebase with master

* Update ETH_TLK110.ino

* Move back WiFiClient

* Update progress

* Update WiFiGeneric.cpp

* More fixes

* Switch AP to the new interface

* Cleanup

* Rename AP methods

* Add extra interface info for Printable

* Rename IPv6 getters to clarify that they are returning LinkLocal address

cc @sgryphon

* Rename network classes

cc @sgryphon

* Update NetworkManager.h

* Rename WiFi Server and UDP

* Rename WiFiClient and WiFiClientSecure

* Update CMakeLists.txt

* Update on-push.sh

* Rename Network library

* Remove unnecessary guard

* Get the correct interface MAC address for mDND Workstation service

* Apply suggestions from code review

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-03-26 23:31:23 +02:00
Holger Lembke
e92b4ca62b
Add: make digitalRead() for RGB_BUILTIN work (#9419)
* make digitalRead() for RGB_BUILTIN work

Standard Arduino-Way of blinking a LED can be the shortest with:

void loop() {
  static uint32_t ledticker = 0;
  if (millis() - ledticker > 1000) {
    ledticker = millis();
    digitalWrite(RGB_BUILTIN, !digitalRead(RGB_BUILTIN));
  }
}

Worked with the old LED_BUILTIN on Pin 2, now even works with Pin 48/neopixel.

* Add: make digitalRead() for RGB_BUILTIN work

Standard Arduino-Way of blinking a LED can be the shortest with:

void loop() {
  static uint32_t ledticker = 0;
  if (millis() - ledticker > 1000) {
    ledticker = millis();
    digitalWrite(RGB_BUILTIN, !digitalRead(RGB_BUILTIN));
  }
}

Worked with the old LED_BUILTIN on Pin 2, now even works with Pin 48/neopixel.

(Retry. Didn't sync my local sources. Sorry.)
2024-03-26 17:46:59 +02:00
Rodrigo Garcia
6345350584
Adds a new example: onReceiveExample.ino (#9415)
* feat: onReceiveExample.ino

Adds a new example that uses HardwareSerial::onReceive(). The example demosntrates how to read all the data sent to UART0, considering that the end of transmission is defined by a period of time with UART in idle state.

* fix: onReceiveExample.ino

Fixes typos

* feat: add explanation header

* fix: mutex release

* fix: add Mutex verification

* feat: Mutex error message

* feat: Mutex NULL testing
2024-03-26 12:21:41 +02:00
Lucas Saavedra Vaz
9c0d59f9c4
Add method to set the WiFi radio channel (#9405)
* Add method to set the WiFi radio channel

* Fix Tab

* Add check

* Change name

* Fix description

* Add check

* Add error return

* Improve error message
2024-03-26 12:21:00 +02:00
Daniel Eisterhold
75f7b3303b
Add variant for Waveshare ESP32-S3-Touch-LCD-1.28 (#9386)
* feat(esp32): Add variant for Waveshare ESP32 board

Variant for https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-1.28

* feat(esp32): Add Waveshare ESP32 board variant to boards.txt

* fix(esp32): Update bootloader address and remove PSRAM flags

* fix(esp32): Updated boards.txt for Waveshare based on suggestions

* fix(esp32): Specify PSRAM type and remove unused board options

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: me-no-dev <hristo@espressif.com>
2024-03-26 12:20:39 +02:00
Lucas Saavedra Vaz
f9bb62a91f
Add MacAddress string constructor (#9400)
* Add MacAddress string constructor

* Change implementation
2024-03-22 12:50:23 +02:00
Daniel Eichhorn
29ede4826c
Add board definition for ThingPulse ePulse Feather C6 (#9399)
* feat: Add board definition for ThingPulse ePulse Feather C6

* fix: remove duplicated section for esp32c6
2024-03-21 14:26:52 +02:00
Akeem Hart
896f072f67
Fixing small typo in DiscoverConnect.ino BluetoothSerial example (#9389) 2024-03-20 14:11:59 +02:00
Jan Procházka
fcef7395e8
fix(boards): Fixes needed to pass CI all-boards-test (#9390) 2024-03-20 14:11:35 +02:00
Jan Procházka
c17a688b62
Feature: New Class MacAddress similar to IPAddress (#9304)
* Added new classes MacAddress and MacAddress8

In the same style as class IPAddress.
Based on Apache License.

* Update MacAddress8.h

* Added Printable, constructor and extra operators

Added a few changes to make it closer to IPAddress Class implementation.

* Added construtor and Printable

Makes it closer to IPAddress Class implementation

* Fixes include Printable

* Update MacAddress.cpp

* Update MacAddress.h

* Update MacAddress.cpp

* Added Printable

* Added Printble and some more operators

* Cleanup and bounds checking

Moved implementation details .h->.cpp.  Added bounds checking on index operators.  Added constructor to MacAddress8 to match MacAddress.

* Fixed printTo

Chars must be uppercase to match toString() and pass test

* feat(MAC): Rework API to support both 6+8 bytes MacAddress

* feat(MAC): Remove MacAddress8.h file

* fix(MAC): Remove comment + reorder lines

* Update toString function with single buf and return

* Fix buffer size for toString

---------

Co-authored-by: David McCurley <44048235+mrengineer7777@users.noreply.github.com>
Co-authored-by: David McCurley <mrengineer02@gmail.com>
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-03-18 15:45:00 +02:00
Jason2866
82a634845c
add f_boot (#9380)
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-03-18 15:44:32 +02:00
Aaron.Lee
ab322be480
Heltec ESP32 Series boards update (#9367)
* Heltec ESP32 Series boards update

* Update variants/heltec_capsule_sensor_v3/pins_arduino.h

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* Update variants/heltec_capsule_sensor_v3/pins_arduino.h

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* Update variants/heltec_ht_de01/pins_arduino.h

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* Update variants/heltec_wireless_mini_shell/pins_arduino.h

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* Update variants/heltec_wireless_mini_shell/pins_arduino.h

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* Fix board definition format

* Update Wireless Stick Lite V3 pin defintion

* Update Heltec boards defintion

* Heltec Wireless Shell (V3) format update

* Heltec Capsule Sensor V3 information update

* Heltec E-Ink Driver board menu update

* Heltec E-Ink Driver board menu update

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-03-18 14:32:27 +02:00
Rodrigo Garcia
0a26a8c4e3
Fixes HW Serial attaching pins, PHY initialization, crash after end() (#9365)
* fix: HWCDC pin number

Fixes HW Serial pin setup.

The pins were set up to the wrong value and it could not be correctly configured and used.

* fix: PHY initialization

Fixes the PHY initialization.

After detaching the pin and ending the HW Serial, a new begin() wouldn't start the CDC because it lacked the proper PHY initialization.

* fix: crashing end()

Fixes a crash when calling end()

end() treminanates the `tx_ring_buf` but it was not tested for NULL in the ISR and in the cdc0_write_char() causing a crash if those are used. This depends on events and happens eventually.

* reduces number of debug messages

* fix git stash/commit added lines

* fixes usb_phy_ll include and call

* roll back

* solves HWSerial initialization

* fixes C6|H2 issue

issue with `if(Serial)` not working always

* github commit problem

* fixes
2024-03-14 11:51:41 +02:00
Lucas Saavedra Vaz
2479efb10d
Fix documentation build instructions (#9350) 2024-03-11 15:11:13 +02:00
Lucas Saavedra Vaz
dce754b693
Improve USBVendor Example (#9349)
* Add WebUSB console

* Improve Console Page

* Improve example

* Add comments

* Add flush method

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-03-11 15:10:46 +02:00
Rodrigo Garcia
b92ad5574a
fix: begin cts rts (#9353)
Begin() may undo a setpins() that has set RTS and/or CTS pin.
This pins are only changed with RTS and CTS.
setpins() can be called after or before begin()
when called before, begin() shall not change those pins.
2024-03-11 15:09:50 +02:00
Lucas Saavedra Vaz
4123e20a2c
Fix indentation (#9343) 2024-03-05 20:56:46 +02:00
Lucas Saavedra Vaz
df60991509
Update upload and download artifact action to v4 (#9338)
* Update to node 20

* lib and docs

* Test

* Fix
2024-03-05 17:15:49 +02:00
Me No Dev
86040af754
add LittleFS part ID (#9340)
* add LittleFS part ID

* Push binary to tools

---------

Co-authored-by: Jason2866 <24528715+Jason2866@users.noreply.github.com>
2024-03-05 14:59:19 +02:00
Jan Procházka
6304aaf1c2
fix(spi): Update sck for C6,H2,C2 (#9335) 2024-03-05 14:23:50 +02:00
Lucas Saavedra Vaz
a6d4252a40
Add hardware tests results (#9332)
* Add badge

* Add filter to link

* Fix Libs test link
2024-03-05 14:23:17 +02:00
Rodrigo Garcia
a7fcf86826
fix: perimgr + begin (#9331)
* fix: perimgr + begin

Fixes Perimgr setup in begin()
Fixes issue with reset INTR mask preventing previous sent data to be read.
Adds a INTR mask to end() to clear all pending interrupts.

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update HWCDC.cpp

* Update HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp
2024-03-05 14:22:44 +02:00
Jason2866
5bcaf99ffd
Fix compile branch master as Arduino as component with latest IDF 5.1 (#9322)
* Fix compile with Lib Builder

with latest IDF 5.1.

* change function name
2024-03-05 11:02:10 +02:00
Andrew Dunai
629ffc55ed
fix(hal): force spiTransaction to update clock line immediately (#9221) (#9333) 2024-03-05 11:01:06 +02:00
DarkDuck
f27971ecb6
feat: add board support for Seeed XIAO ESP32C6 (#9330) 2024-03-05 10:54:59 +02:00
Jason2866
20859d0be4
Update binary.h (#9323) 2024-03-05 10:54:00 +02:00
Rodrigo Garcia
58b9f079d2
HardwareSerial Available For Write (#9319)
* feat(uart): setBufferSize 

It makes sure that setting TX buffer size will match availableForWrite() response. It also sets the buffer to the minimum instead of doing nothing and returning an error.

For RX Buffer, it sets the minimum and also don't return an error.

This makes the APIs better and easy to understand its results.

* feat: sets TX buffer 

This will allow to set TX buffer to a minimum with no error message.
It also makes it works as in the Arduino API specification that is to return the buffer available space. In ESP32 case it will be the minmum the HW TX FIFO size of 128 bytes.

* feat: adjust availableForWrite

This change will make sure that if no TX Ringbuffer is used, it will return the UART FIFO available space. Otherwise, it will return the Ringbuffer available space, as defined in the Arduino especification.
2024-03-05 10:53:14 +02:00
Jan Procházka
aed7b4fa59
ETH: Support physical address auto detection (#9313)
* feat(eth): Support phy address auto detection

* fix(eth): add phy_address check
2024-03-01 18:50:19 +02:00
SooDragon
ebca505fef
fix: Geekble mini board pin fix (#9309)
* fix: LED Pin Modified

fix: LED Pin Modified

* Revert "fix: LED Pin Modified"

This reverts commit 36bdbdbe0cdf40da82fae84acfca01da93999180.

* fix: LED Pin Modified to support Hardware update

fix: LED Pin Modified to support Hardware update
2024-02-29 14:38:07 +02:00
Rodrigo Garcia
2fdd901639
fixes default 100ms delay with HWCDC write() is CDC is not connected (#9307)
* feat(hwcdc): fix delay

Fixes delay when CDC is disconnected. At this time is only fixes it when USB cable is unplugged.

* feat(hwcdc): fix delay

fixes delay when CDC is not connected. It was only considering when the USB cable was not plugged.

* feat(hwcdc): add 2 methods

Adds 2 new methods:
- isPlugged() will return true when USB cable is plugged, false otherwise.
- isConnected() will return true when USB CDC is connected to a application in the USB Host side and communication is stablished.

* feat(hwcdc): adjusts APIs

Fixes the example to use the new added APIs for checking if USB cable is plugged and for checking if CDC is connected.

* fixes api declaration

* fixes API declaration
2024-02-29 08:40:28 +02:00
Rodrigo Garcia
b7af090f71
Fixes the hardware cdc jtag plugged/unplugged status and related timeout/delay (#9275)
* feat(hw_cdc):fixes the hardware cdc jtag plugged/unplugged status

This will use a new IDF 5.1 feature to detect if the USB HW CDC is plugged or not. This can be checked testing HWCDCSerial.
It also fixes issues related to timeout or delays while writing to the HW Serial when USB is unplugged.

* feat(usb): Creates HWSerial_Events.ino example

* feat: adds .skip.esp32

Skips the ESP32 SoC test given that it has no USB

* feat: adds .skip.esp32s2

Skips the ESP32S2 because it has no HW CDC JTAG interface

* fix: fixes issues with Ubuntu CI 

Only compiles the example in case it is using Hardware CD and JTAG mode.

* feat(serialcdc): non block functions

modifies write and flush to do not clock in case CDC host is not connected to the CDC client from the C3/S3/C6/H2

* fix(HWCDC): changes made demands testing for CDC ON BOOT

* feat(hwcdc): Improves HWSerial_Events.ino

Improves the example by adding more information about USB being plugged and CDC being connected.

* feat(hwcdc): solves CDC connection issue

Detects correctly when CDC is or not connected. 
Deals with USB unplugged while the sketch is printing to CDD.

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Update cores/esp32/HWCDC.cpp

* Apply suggestions from code review

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
2024-02-28 18:14:21 +02:00
Me No Dev
c4ad3b7981
Update mdns version. (#9295)
Was fixed to 1.2.1 before, because of a bug in 1.2.2
2024-02-27 18:14:42 +02:00
Me No Dev
22d7fc91eb
Enable USB Serial only if selected (#9294)
* Enable USB Serial only if selected

* fix examples

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2024-02-27 17:32:19 +02:00
c4801725870
e3748c1dca
Add WT32-SC01 PLUS support (#9284)
* WT32-SC01 PLUS support

Added pins_arduino.h and a boilerplate boards.txt entry for the Panlee WT32-SC01 Plus.

* Update pins_arduino.h

Edited the name to correctly reflect WT32-SC01 PLUS

* Update variants/wt32-sc01-plus/pins_arduino.h

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* ADD(tinyuf2 things): Added tinyuf2 bins

ADD(tinyuf2 things): Added tinyuf2 bins

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
2024-02-27 12:49:27 +02:00
2225 changed files with 157907 additions and 70676 deletions

246
.clang-format Normal file
View file

@ -0,0 +1,246 @@
# Clang format version: 18.1.3
---
BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: BlockIndent
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: false
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: true
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Always
BreakAfterJavaFieldAnnotations: false
BreakArrays: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeConceptDeclarations: Always
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 160
CommentPragmas: ""
CompactNamespaces: false
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: ^"(llvm|llvm-c|clang|clang-c)/
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: ^(<|"(gtest|gmock|isl|json)/)
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: .*
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: ""
IncludeIsMainSourceRegex: ""
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: NoIndent
IndentGotoLabels: false
IndentPPDirectives: None
IndentRequiresClause: false
IndentWidth: 2
IndentWrappedFunctionNames: true
InsertBraces: true
InsertNewlineAtEOF: true
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtEOF: false
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
Language: Cpp
LineEnding: LF
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PPIndentWidth: -1
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakScopeResolution: 500
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: false
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SkipMacroDefinitionBody: false
SortIncludes: Never
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDeclarationName: false
AfterFunctionDefinitionName: false
AfterIfMacros: true
AfterOverloadedOperator: true
AfterPlacementOperator: true
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInContainerLiterals: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
InConditionalStatements: false
InCStyleCasts: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Auto
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 2
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
BracedInitializerIndentWidth: 2

8
.codespellrc Normal file
View file

@ -0,0 +1,8 @@
[codespell]
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
ignore-words-list = ba,licence,ot,dout,als,exten,emac
skip = ./.git,./.licenses,__pycache__,.clang-format,.codespellrc,.editorconfig,.flake8,.prettierignore,.yamllint.yml,.gitignore,boards.txt,platform.txt,programmers.txt
builtin = clear,informal,en-GB_to_en-US
check-filenames =
check-hidden =

60
.editorconfig Normal file
View file

@ -0,0 +1,60 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/general/.editorconfig
# See: https://editorconfig.org/
# The formatting style defined in this file is the official standardized style to be used in all Arduino Tooling
# projects and should not be modified.
# Note: indent style for each file type is defined even when it matches the universal config in order to make it clear
# that this type has an official style.
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{adoc,asc,asciidoc}]
indent_size = 2
indent_style = space
[*.{bash,sh}]
indent_size = 4
indent_style = space
[*.{c,cc,cp,cpp,cxx,h,hh,hpp,hxx,ii,inl,ino,ixx,pde,tpl,tpp,txx}]
indent_size = 2
indent_style = space
[*.{go,mod}]
indent_style = tab
[*.java]
indent_size = 2
indent_style = space
[*.{js,jsx,json,jsonc,json5,ts,tsx}]
indent_size = 2
indent_style = space
[*.{md,mdx,mkdn,mdown,markdown}]
indent_size = unset
indent_style = space
[*.proto]
indent_size = 2
indent_style = space
[*.py]
indent_size = 4
indent_style = space
[*.svg]
indent_size = 2
indent_style = space
[*.{yaml,yml}]
indent_size = 2
indent_style = space
[{.gitconfig,.gitmodules}]
indent_style = tab

10
.flake8 Normal file
View file

@ -0,0 +1,10 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python/.flake8
# See: https://flake8.pycqa.org/en/latest/user/configuration.html
[flake8]
doctests = True
# W503 and W504 are mutually exclusive. PEP 8 recommends line break before.
ignore = W503,E203
max-complexity = 20
max-line-length = 120
select = E,W,F,C,N

81
.github/CODEOWNERS vendored Normal file
View file

@ -0,0 +1,81 @@
# CODEOWNERS for ESP32 Arduino Core
# This file is used to specify the code owners for the ESP32 Arduino Core.
# Read more about CODEOWNERS:
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
# Note that order matters. The last matching pattern will be used.
# The default owners are the active developers of the ESP32 Arduino Core.
# Refrain from using @espressif/arduino-esp32 to avoid spamming non-developers with review requests.
* @espressif/arduino-devs
# CI
/.github/ @lucasssvaz @me-no-dev @P-R-O-C-H-Y
/.github/codeql/ @lucasssvaz
/.gitlab/ @lucasssvaz
/tests/ @lucasssvaz @P-R-O-C-H-Y
# Tools
/tools/ @me-no-dev
/tools/pre-commit/ @lucasssvaz
/tools/add_lib.sh @P-R-O-C-H-Y
# Pre-commit
/.* @lucasssvaz # Files in root directory that start with a dot.
# Git Files
/.gitignore @espressif/arduino-devs
/.gitmodules @espressif/arduino-devs
# Documentation
/docs/ @pedrominatel
/.github/ISSUE_TEMPLATE/ @pedrominatel
/.github/PULL_REQUEST_TEMPLATE.md @pedrominatel
/.readthedocs.yaml @pedrominatel
/*.md @pedrominatel
# Boards
/variants/ @P-R-O-C-H-Y
/boards.txt @P-R-O-C-H-Y
# Arduino as Component
/idf_component_examples/ @SuGlider
/idf_component.yml @SuGlider @me-no-dev
/CMakeLists.txt @SuGlider @me-no-dev
/Kconfig.projbuild @SuGlider @me-no-dev
# Build System
/package.json @me-no-dev
/platform.txt @me-no-dev
/programmers.txt @me-no-dev
/package/ @me-no-dev
# Libraries
/libraries/ArduinoOTA/ @me-no-dev
/libraries/AsyncUDP/ @me-no-dev
/libraries/BLE/ @lucasssvaz @SuGlider
/libraries/ESP_I2S/ @me-no-dev
/libraries/ESP_NOW/ @P-R-O-C-H-Y @lucasssvaz
/libraries/ESP_SR/ @me-no-dev
/libraries/ESPmDNS/ @me-no-dev
/libraries/Ethernet/ @me-no-dev
/libraries/Matter/ @SuGlider
/libraries/NetBIOS/ @me-no-dev
/libraries/Network/ @me-no-dev
/libraries/OpenThread/ @SuGlider
/libraries/PPP/ @me-no-dev
/libraries/SPI/ @me-no-dev
/libraries/Update/ @me-no-dev
/libraries/USB/ @SuGlider @me-no-dev
/libraries/WiFi/ @me-no-dev
/libraries/WiFiProv/ @me-no-dev
/libraries/Wire/ @me-no-dev
/libraries/Zigbee/ @P-R-O-C-H-Y
# CI JSON
# Keep this after other libraries and tests to avoid being overridden.
**/ci.json @lucasssvaz
# The CODEOWNERS file should be owned by the developers of the ESP32 Arduino Core.
# Leave this entry as the last one to avoid being overridden.
/.github/CODEOWNERS @espressif/arduino-devs

View file

@ -5,6 +5,7 @@ body:
- type: markdown
attributes:
value: |
* Please note that we can only process feature requests reported in English to ensure effective communication and support. Feature requests written in other languages will be closed, with a request to rewrite them in English.
* We welcome any ideas or feature requests! It is helpful if you can explain exactly why the feature would be useful.
* There are usually some outstanding feature requests in the [existing issues list](https://github.com/espressif/arduino-esp32/issues?q=is%3Aopen+is%3Aissue+label%3A%22Type%3A+Feature+request%22), feel free to add comments to them.
* If you would like to contribute, please read the [contributions guide](https://docs.espressif.com/projects/arduino-esp32/en/latest/contributing.html).

View file

@ -5,7 +5,8 @@ body:
- type: markdown
attributes:
value: |
* Before reporting a new issue please check and search in [List of existing issues](https://github.com/espressif/arduino-esp32/issues?q=is%3Aissue)
* Please note that we can only process issues reported in English to ensure effective communication and support. Issues written in other languages will be closed, with a request to rewrite them in English.
* Before reporting a new issue please check and search in [List of existing issues](https://github.com/espressif/arduino-esp32/issues?q=is%3Aissue)
* Please check [Online Documentation](https://docs.espressif.com/projects/arduino-esp32/en/latest/index.html)
* Take a look on [Troubleshooting guide](https://docs.espressif.com/projects/arduino-esp32/en/latest/troubleshooting.html)
* If still experiencing the issue, please provide as many details as possible below about your hardware, computer setup and code.
@ -24,7 +25,7 @@ body:
description: What development board or other hardware is the chip attached to?
placeholder: ex. DevKitC, plain module on breadboard, etc. If your hardware is custom or unusual, please attach a photo.
validations:
required: true
required: true
- type: textarea
id: other-hw
attributes:
@ -39,8 +40,27 @@ body:
label: Version
description: What version of Arduino ESP32 are you running? If possible, consider updating to the latest version.
options:
- latest master (checkout manually)
- latest stable Release (if not listed below)
- latest development Release Candidate (RC-X)
- latest master (checkout manually)
- v3.3.0
- v3.2.1
- v3.2.0
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.7
- v3.0.6
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.0.17
- v2.0.16
- v2.0.15
- v2.0.14
- v2.0.13
- v2.0.12
@ -50,7 +70,7 @@ body:
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
@ -60,14 +80,25 @@ body:
- other
validations:
required: true
- type: dropdown
id: type
attributes:
label: Type
description: How would you define the type of the issue? Please select from the types below.
options:
- Task
- Bug
- Question
validations:
required: true
- type: input
id: IDE
attributes:
label: IDE Name
description: What IDE are you using?
placeholder: eg. Arduino IDE, PlatformIO, Sloeber...
placeholder: eg. Arduino IDE, VSCode, Sloeber...
validations:
required: true
required: true
- type: input
id: os
attributes:
@ -85,13 +116,13 @@ body:
validations:
required: true
- type: dropdown
id: PSRAM
id: PSRAM
attributes:
label: PSRAM enabled
description: Is PSRAM enabled?
options:
- 'yes'
- 'no'
- "yes"
- "no"
validations:
required: true
- type: input
@ -106,8 +137,8 @@ body:
id: Description
attributes:
label: Description
description: Please describe your problem here and expected behaviour
placeholder: ex. Can't connect/weird behaviour/wrong function/missing parameter..
description: Please describe your problem here and expected behavior
placeholder: ex. Can't connect/weird behavior/wrong function/missing parameter..
validations:
required: true
- type: textarea
@ -118,7 +149,7 @@ body:
placeholder: ex. Related part of the code to replicate the issue
render: cpp
validations:
required: true
required: true
- type: textarea
id: Debug
attributes:
@ -127,11 +158,11 @@ body:
placeholder: Enable Core debug level - Debug on tools menu of Arduino IDE, then put the serial output here.
render: plain
validations:
required: true
required: true
- type: textarea
id: other-remarks
attributes:
label: Other Steps to Reproduce
label: Other Steps to Reproduce
description: Is there any other information you can think of which will help us reproduce this problem? Any additional info can be added as well.
placeholder: ex. I also tried on other OS, HW...it works correctly on that setup.
- type: checkboxes

View file

@ -1,8 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Arduino ESP32 Gitter Channel
url: https://gitter.im/espressif/arduino-esp32
about: Community channel for questions and help
- name: ESP32 Forum - Arduino
url: https://esp32.com/viewforum.php?f=19
about: Official Forum for questions
- name: Arduino Core for Espressif Discord Server
url: https://discord.gg/8xY6e9crwv
about: Community Discord server for questions and help

26
.github/codeql/codeql-config.yml vendored Normal file
View file

@ -0,0 +1,26 @@
name: "CodeQL config"
packs:
- trailofbits/cpp-queries
- githubsecuritylab/codeql-cpp-queries
- githubsecuritylab/codeql-python-queries
queries:
- uses: security-extended
- uses: security-and-quality
query-filters:
- exclude:
query path:
- /^experimental\/.*/
- exclude:
tags contain:
- experimental
- exclude:
problem.severity:
- recommendation
- exclude:
id: tob/cpp/use-of-legacy-algorithm
paths-ignore:
- tests/**

View file

@ -1,4 +1,5 @@
#!/bin/bash
#
# This script is used in the CI workflow. It checks all non-examples source files in libraries/ and cores/ are listed in
# CMakeLists.txt for the cmake-based IDF component
@ -12,10 +13,10 @@ set -e
git submodule update --init --recursive
# find all source files in repo
REPO_SRCS=`find cores/esp32/ libraries/ -name 'examples' -prune -o -name '*.c' -print -o -name '*.cpp' -print | sort`
REPO_SRCS=$(find cores/esp32/ libraries/ -name 'examples' -prune -o -name '*.c' -print -o -name '*.cpp' -print | sort)
# find all source files named in CMakeLists.txt COMPONENT_SRCS
CMAKE_SRCS=`cmake --trace-expand -P CMakeLists.txt 2>&1 | grep set\(srcs | cut -d'(' -f3 | sed 's/ )//' | sed 's/srcs //' | tr ' ;' '\n' | sort`
CMAKE_SRCS=$(cmake --trace-expand -P CMakeLists.txt 2>&1 | grep set\(srcs | cut -d'(' -f3 | sed 's/ )//' | sed 's/srcs //' | tr ' ;' '\n' | sort)
if ! diff -u0 --label "Repo Files" --label "srcs" <(echo "$REPO_SRCS") <(echo "$CMAKE_SRCS"); then
echo "Source files in repo (-) and source files in CMakeLists.txt (+) don't match"

View file

@ -3,33 +3,37 @@
# Get all boards
boards_array=()
for line in `grep '.tarch=' boards.txt`; do
boards_list=$(grep '.tarch=' boards.txt)
while read -r line; do
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1)
# skip esp32c2 as we dont build libs for it
if [ "$board_name" == "esp32c2" ]; then
echo "Skipping 'espressif:esp32:$board_name'"
continue
fi
boards_array+=("espressif:esp32:$board_name")
echo "Added 'espressif:esp32:$board_name' to array"
done
done <<< "$boards_list"
# Create JSON like string with all boards found and pass it to env variable
board_count=${#boards_array[@]}
echo "Boards found: $board_count"
echo "BOARD-COUNT=$board_count" >> $GITHUB_ENV
echo "BOARD-COUNT=$board_count" >> "$GITHUB_ENV"
if [ $board_count -gt 0 ]
then
if [ "$board_count" -gt 0 ]; then
json_matrix='['
for board in ${boards_array[@]}
do
for board in "${boards_array[@]}"; do
json_matrix+='"'$board'"'
if [ $board_count -gt 1 ]
then
if [ "$board_count" -gt 1 ]; then
json_matrix+=","
fi
board_count=$(($board_count - 1))
board_count=$((board_count - 1))
done
json_matrix+=']'
echo $json_matrix
echo "FQBNS=${json_matrix}" >> $GITHUB_ENV
echo "$json_matrix"
echo "FQBNS=${json_matrix}" >> "$GITHUB_ENV"
else
echo "FQBNS=" >> $GITHUB_ENV
echo "FQBNS=" >> "$GITHUB_ENV"
fi

View file

@ -2,89 +2,61 @@
# Get inputs from command
owner_repository=$1
pr_number=$2
base_ref=$2
url="https://api.github.com/repos/$owner_repository/pulls/$pr_number/files"
echo $url
# Download the boards.txt file from the base branch
curl -L -o boards_base.txt https://raw.githubusercontent.com/"$owner_repository"/"$base_ref"/boards.txt
# Get changes in boards.txt file from PR
Patch=$(curl $url | jq -r '.[] | select(.filename == "boards.txt") | .patch ')
# Compare boards.txt file in the repo with the modified file from PR
diff=$(diff -u boards_base.txt boards.txt)
# Extract only changed lines number and count
substring_patch=$(echo "$Patch" | grep -o '@@[^@]*@@')
# Check if the diff is empty
if [ -z "$diff" ]; then
echo "No changes in boards.txt file"
echo "FQBNS="
exit 0
fi
params_array=()
# Extract added or modified lines (lines starting with '+' or '-')
modified_lines=$(echo "$diff" | grep -E '^[+-][^+-]')
IFS=$'\n' read -d '' -ra params <<< $(echo "$substring_patch" | grep -oE '[-+][0-9]+,[0-9]+')
for param in "${params[@]}"
do
echo "The parameter is $param"
params_array+=("$param")
done
# Print the modified lines for debugging
echo "Modified lines:"
echo "$modified_lines"
boards_array=()
previous_board=""
file="boards.txt"
# Loop through boards.txt file and extract all boards that were added
for (( c=0; c<${#params_array[@]}; c+=2 ))
do
deletion_count=$( echo "${params_array[c]}" | cut -d',' -f2 | cut -d' ' -f1 )
addition_line=$( echo "${params_array[c+1]}" | cut -d'+' -f2 | cut -d',' -f1 )
addition_count=$( echo "${params_array[c+1]}" | cut -d'+' -f2 | cut -d',' -f2 | cut -d' ' -f1 )
addition_end=$(($addition_line+$addition_count))
addition_line=$(($addition_line + 3))
addition_end=$(($addition_end - $deletion_count))
echo $addition_line
echo $addition_end
i=0
while read -r line
do
i=$((i+1))
if [ $i -lt $addition_line ]
then
continue
elif [ $i -gt $addition_end ]
then
break
fi
# Extract board names from the modified lines, and add them to the boards_array
while read -r line; do
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1)
if [ "$board_name" != "" ]
then
if [ "$board_name" != "$previous_board" ]
then
# remove + or - from the board name at the beginning
board_name=${board_name#[-+]}
if [ "$board_name" != "" ] && [ "$board_name" != "+" ] && [ "$board_name" != "-" ] && [ "$board_name" != "esp32_family" ]; then
if [ "$board_name" != "$previous_board" ]; then
boards_array+=("espressif:esp32:$board_name")
previous_board="$board_name"
echo "Added 'espressif:esp32:$board_name' to array"
fi
fi
done < "$file"
done
done <<< "$modified_lines"
# Create JSON like string with all boards found and pass it to env variable
board_count=${#boards_array[@]}
if [ $board_count -gt 0 ]
then
if [ "$board_count" -gt 0 ]; then
json_matrix='{"fqbn": ['
for board in ${boards_array[@]}
do
for board in "${boards_array[@]}"; do
json_matrix+='"'$board'"'
if [ $board_count -gt 1 ]
then
if [ "$board_count" -gt 1 ]; then
json_matrix+=","
fi
board_count=$(($board_count - 1))
board_count=$((board_count - 1))
done
json_matrix+=']}'
echo $json_matrix
echo "FQBNS=${json_matrix}" >> $GITHUB_ENV
echo "$json_matrix"
echo "FQBNS=${json_matrix}" >> "$GITHUB_ENV"
else
echo "FQBNS=" >> $GITHUB_ENV
fi
echo "FQBNS=" >> "$GITHUB_ENV"
fi

View file

@ -1,6 +1,6 @@
#!/bin/bash
OSBITS=`arch`
OSBITS=$(uname -m)
if [[ "$OSTYPE" == "linux"* ]]; then
export OS_IS_LINUX="1"
if [[ "$OSBITS" == "i686" ]]; then
@ -41,6 +41,11 @@ fi
if [ ! -d "$ARDUINO_IDE_PATH" ] || [ ! -f "$ARDUINO_IDE_PATH/arduino-cli" ]; then
echo "Installing Arduino CLI on $OS_NAME ..."
mkdir -p "$ARDUINO_IDE_PATH"
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR="$ARDUINO_IDE_PATH" sh
if [ "$OS_IS_WINDOWS" == "1" ]; then
curl -fsSL https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_64bit.zip -o arduino-cli.zip
unzip -q arduino-cli.zip -d "$ARDUINO_IDE_PATH"
rm arduino-cli.zip
else
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR="$ARDUINO_IDE_PATH" sh
fi
fi

View file

@ -5,7 +5,7 @@ if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
echo "Installing ESP32 Arduino Core ..."
script_init_path="$PWD"
mkdir -p "$ARDUINO_USR_PATH/hardware/espressif"
cd "$ARDUINO_USR_PATH/hardware/espressif"
cd "$ARDUINO_USR_PATH/hardware/espressif" || exit
echo "Installing Python Serial ..."
pip install pyserial > /dev/null
@ -15,21 +15,25 @@ if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
pip install requests > /dev/null
fi
if [ ! -z "$GITHUB_REPOSITORY" ]; then
if [ -n "$GITHUB_REPOSITORY" ]; then
echo "Linking Core..."
ln -s $GITHUB_WORKSPACE esp32
ln -s "$GITHUB_WORKSPACE" esp32
else
echo "Cloning Core Repository..."
git clone https://github.com/espressif/arduino-esp32.git esp32 > /dev/null 2>&1
fi
#echo "Updating Submodules ..."
cd esp32
cd esp32 || exit
#git submodule update --init --recursive > /dev/null 2>&1
echo "Installing Platform Tools ..."
cd tools && python get.py
cd $script_init_path
if [ "$OS_IS_WINDOWS" == "1" ]; then
cd tools && ./get.exe
else
cd tools && python get.py
fi
cd "$script_init_path" || exit
echo "ESP32 Arduino has been installed in '$ARDUINO_ESP32_PATH'"
echo ""

View file

@ -4,7 +4,7 @@
#OSTYPE: 'msys', ARCH: 'x86_64' => win32
#OSTYPE: 'darwin18', ARCH: 'i386' => macos
OSBITS=`arch`
OSBITS=$(uname -m)
if [[ "$OSTYPE" == "linux"* ]]; then
export OS_IS_LINUX="1"
ARCHIVE_FORMAT="tar.xz"
@ -77,4 +77,3 @@ if [ ! -d "$ARDUINO_IDE_PATH" ]; then
echo "Arduino IDE Installed in '$ARDUINO_IDE_PATH'"
echo ""
fi

View file

@ -1,180 +0,0 @@
#!/bin/bash
export PLATFORMIO_ESP32_PATH="$HOME/.platformio/packages/framework-arduinoespressif32"
PLATFORMIO_ESP32_URL="https://github.com/platformio/platform-espressif32.git"
TOOLCHAIN_VERSION="12.2.0+20230208"
ESPTOOLPY_VERSION="~1.40501.0"
ESPRESSIF_ORGANIZATION_NAME="espressif"
echo "Installing Python Wheel ..."
pip install wheel > /dev/null 2>&1
echo "Installing PlatformIO ..."
pip install -U https://github.com/platformio/platformio/archive/master.zip > /dev/null 2>&1
echo "Installing Platform ESP32 ..."
python -m platformio platform install $PLATFORMIO_ESP32_URL > /dev/null 2>&1
echo "Replacing the package versions ..."
replace_script="import json; import os;"
replace_script+="fp=open(os.path.expanduser('~/.platformio/platforms/espressif32/platform.json'), 'r+');"
replace_script+="data=json.load(fp);"
# Use framework sources from the repository
replace_script+="data['packages']['framework-arduinoespressif32']['version'] = '*';"
replace_script+="del data['packages']['framework-arduinoespressif32']['owner'];"
# Use toolchain packages from the "espressif" organization
replace_script+="data['packages']['toolchain-xtensa-esp32']['owner']='$ESPRESSIF_ORGANIZATION_NAME';"
replace_script+="data['packages']['toolchain-xtensa-esp32s2']['owner']='$ESPRESSIF_ORGANIZATION_NAME';"
replace_script+="data['packages']['toolchain-riscv32-esp']['owner']='$ESPRESSIF_ORGANIZATION_NAME';"
# Update versions to use the upstream
replace_script+="data['packages']['toolchain-xtensa-esp32']['version']='$TOOLCHAIN_VERSION';"
replace_script+="data['packages']['toolchain-xtensa-esp32s2']['version']='$TOOLCHAIN_VERSION';"
replace_script+="data['packages']['toolchain-xtensa-esp32s3']['version']='$TOOLCHAIN_VERSION';"
replace_script+="data['packages']['toolchain-riscv32-esp']['version']='$TOOLCHAIN_VERSION';"
# Add new "framework-arduinoespressif32-libs" package
# Read "package_esp32_index.template.json" to extract a url to a zip package for "esp32-arduino-libs"
replace_script+="fpackage=open(os.path.join('package', 'package_esp32_index.template.json'), 'r+');"
replace_script+="package_data=json.load(fpackage);"
replace_script+="fpackage.close();"
replace_script+="libs_package_archive_url=next(next(system['url'] for system in tool['systems'] if system['host'] == 'x86_64-pc-linux-gnu') for tool in package_data['packages'][0]['tools'] if tool['name'] == 'esp32-arduino-libs');"
replace_script+="data['packages'].update({'framework-arduinoespressif32-libs':{'type':'framework','optional':False,'version':libs_package_archive_url}});"
replace_script+="data['packages']['toolchain-xtensa-esp32'].update({'optional':False});"
# esptool.py may require an upstream version (for now platformio is the owner)
replace_script+="data['packages']['tool-esptoolpy']['version']='$ESPTOOLPY_VERSION';"
# Save results
replace_script+="fp.seek(0);fp.truncate();json.dump(data, fp, indent=2);fp.close()"
python -c "$replace_script"
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
echo "Linking Core..."
ln -s $GITHUB_WORKSPACE "$PLATFORMIO_ESP32_PATH"
else
echo "Cloning Core Repository ..."
git clone --recursive https://github.com/espressif/arduino-esp32.git "$PLATFORMIO_ESP32_PATH" > /dev/null 2>&1
fi
echo "PlatformIO for ESP32 has been installed"
echo ""
function build_pio_sketch(){ # build_pio_sketch <board> <options> <path-to-ino>
if [ "$#" -lt 3 ]; then
echo "ERROR: Illegal number of parameters"
echo "USAGE: build_pio_sketch <board> <options> <path-to-ino>"
return 1
fi
local board="$1"
local options="$2"
local sketch="$3"
local sketch_dir=$(dirname "$sketch")
echo ""
echo "Compiling '"$(basename "$sketch")"' ..."
python -m platformio ci --board "$board" "$sketch_dir" --project-option="$options"
}
function count_sketches(){ # count_sketches <examples-path>
local examples="$1"
rm -rf sketches.txt
if [ ! -d "$examples" ]; then
touch sketches.txt
return 0
fi
local sketches=$(find $examples -name *.ino)
local sketchnum=0
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
continue
fi
if [[ -f "$sketchdir/.test.skip" ]]; then
continue
fi
echo $sketch >> sketches.txt
sketchnum=$(($sketchnum + 1))
done
return $sketchnum
}
function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-path> <chunk> <total-chunks>
if [ "$#" -lt 3 ]; then
echo "ERROR: Illegal number of parameters"
echo "USAGE: build_pio_sketches <board> <options> <examples-path> [<chunk> <total-chunks>]"
return 1
fi
local board=$1
local options="$2"
local examples=$3
local chunk_idex=$4
local chunks_num=$5
if [ "$#" -lt 5 ]; then
chunk_idex="0"
chunks_num="1"
fi
if [ "$chunks_num" -le 0 ]; then
echo "ERROR: Chunks count must be positive number"
return 1
fi
if [ "$chunk_idex" -ge "$chunks_num" ]; then
echo "ERROR: Chunk index must be less than chunks count"
return 1
fi
set +e
count_sketches "$examples"
local sketchcount=$?
set -e
local sketches=$(cat sketches.txt)
rm -rf sketches.txt
local chunk_size=$(( $sketchcount / $chunks_num ))
local all_chunks=$(( $chunks_num * $chunk_size ))
if [ "$all_chunks" -lt "$sketchcount" ]; then
chunk_size=$(( $chunk_size + 1 ))
fi
local start_index=$(( $chunk_idex * $chunk_size ))
if [ "$sketchcount" -le "$start_index" ]; then
echo "Skipping job"
return 0
fi
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
if [ "$end_index" -gt "$sketchcount" ]; then
end_index=$sketchcount
fi
local start_num=$(( $start_index + 1 ))
echo "Found $sketchcount Sketches";
echo "Chunk Count : $chunks_num"
echo "Chunk Size : $chunk_size"
echo "Start Sketch: $start_num"
echo "End Sketch : $end_index"
local sketchnum=0
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [ "${sketchdirname}.ino" != "$sketchname" ] \
|| [ -f "$sketchdir/.test.skip" ]; then
continue
fi
sketchnum=$(($sketchnum + 1))
if [ "$sketchnum" -le "$start_index" ] \
|| [ "$sketchnum" -gt "$end_index" ]; then
continue
fi
build_pio_sketch "$board" "$options" "$sketch"
local result=$?
if [ $result -ne 0 ]; then
return $result
fi
done
return 0
}

View file

@ -1,49 +1,58 @@
#!/usr/bin/env python
# This script merges two Arduino Board Manager package json files.
# Usage:
# python merge_packages.py package_esp8266com_index.json version/new/package_esp8266com_index.json
# Written by Ivan Grokhotkov, 2015
# Updated by lucasssvaz to handle Chinese version sorting, 2025
#
from __future__ import print_function
from distutils.version import LooseVersion
# from distutils.version import LooseVersion
from packaging.version import Version
import re
import json
import sys
def load_package(filename):
pkg = json.load(open(filename))['packages'][0]
print("Loaded package {0} from {1}".format(pkg['name'], filename), file=sys.stderr)
print("{0} platform(s), {1} tools".format(len(pkg['platforms']), len(pkg['tools'])), file=sys.stderr)
pkg = json.load(open(filename))["packages"][0]
print("Loaded package {0} from {1}".format(pkg["name"], filename), file=sys.stderr)
print("{0} platform(s), {1} tools".format(len(pkg["platforms"]), len(pkg["tools"])), file=sys.stderr)
return pkg
def merge_objects(versions, obj):
for o in obj:
name = o['name'].encode('ascii')
ver = o['version'].encode('ascii')
if not name in versions:
name = o["name"].encode("ascii")
ver = o["version"].encode("ascii")
if name not in versions:
print("found new object, {0}".format(name), file=sys.stderr)
versions[name] = {}
if not ver in versions[name]:
if ver not in versions[name]:
print("found new version {0} for object {1}".format(ver, name), file=sys.stderr)
versions[name][ver] = o
return versions
# Normalize ESP release version string (x.x.x) by adding '-rc<MAXINT>' (x.x.x-rc9223372036854775807) to ensure having REL above any RC
# Dummy approach, functional anyway for current ESP package versioning (unlike NormalizedVersion/LooseVersion/StrictVersion & similar crap)
def pkgVersionNormalized(versionString):
verStr = str(versionString)
verParts = re.split('\.|-rc', verStr, flags=re.IGNORECASE)
# Normalize ESP release version string (x.x.x) by adding '-rc<MAXINT>' (x.x.x-rc9223372036854775807)
# to ensure having REL above any RC. CN version will be sorted after the official version if they happen
# to be mixed (normally, CN and non-CN versions should not be mixed)
# Dummy approach, functional anyway for current ESP package versioning
# (unlike NormalizedVersion/LooseVersion/StrictVersion & similar crap)
def pkgVersionNormalized(versionString):
verStr = str(versionString).replace("-cn", "")
verParts = re.split(r"\.|-rc|-alpha", verStr, flags=re.IGNORECASE)
if len(verParts) == 3:
if (sys.version_info > (3, 0)): # Python 3
verStr = str(versionString) + '-rc' + str(sys.maxsize)
else: # Python 2
verStr = str(versionString) + '-rc' + str(sys.maxint)
if "-cn" in str(versionString):
verStr = verStr + "-rc" + str(sys.maxsize // 2)
else:
verStr = verStr + "-rc" + str(sys.maxsize)
elif len(verParts) != 4:
print("pkgVersionNormalized WARNING: unexpected version format: {0})".format(verStr), file=sys.stderr)
return verStr
@ -53,30 +62,37 @@ def main(args):
return 1
tools = {}
platforms = {}
platforms = {}
pkg1 = load_package(args[1])
tools = merge_objects(tools, pkg1['tools']);
platforms = merge_objects(platforms, pkg1['platforms']);
tools = merge_objects(tools, pkg1["tools"])
platforms = merge_objects(platforms, pkg1["platforms"])
pkg2 = load_package(args[2])
tools = merge_objects(tools, pkg2['tools']);
platforms = merge_objects(platforms, pkg2['platforms']);
tools = merge_objects(tools, pkg2["tools"])
platforms = merge_objects(platforms, pkg2["platforms"])
pkg1['tools'] = []
pkg1['platforms'] = []
pkg1["tools"] = []
pkg1["platforms"] = []
for name in tools:
for version in tools[name]:
print("Adding tool {0}-{1}".format(name, version), file=sys.stderr)
pkg1['tools'].append(tools[name][version])
pkg1["tools"].append(tools[name][version])
for name in platforms:
for version in platforms[name]:
print("Adding platform {0}-{1}".format(name, version), file=sys.stderr)
pkg1['platforms'].append(platforms[name][version])
pkg1['platforms'] = sorted(pkg1['platforms'], key=lambda k: LooseVersion(pkgVersionNormalized(k['version'])), reverse=True)
pkg1["platforms"].append(platforms[name][version])
json.dump({'packages':[pkg1]}, sys.stdout, indent=2)
# pkg1["platforms"] = sorted(
# pkg1["platforms"], key=lambda k: LooseVersion(pkgVersionNormalized(k["version"])), reverse=True
# )
if __name__ == '__main__':
pkg1["platforms"] = sorted(
pkg1["platforms"], key=lambda k: Version(pkgVersionNormalized(k["version"])), reverse=True
)
json.dump({"packages": [pkg1]}, sys.stdout, indent=2)
if __name__ == "__main__":
sys.exit(main(sys.argv))

View file

@ -1,12 +1,13 @@
#/bin/bash
#!/bin/bash
set -e
function get_file_size(){
function get_file_size {
local file="$1"
if [[ "$OSTYPE" == "darwin"* ]]; then
eval `stat -s "$file"`
eval "$(stat -s "$file")"
local res="$?"
echo "$st_size"
echo "${st_size:?}"
return $res
else
stat --printf="%s" "$file"
@ -15,25 +16,32 @@ function get_file_size(){
}
#git_remove_from_pages <file>
function git_remove_from_pages(){
function git_remove_from_pages {
local path=$1
local info=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.object+json" -X GET "https://api.github.com/repos/$GITHUB_REPOSITORY/contents/$path?ref=gh-pages"`
local type=`echo "$info" | jq -r '.type'`
if [ ! $type == "file" ]; then
if [ ! $type == "null" ]; then
local info
local type
local sha
local message
info=$(curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.object+json" -X GET "https://api.github.com/repos/$GITHUB_REPOSITORY/contents/$path?ref=gh-pages")
type=$(echo "$info" | jq -r '.type')
if [ ! "$type" == "file" ]; then
if [ ! "$type" == "null" ]; then
echo "Wrong type '$type'"
else
echo "File is not on Pages"
fi
return 0
fi
local sha=`echo "$info" | jq -r '.sha'`
local message="Deleting "$(basename $path)
sha=$(echo "$info" | jq -r '.sha')
message="Deleting "$(basename "$path")
local json="{\"branch\":\"gh-pages\",\"message\":\"$message\",\"sha\":\"$sha\"}"
echo "$json" | curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" -X DELETE --data @- "https://api.github.com/repos/$GITHUB_REPOSITORY/contents/$path"
}
function git_upload_to_pages(){
function git_upload_to_pages {
local path=$1
local src=$2
@ -42,41 +50,50 @@ function git_upload_to_pages(){
return 1
fi
local info=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.object+json" -X GET "https://api.github.com/repos/$GITHUB_REPOSITORY/contents/$path?ref=gh-pages"`
local type=`echo "$info" | jq -r '.type'`
local message=$(basename $path)
local info
local type
local message
local sha=""
local content=""
if [ $type == "file" ]; then
sha=`echo "$info" | jq -r '.sha'`
info=$(curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.object+json" -X GET "https://api.github.com/repos/$GITHUB_REPOSITORY/contents/$path?ref=gh-pages")
type=$(echo "$info" | jq -r '.type')
message=$(basename "$path")
if [ "$type" == "file" ]; then
sha=$(echo "$info" | jq -r '.sha')
sha=",\"sha\":\"$sha\""
message="Updating $message"
elif [ ! $type == "null" ]; then
elif [ ! "$type" == "null" ]; then
>&2 echo "Wrong type '$type'"
return 1
else
message="Creating $message"
fi
content=`base64 -i "$src"`
content=$(base64 -i "$src")
data="{\"branch\":\"gh-pages\",\"message\":\"$message\",\"content\":\"$content\"$sha}"
echo "$data" | curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" -X PUT --data @- "https://api.github.com/repos/$GITHUB_REPOSITORY/contents/$path"
}
function git_safe_upload_to_pages(){
function git_safe_upload_to_pages {
local path=$1
local file="$2"
local name=$(basename "$file")
local size=`get_file_size "$file"`
local upload_res=`git_upload_to_pages "$path" "$file"`
if [ $? -ne 0 ]; then
local name
local size
local upload_res
name=$(basename "$file")
size=$(get_file_size "$file")
if ! upload_res=$(git_upload_to_pages "$path" "$file"); then
>&2 echo "ERROR: Failed to upload '$name' ($?)"
return 1
fi
up_size=`echo "$upload_res" | jq -r '.content.size'`
if [ $up_size -ne $size ]; then
up_size=$(echo "$upload_res" | jq -r '.content.size')
if [ "$up_size" -ne "$size" ]; then
>&2 echo "ERROR: Uploaded size does not match! $up_size != $size"
#git_delete_asset
return 1

33
.github/scripts/on-push-idf.sh vendored Normal file
View file

@ -0,0 +1,33 @@
#!/bin/bash
set -e
CHECK_REQUIREMENTS="./components/arduino-esp32/.github/scripts/sketch_utils.sh check_requirements"
# Export IDF environment
. ${IDF_PATH}/export.sh
# Find all examples in ./components/arduino-esp32/idf_component_examples
idf_component_examples=$(find ./components/arduino-esp32/idf_component_examples -mindepth 1 -maxdepth 1 -type d)
for example in $idf_component_examples; do
if [ -f "$example"/ci.json ]; then
# If the target is listed as false, skip the sketch. Otherwise, include it.
is_target=$(jq -r --arg target "$IDF_TARGET" '.targets[$target]' "$example"/ci.json)
if [[ "$is_target" == "false" ]]; then
printf "\n\033[93mSkipping %s for target %s\033[0m\n\n" "$example" "$IDF_TARGET"
continue
fi
fi
idf.py -C "$example" set-target "$IDF_TARGET"
has_requirements=$(${CHECK_REQUIREMENTS} "$example" "$example/sdkconfig")
if [ "$has_requirements" -eq 0 ]; then
printf "\n\033[93m%s does not meet the requirements for %s. Skipping...\033[0m\n\n" "$example" "$IDF_TARGET"
continue
fi
printf "\n\033[95mBuilding %s\033[0m\n\n" "$example"
idf.py -C "$example" -DEXTRA_COMPONENT_DIRS="$PWD/components" build
done

View file

@ -4,36 +4,45 @@ set -e
export ARDUINO_BUILD_DIR="$HOME/.arduino/build.tmp"
function build(){
function build {
local target=$1
local fqbn=$2
local chunk_index=$3
local chunks_cnt=$4
shift; shift; shift; shift;
local sketches=$*
local chunk_index=$2
local chunks_cnt=$3
local build_log=$4
local log_level=${5:-none}
local sketches_file=$6
shift 6
local sketches=("$@")
local BUILD_SKETCH="${SCRIPTS_DIR}/sketch_utils.sh build"
local BUILD_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh chunk_build"
local args="-ai $ARDUINO_IDE_PATH -au $ARDUINO_USR_PATH"
args+=" -t $target -fqbn $fqbn"
local args=("-ai" "$ARDUINO_IDE_PATH" "-au" "$ARDUINO_USR_PATH" "-t" "$target")
if [ "$OS_IS_LINUX" == "1" ]; then
args+=" -p $ARDUINO_ESP32_PATH/libraries"
args+=" -i $chunk_index -m $chunks_cnt"
${BUILD_SKETCHES} ${args}
args+=("-p" "$ARDUINO_ESP32_PATH/libraries" "-i" "$chunk_index" "-m" "$chunks_cnt" "-d" "$log_level")
if [ -n "$sketches_file" ]; then
args+=("-f" "$sketches_file")
fi
if [ "$build_log" -eq 1 ]; then
args+=("-l" "$build_log")
fi
${BUILD_SKETCHES} "${args[@]}"
else
for sketch in ${sketches}; do
local sargs="$args -s $(dirname $sketch)"
for sketch in "${sketches[@]}"; do
local sargs=("${args[@]}")
local ctags_version
local preprocessor_version
sargs+=("-s" "$(dirname "$sketch")")
if [ "$OS_IS_WINDOWS" == "1" ] && [ -d "$ARDUINO_IDE_PATH/tools-builder" ]; then
local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"`
local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"`
win_opts="-prefs=runtime.tools.ctags.path=$ARDUINO_IDE_PATH/tools-builder/ctags/$ctags_version
-prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version"
sargs+=" ${win_opts}"
ctags_version=$(ls "$ARDUINO_IDE_PATH/tools-builder/ctags/")
preprocessor_version=$(ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/")
sargs+=(
"-prefs=runtime.tools.ctags.path=$ARDUINO_IDE_PATH/tools-builder/ctags/$ctags_version"
"-prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version"
)
fi
${BUILD_SKETCH} ${sargs}
${BUILD_SKETCH} "${sargs[@]}"
done
fi
}
@ -45,61 +54,54 @@ fi
CHUNK_INDEX=$1
CHUNKS_CNT=$2
BUILD_PIO=0
BUILD_LOG=$3
LOG_LEVEL=$4
SKETCHES_FILE=$5
if [ "$#" -lt 2 ] || [ "$CHUNKS_CNT" -le 0 ]; then
CHUNK_INDEX=0
CHUNKS_CNT=1
elif [ "$CHUNK_INDEX" -gt "$CHUNKS_CNT" ] && [ "$CHUNKS_CNT" -ge 2 ]; then
CHUNK_INDEX=$CHUNKS_CNT
elif [ "$CHUNK_INDEX" -eq "$CHUNKS_CNT" ]; then
BUILD_PIO=1
fi
if [ -z "$BUILD_LOG" ] || [ "$BUILD_LOG" -le 0 ]; then
BUILD_LOG=0
fi
#echo "Updating submodules ..."
#git -C "$GITHUB_WORKSPACE" submodule update --init --recursive > /dev/null 2>&1
SCRIPTS_DIR="./.github/scripts"
if [ "$BUILD_PIO" -eq 0 ]; then
#source ${SCRIPTS_DIR}/install-arduino-ide.sh
source ${SCRIPTS_DIR}/install-arduino-cli.sh
source ${SCRIPTS_DIR}/install-arduino-core-esp32.sh
source "${SCRIPTS_DIR}/install-arduino-cli.sh"
source "${SCRIPTS_DIR}/install-arduino-core-esp32.sh"
FQBN_ESP32="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"
FQBN_ESP32S2="espressif:esp32:esp32s2:PSRAM=enabled,PartitionScheme=huge_app"
FQBN_ESP32S3="espressif:esp32:esp32s3:PSRAM=opi,USBMode=default,PartitionScheme=huge_app"
FQBN_ESP32C3="espressif:esp32:esp32c3:PartitionScheme=huge_app"
FQBN_ESP32C6="espressif:esp32:esp32c6:PartitionScheme=huge_app"
FQBN_ESP32H2="espressif:esp32:esp32h2:PartitionScheme=huge_app"
SKETCHES_ESP32=(
"$ARDUINO_ESP32_PATH/libraries/NetworkClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino"
"$ARDUINO_ESP32_PATH/libraries/BLE/examples/Server/Server.ino"
"$ARDUINO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
"$ARDUINO_ESP32_PATH/libraries/Insights/examples/MinimalDiagnostics/MinimalDiagnostics.ino"
)
#create sizes_file
sizes_file="$GITHUB_WORKSPACE/cli_compile_$CHUNK_INDEX.json"
SKETCHES_ESP32="\
$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino\
$ARDUINO_ESP32_PATH/libraries/BLE/examples/Server/Server.ino\
$ARDUINO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino\
$ARDUINO_ESP32_PATH/libraries/Insights/examples/MinimalDiagnostics/MinimalDiagnostics.ino\
"
build "esp32s3" $FQBN_ESP32S3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
build "esp32s2" $FQBN_ESP32S2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
build "esp32c3" $FQBN_ESP32C3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
build "esp32c6" $FQBN_ESP32C6 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
build "esp32h2" $FQBN_ESP32H2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
build "esp32" $FQBN_ESP32 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
else
source ${SCRIPTS_DIR}/install-platformio-esp32.sh
# PlatformIO ESP32 Test
BOARD="esp32dev"
OPTIONS="board_build.partitions = huge_app.csv"
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" && \
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino" && \
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/BLE/examples/Server/Server.ino" && \
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
# Basic sanity testing for other series
for board in "esp32-c3-devkitm-1" "esp32-s2-saola-1" "esp32-s3-devkitc-1"
do
python -m platformio ci --board "$board" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient" --project-option="board_build.partitions = huge_app.csv"
done
#build_pio_sketches "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries"
if [ "$BUILD_LOG" -eq 1 ]; then
#create sizes_file and echo start of JSON array with "boards" key
echo "{\"boards\": [" > "$sizes_file"
fi
#build sketches for different targets
build "esp32c5" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}"
build "esp32p4" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}"
build "esp32s3" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}"
build "esp32s2" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}"
build "esp32c3" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}"
build "esp32c6" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}"
build "esp32h2" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}"
build "esp32" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}"
if [ "$BUILD_LOG" -eq 1 ]; then
#remove last comma from the last JSON object
sed -i '$ s/,$//' "$sizes_file"
#echo end of JSON array
echo "]}" >> "$sizes_file"
fi

View file

@ -1,52 +1,65 @@
#!/bin/bash
# Disable shellcheck warning about using 'cat' to read a file.
# Disable shellcheck warning about using individual redirections for each command.
# Disable shellcheck warning about $? uses.
# shellcheck disable=SC2002,SC2129,SC2181,SC2319
if [ ! $GITHUB_EVENT_NAME == "release" ]; then
if [ ! "$GITHUB_EVENT_NAME" == "release" ]; then
echo "Wrong event '$GITHUB_EVENT_NAME'!"
exit 1
fi
EVENT_JSON=`cat $GITHUB_EVENT_PATH`
EVENT_JSON=$(cat "$GITHUB_EVENT_PATH")
action=`echo $EVENT_JSON | jq -r '.action'`
if [ ! $action == "published" ]; then
action=$(echo "$EVENT_JSON" | jq -r '.action')
if [ ! "$action" == "published" ]; then
echo "Wrong action '$action'. Exiting now..."
exit 0
fi
draft=`echo $EVENT_JSON | jq -r '.release.draft'`
if [ $draft == "true" ]; then
draft=$(echo "$EVENT_JSON" | jq -r '.release.draft')
if [ "$draft" == "true" ]; then
echo "It's a draft release. Exiting now..."
exit 0
fi
RELEASE_PRE=`echo $EVENT_JSON | jq -r '.release.prerelease'`
RELEASE_TAG=`echo $EVENT_JSON | jq -r '.release.tag_name'`
RELEASE_BRANCH=`echo $EVENT_JSON | jq -r '.release.target_commitish'`
RELEASE_ID=`echo $EVENT_JSON | jq -r '.release.id'`
RELEASE_PRE=$(echo "$EVENT_JSON" | jq -r '.release.prerelease')
RELEASE_TAG=$(echo "$EVENT_JSON" | jq -r '.release.tag_name')
RELEASE_BRANCH=$(echo "$EVENT_JSON" | jq -r '.release.target_commitish')
RELEASE_ID=$(echo "$EVENT_JSON" | jq -r '.release.id')
SCRIPTS_DIR="./.github/scripts"
OUTPUT_DIR="$GITHUB_WORKSPACE/build"
PACKAGE_NAME="esp32-$RELEASE_TAG"
PACKAGE_JSON_MERGE="$GITHUB_WORKSPACE/.github/scripts/merge_packages.py"
PACKAGE_JSON_TEMPLATE="$GITHUB_WORKSPACE/package/package_esp32_index.template.json"
PACKAGE_JSON_DEV="package_esp32_dev_index.json"
PACKAGE_JSON_REL="package_esp32_index.json"
PACKAGE_JSON_DEV_CN="package_esp32_dev_index_cn.json"
PACKAGE_JSON_REL_CN="package_esp32_index_cn.json"
echo "Event: $GITHUB_EVENT_NAME, Repo: $GITHUB_REPOSITORY, Path: $GITHUB_WORKSPACE, Ref: $GITHUB_REF"
echo "Action: $action, Branch: $RELEASE_BRANCH, ID: $RELEASE_ID"
echo "Tag: $RELEASE_TAG, Draft: $draft, Pre-Release: $RELEASE_PRE"
# Try extracting something like a JSON with a "boards" array/element and "vendor" fields
BOARDS=`echo $RELEASE_BODY | grep -Pzo '(?s){.*}' | jq -r '.boards[]? // .boards? // empty' | xargs echo -n 2>/dev/null`
VENDOR=`echo $RELEASE_BODY | grep -Pzo '(?s){.*}' | jq -r '.vendor? // empty' | xargs echo -n 2>/dev/null`
if ! [ -z "${BOARDS}" ]; then echo "Releasing board(s): $BOARDS" ; fi
if ! [ -z "${VENDOR}" ]; then echo "Setting packager: $VENDOR" ; fi
BOARDS=$(echo "$RELEASE_BODY" | grep -Pzo '(?s){.*}' | jq -r '.boards[]? // .boards? // empty' | xargs echo -n 2>/dev/null)
VENDOR=$(echo "$RELEASE_BODY" | grep -Pzo '(?s){.*}' | jq -r '.vendor? // empty' | xargs echo -n 2>/dev/null)
function get_file_size(){
if [ -n "${BOARDS}" ]; then
echo "Releasing board(s): $BOARDS"
fi
if [ -n "${VENDOR}" ]; then
echo "Setting packager: $VENDOR"
fi
function get_file_size {
local file="$1"
if [[ "$OSTYPE" == "darwin"* ]]; then
eval `stat -s "$file"`
eval "$(stat -s "$file")"
local res="$?"
echo "$st_size"
echo "${st_size:?}"
return $res
else
stat --printf="%s" "$file"
@ -54,23 +67,29 @@ function get_file_size(){
fi
}
function git_upload_asset(){
local name=$(basename "$1")
function git_upload_asset {
local name
name=$(basename "$1")
# local mime=$(file -b --mime-type "$1")
curl -k -X POST -sH "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/octet-stream" --data-binary @"$1" "https://uploads.github.com/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets?name=$name"
}
function git_safe_upload_asset(){
function git_safe_upload_asset {
local file="$1"
local name=$(basename "$file")
local size=`get_file_size "$file"`
local upload_res=`git_upload_asset "$file"`
if [ $? -ne 0 ]; then
local name
local size
local upload_res
name=$(basename "$file")
size=$(get_file_size "$file")
if ! upload_res=$(git_upload_asset "$file"); then
>&2 echo "ERROR: Failed to upload '$name' ($?)"
return 1
fi
up_size=`echo "$upload_res" | jq -r '.size'`
if [ $up_size -ne $size ]; then
up_size=$(echo "$upload_res" | jq -r '.size')
if [ "$up_size" -ne "$size" ]; then
>&2 echo "ERROR: Uploaded size does not match! $up_size != $size"
#git_delete_asset
return 1
@ -79,7 +98,7 @@ function git_safe_upload_asset(){
return $?
}
function git_upload_to_pages(){
function git_upload_to_pages {
local path=$1
local src=$2
@ -88,41 +107,50 @@ function git_upload_to_pages(){
return 1
fi
local info=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.object+json" -X GET "https://api.github.com/repos/$GITHUB_REPOSITORY/contents/$path?ref=gh-pages"`
local type=`echo "$info" | jq -r '.type'`
local message=$(basename $path)
local info
local type
local message
local sha=""
local content=""
if [ $type == "file" ]; then
sha=`echo "$info" | jq -r '.sha'`
info=$(curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.object+json" -X GET "https://api.github.com/repos/$GITHUB_REPOSITORY/contents/$path?ref=gh-pages")
type=$(echo "$info" | jq -r '.type')
message=$(basename "$path")
if [ "$type" == "file" ]; then
sha=$(echo "$info" | jq -r '.sha')
sha=",\"sha\":\"$sha\""
message="Updating $message"
elif [ ! $type == "null" ]; then
elif [ ! "$type" == "null" ]; then
>&2 echo "Wrong type '$type'"
return 1
else
message="Creating $message"
fi
content=`base64 -i "$src"`
content=$(base64 -i "$src")
data="{\"branch\":\"gh-pages\",\"message\":\"$message\",\"content\":\"$content\"$sha}"
echo "$data" | curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" -X PUT --data @- "https://api.github.com/repos/$GITHUB_REPOSITORY/contents/$path"
}
function git_safe_upload_to_pages(){
function git_safe_upload_to_pages {
local path=$1
local file="$2"
local name=$(basename "$file")
local size=`get_file_size "$file"`
local upload_res=`git_upload_to_pages "$path" "$file"`
if [ $? -ne 0 ]; then
local name
local size
local upload_res
name=$(basename "$file")
size=$(get_file_size "$file")
if ! upload_res=$(git_upload_to_pages "$path" "$file"); then
>&2 echo "ERROR: Failed to upload '$name' ($?)"
return 1
fi
up_size=`echo "$upload_res" | jq -r '.content.size'`
if [ $up_size -ne $size ]; then
up_size=$(echo "$upload_res" | jq -r '.content.size')
if [ "$up_size" -ne "$size" ]; then
>&2 echo "ERROR: Uploaded size does not match! $up_size != $size"
#git_delete_asset
return 1
@ -131,15 +159,20 @@ function git_safe_upload_to_pages(){
return $?
}
function merge_package_json(){
function merge_package_json {
local jsonLink=$1
local jsonOut=$2
local old_json=$OUTPUT_DIR/oldJson.json
local merged_json=$OUTPUT_DIR/mergedJson.json
local error_code=0
echo "Downloading previous JSON $jsonLink ..."
curl -L -o "$old_json" "https://github.com/$GITHUB_REPOSITORY/releases/download/$jsonLink?access_token=$GITHUB_TOKEN" 2>/dev/null
if [ $? -ne 0 ]; then echo "ERROR: Download Failed! $?"; exit 1; fi
error_code=$?
if [ $error_code -ne 0 ]; then
echo "ERROR: Download Failed! $error_code"
exit 1
fi
echo "Creating new JSON ..."
set +e
@ -147,7 +180,7 @@ function merge_package_json(){
set -e
set -v
if [ ! -s $merged_json ]; then
if [ ! -s "$merged_json" ]; then
rm -f "$merged_json"
echo "Nothing to merge"
else
@ -188,10 +221,14 @@ else
done
# Copy only relevant variant files
mkdir "$PKG_DIR/variants/"
for variant in `cat ${PKG_DIR}/boards.txt | grep "\.variant=" | cut -d= -f2` ; do
board_list=$(cat "${PKG_DIR}"/boards.txt | grep "\.variant=" | cut -d= -f2)
while IFS= read -r variant; do
cp -Rf "$GITHUB_WORKSPACE/variants/${variant}" "$PKG_DIR/variants/"
done
done <<< "$board_list"
fi
cp -f "$GITHUB_WORKSPACE/CMakeLists.txt" "$PKG_DIR/"
cp -f "$GITHUB_WORKSPACE/idf_component.yml" "$PKG_DIR/"
cp -f "$GITHUB_WORKSPACE/Kconfig.projbuild" "$PKG_DIR/"
cp -f "$GITHUB_WORKSPACE/package.json" "$PKG_DIR/"
cp -f "$GITHUB_WORKSPACE/programmers.txt" "$PKG_DIR/"
cp -Rf "$GITHUB_WORKSPACE/cores" "$PKG_DIR/"
@ -204,7 +241,7 @@ cp -f "$GITHUB_WORKSPACE/tools/gen_insights_package.py" "$PKG_DIR/tools/"
cp -f "$GITHUB_WORKSPACE/tools/gen_insights_package.exe" "$PKG_DIR/tools/"
cp -Rf "$GITHUB_WORKSPACE/tools/partitions" "$PKG_DIR/tools/"
cp -Rf "$GITHUB_WORKSPACE/tools/ide-debug" "$PKG_DIR/tools/"
cp -f "$GITHUB_WORKSPACE/tools/platformio-build.py" "$PKG_DIR/tools/"
cp -f "$GITHUB_WORKSPACE/tools/pioarduino-build.py" "$PKG_DIR/tools/"
# Remove unnecessary files in the package folder
echo "Cleaning up folders ..."
@ -216,47 +253,50 @@ find "$PKG_DIR" -name '*.git*' -type f -delete
##
RVTC_NAME="riscv32-esp-elf-gcc"
RVTC_NEW_NAME="esp-rv32"
X32TC_NAME="xtensa-esp-elf-gcc"
X32TC_NEW_NAME="esp-x32"
# Replace tools locations in platform.txt
echo "Generating platform.txt..."
cat "$GITHUB_WORKSPACE/platform.txt" | \
sed "s/version=.*/version=$RELEASE_TAG/g" | \
sed 's/tools\.esp32-arduino-libs\.path\.windows=.*//g' | \
sed 's/{runtime\.platform\.path}.tools.esp32-arduino-libs/\{runtime.tools.esp32-arduino-libs.path\}/g' | \
sed 's/{runtime\.platform\.path}.tools.xtensa-esp-elf-gdb/\{runtime.tools.xtensa-esp-elf-gdb.path\}/g' | \
sed 's/{runtime\.platform\.path}.tools.xtensa-esp32-elf/\{runtime.tools.xtensa-esp32-elf-gcc.path\}/g' | \
sed 's/{runtime\.platform\.path}.tools.xtensa-esp32s2-elf/\{runtime.tools.xtensa-esp32s2-elf-gcc.path\}/g' | \
sed 's/{runtime\.platform\.path}.tools.xtensa-esp32s3-elf/\{runtime.tools.xtensa-esp32s3-elf-gcc.path\}/g' | \
sed "s/{runtime\.platform\.path}.tools.xtensa-esp-elf/\\{runtime.tools.$X32TC_NEW_NAME.path\\}/g" | \
sed 's/{runtime\.platform\.path}.tools.riscv32-esp-elf-gdb/\{runtime.tools.riscv32-esp-elf-gdb.path\}/g' | \
sed "s/{runtime\.platform\.path}.tools.riscv32-esp-elf/\\{runtime.tools.$RVTC_NEW_NAME.path\\}/g" | \
sed 's/{runtime\.platform\.path}.tools.esptool/\{runtime.tools.esptool_py.path\}/g' | \
sed 's/{runtime\.platform\.path}.tools.openocd-esp32/\{runtime.tools.openocd-esp32.path\}/g' \
> "$PKG_DIR/platform.txt"
sed 's/{runtime\.platform\.path}.tools.openocd-esp32/\{runtime.tools.openocd-esp32.path\}/g' > "$PKG_DIR/platform.txt"
if ! [ -z ${VENDOR} ]; then
if [ -n "${VENDOR}" ]; then
# Append vendor name to platform.txt to create a separate section
sed -i "/^name=.*/s/$/ ($VENDOR)/" "$PKG_DIR/platform.txt"
fi
# Add header with version information
echo "Generating core_version.h ..."
ver_define=`echo $RELEASE_TAG | tr "[:lower:].\055" "[:upper:]_"`
ver_hex=`git -C "$GITHUB_WORKSPACE" rev-parse --short=8 HEAD 2>/dev/null`
echo \#define ARDUINO_ESP32_GIT_VER 0x$ver_hex > "$PKG_DIR/cores/esp32/core_version.h"
echo \#define ARDUINO_ESP32_GIT_DESC `git -C "$GITHUB_WORKSPACE" describe --tags 2>/dev/null` >> "$PKG_DIR/cores/esp32/core_version.h"
echo \#define ARDUINO_ESP32_RELEASE_$ver_define >> "$PKG_DIR/cores/esp32/core_version.h"
echo \#define ARDUINO_ESP32_RELEASE \"$ver_define\" >> "$PKG_DIR/cores/esp32/core_version.h"
ver_define=$(echo "$RELEASE_TAG" | tr "[:lower:].\055" "[:upper:]_")
ver_hex=$(git -C "$GITHUB_WORKSPACE" rev-parse --short=8 HEAD 2>/dev/null)
echo \#define ARDUINO_ESP32_GIT_VER 0x"$ver_hex" > "$PKG_DIR/cores/esp32/core_version.h"
echo \#define ARDUINO_ESP32_GIT_DESC "$(git -C "$GITHUB_WORKSPACE" describe --tags 2>/dev/null)" >> "$PKG_DIR/cores/esp32/core_version.h"
echo \#define ARDUINO_ESP32_RELEASE_"$ver_define" >> "$PKG_DIR/cores/esp32/core_version.h"
echo \#define ARDUINO_ESP32_RELEASE \""$ver_define"\" >> "$PKG_DIR/cores/esp32/core_version.h"
# Compress package folder
echo "Creating ZIP ..."
pushd "$OUTPUT_DIR" >/dev/null
zip -qr "$PACKAGE_ZIP" "$PACKAGE_NAME"
if [ $? -ne 0 ]; then echo "ERROR: Failed to create $PACKAGE_ZIP ($?)"; exit 1; fi
if [ $? -ne 0 ]; then
echo "ERROR: Failed to create $PACKAGE_ZIP ($?)"
exit 1
fi
# Calculate SHA-256
echo "Calculating SHA sum ..."
PACKAGE_PATH="$OUTPUT_DIR/$PACKAGE_ZIP"
PACKAGE_SHA=`shasum -a 256 "$PACKAGE_ZIP" | cut -f 1 -d ' '`
PACKAGE_SIZE=`get_file_size "$PACKAGE_ZIP"`
PACKAGE_SHA=$(shasum -a 256 "$PACKAGE_ZIP" | cut -f 1 -d ' ')
PACKAGE_SIZE=$(get_file_size "$PACKAGE_ZIP")
popd >/dev/null
rm -rf "$PKG_DIR"
echo "'$PACKAGE_ZIP' Created! Size: $PACKAGE_SIZE, SHA-256: $PACKAGE_SHA"
@ -264,86 +304,28 @@ echo
# Upload package to release page
echo "Uploading package to release page ..."
PACKAGE_URL=`git_safe_upload_asset "$PACKAGE_PATH"`
PACKAGE_URL=$(git_safe_upload_asset "$PACKAGE_PATH")
echo "Package Uploaded"
echo "Download URL: $PACKAGE_URL"
echo
##
## LIBS PACKAGE ZIP
##
LIBS_PROJ_NAME="esp32-arduino-libs"
LIBS_PKG_DIR="$OUTPUT_DIR/$LIBS_PROJ_NAME"
LIBS_PACKAGE_ZIP="$LIBS_PROJ_NAME-$RELEASE_TAG.zip"
# Get the libs package URL from the template
LIBS_PACKAGE_SRC_ZIP="$OUTPUT_DIR/src-$LIBS_PROJ_NAME.zip"
LIBS_PACKAGE_SRC_URL=`cat $PACKAGE_JSON_TEMPLATE | jq -r ".packages[0].tools[] | select(.name==\"$LIBS_PROJ_NAME\") | .systems[0].url"`
# Download the libs package
echo "Downloading the libs archive ..."
curl -o "$LIBS_PACKAGE_SRC_ZIP" -LJO --url "$LIBS_PACKAGE_SRC_URL" || exit 1
# Extract the libs package
echo "Extracting the archive ..."
unzip -q -d "$OUTPUT_DIR" "$LIBS_PACKAGE_SRC_ZIP" || exit 1
EXTRACTED_DIR=`ls "$OUTPUT_DIR" | grep "^$LIBS_PROJ_NAME"`
mv "$OUTPUT_DIR/$EXTRACTED_DIR" "$LIBS_PKG_DIR" || exit 1
# Remove unnecessary files in the package folder
echo "Cleaning up folders ..."
find "$LIBS_PKG_DIR" -name '*.DS_Store' -exec rm -f {} \;
find "$LIBS_PKG_DIR" -name '*.git*' -type f -delete
# Compress package folder
echo "Creating ZIP ..."
pushd "$OUTPUT_DIR" >/dev/null
zip -qr "$LIBS_PACKAGE_ZIP" "$LIBS_PROJ_NAME"
if [ $? -ne 0 ]; then echo "ERROR: Failed to create $LIBS_PACKAGE_ZIP ($?)"; exit 1; fi
# Calculate SHA-256
echo "Calculating SHA sum ..."
LIBS_PACKAGE_PATH="$OUTPUT_DIR/$LIBS_PACKAGE_ZIP"
LIBS_PACKAGE_SHA=`shasum -a 256 "$LIBS_PACKAGE_ZIP" | cut -f 1 -d ' '`
LIBS_PACKAGE_SIZE=`get_file_size "$LIBS_PACKAGE_ZIP"`
popd >/dev/null
rm -rf "$LIBS_PKG_DIR"
echo "'$LIBS_PACKAGE_ZIP' Created! Size: $LIBS_PACKAGE_SIZE, SHA-256: $LIBS_PACKAGE_SHA"
echo
# Upload package to release page
echo "Uploading libs package to release page ..."
LIBS_PACKAGE_URL=`git_safe_upload_asset "$LIBS_PACKAGE_PATH"`
echo "Libs Package Uploaded"
echo "Libs Download URL: $LIBS_PACKAGE_URL"
echo
# Construct JQ argument with libs package data
libs_jq_arg="\
(.packages[0].tools[] | select(.name==\"$LIBS_PROJ_NAME\")).systems[].url = \"$LIBS_PACKAGE_URL\" |\
(.packages[0].tools[] | select(.name==\"$LIBS_PROJ_NAME\")).systems[].archiveFileName = \"$LIBS_PACKAGE_ZIP\" |\
(.packages[0].tools[] | select(.name==\"$LIBS_PROJ_NAME\")).systems[].size = \"$LIBS_PACKAGE_SIZE\" |\
(.packages[0].tools[] | select(.name==\"$LIBS_PROJ_NAME\")).systems[].checksum = \"SHA-256:$LIBS_PACKAGE_SHA\""
# Update template values for the libs package and store it in the build folder
cat "$PACKAGE_JSON_TEMPLATE" | jq "$libs_jq_arg" > "$OUTPUT_DIR/package-$LIBS_PROJ_NAME.json"
# Overwrite the template location with the newly edited one
PACKAGE_JSON_TEMPLATE="$OUTPUT_DIR/package-$LIBS_PROJ_NAME.json"
##
## TEMP WORKAROUND FOR RV32 LONG PATH ON WINDOWS
##
RVTC_VERSION=`cat $PACKAGE_JSON_TEMPLATE | jq -r ".packages[0].platforms[0].toolsDependencies[] | select(.name == \"$RVTC_NAME\") | .version" | cut -d '_' -f 2`
RVTC_VERSION=$(cat "$PACKAGE_JSON_TEMPLATE" | jq -r ".packages[0].platforms[0].toolsDependencies[] | select(.name == \"$RVTC_NAME\") | .version" | cut -d '_' -f 2)
# RVTC_VERSION=`date -j -f '%Y%m%d' "$RVTC_VERSION" '+%y%m'` # MacOS
RVTC_VERSION=`date -d "$RVTC_VERSION" '+%y%m'`
RVTC_VERSION=$(date -d "$RVTC_VERSION" '+%y%m')
rvtc_jq_arg="\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$RVTC_NAME\")).version = \"$RVTC_VERSION\" |\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$RVTC_NAME\")).name = \"$RVTC_NEW_NAME\" |\
(.packages[0].tools[] | select(.name==\"$RVTC_NAME\")).version = \"$RVTC_VERSION\" |\
(.packages[0].tools[] | select(.name==\"$RVTC_NAME\")).name = \"$RVTC_NEW_NAME\""
cat "$PACKAGE_JSON_TEMPLATE" | jq "$rvtc_jq_arg" > "$OUTPUT_DIR/package-$LIBS_PROJ_NAME-rvfix.json"
PACKAGE_JSON_TEMPLATE="$OUTPUT_DIR/package-$LIBS_PROJ_NAME-rvfix.json"
(.packages[0].tools[] | select(.name==\"$RVTC_NAME\")).name = \"$RVTC_NEW_NAME\" |\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$X32TC_NAME\")).version = \"$RVTC_VERSION\" |\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$X32TC_NAME\")).name = \"$X32TC_NEW_NAME\" |\
(.packages[0].tools[] | select(.name==\"$X32TC_NAME\")).version = \"$RVTC_VERSION\" |\
(.packages[0].tools[] | select(.name==\"$X32TC_NAME\")).name = \"$X32TC_NEW_NAME\""
cat "$PACKAGE_JSON_TEMPLATE" | jq "$rvtc_jq_arg" > "$OUTPUT_DIR/package-rvfix.json"
PACKAGE_JSON_TEMPLATE="$OUTPUT_DIR/package-rvfix.json"
##
## PACKAGE JSON
@ -357,17 +339,26 @@ jq_arg=".packages[0].platforms[0].version = \"$RELEASE_TAG\" | \
.packages[0].platforms[0].checksum = \"SHA-256:$PACKAGE_SHA\""
# Generate package JSONs
echo "Genarating $PACKAGE_JSON_DEV ..."
echo "Generating $PACKAGE_JSON_DEV ..."
cat "$PACKAGE_JSON_TEMPLATE" | jq "$jq_arg" > "$OUTPUT_DIR/$PACKAGE_JSON_DEV"
# On MacOS the sed command won't skip the first match. Use gsed instead.
sed '0,/github\.com\//!s|github\.com/|dl.espressif.cn/github_assets/|g' "$OUTPUT_DIR/$PACKAGE_JSON_DEV" > "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN"
python "$SCRIPTS_DIR/release_append_cn.py" "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN"
if [ "$RELEASE_PRE" == "false" ]; then
echo "Genarating $PACKAGE_JSON_REL ..."
echo "Generating $PACKAGE_JSON_REL ..."
cat "$PACKAGE_JSON_TEMPLATE" | jq "$jq_arg" > "$OUTPUT_DIR/$PACKAGE_JSON_REL"
# On MacOS the sed command won't skip the first match. Use gsed instead.
sed '0,/github\.com\//!s|github\.com/|dl.espressif.cn/github_assets/|g' "$OUTPUT_DIR/$PACKAGE_JSON_REL" > "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN"
python "$SCRIPTS_DIR/release_append_cn.py" "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN"
fi
# Figure out the last release or pre-release
echo "Getting previous releases ..."
releasesJson=`curl -sH "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/$GITHUB_REPOSITORY/releases" 2>/dev/null`
if [ $? -ne 0 ]; then echo "ERROR: Get Releases Failed! ($?)"; exit 1; fi
releasesJson=$(curl -sH "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/$GITHUB_REPOSITORY/releases" 2>/dev/null)
if [ $? -ne 0 ]; then
echo "ERROR: Get Releases Failed! ($?)"
exit 1
fi
set +e
prev_release=$(echo "$releasesJson" | jq -e -r ". | map(select(.draft == false and .prerelease == false)) | sort_by(.published_at | - fromdateiso8601) | .[0].tag_name")
@ -387,27 +378,94 @@ echo "Previous (any)release: $prev_any_release"
echo
# Merge package JSONs with previous releases
if [ ! -z "$prev_any_release" ] && [ "$prev_any_release" != "null" ]; then
if [ -n "$prev_any_release" ] && [ "$prev_any_release" != "null" ]; then
echo "Merging with JSON from $prev_any_release ..."
merge_package_json "$prev_any_release/$PACKAGE_JSON_DEV" "$OUTPUT_DIR/$PACKAGE_JSON_DEV"
merge_package_json "$prev_any_release/$PACKAGE_JSON_DEV_CN" "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN"
fi
if [ "$RELEASE_PRE" == "false" ]; then
if [ ! -z "$prev_release" ] && [ "$prev_release" != "null" ]; then
if [ -n "$prev_release" ] && [ "$prev_release" != "null" ]; then
echo "Merging with JSON from $prev_release ..."
merge_package_json "$prev_release/$PACKAGE_JSON_REL" "$OUTPUT_DIR/$PACKAGE_JSON_REL"
merge_package_json "$prev_release/$PACKAGE_JSON_REL_CN" "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN"
fi
fi
# Test the package JSONs
echo "Installing arduino-cli ..."
export PATH="/home/runner/bin:$PATH"
source "${SCRIPTS_DIR}/install-arduino-cli.sh"
# For the Chinese mirror, we can't test the package JSONs as the Chinese mirror might not be updated yet.
echo "Testing $PACKAGE_JSON_DEV install ..."
echo "Installing esp32 ..."
arduino-cli core install esp32:esp32 --additional-urls "file://$OUTPUT_DIR/$PACKAGE_JSON_DEV"
if [ $? -ne 0 ]; then
echo "ERROR: Failed to install esp32 ($?)"
exit 1
fi
echo "Compiling example ..."
arduino-cli compile --fqbn esp32:esp32:esp32 "$GITHUB_WORKSPACE"/libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino
if [ $? -ne 0 ]; then
echo "ERROR: Failed to compile example ($?)"
exit 1
fi
echo "Uninstalling esp32 ..."
arduino-cli core uninstall esp32:esp32
if [ $? -ne 0 ]; then
echo "ERROR: Failed to uninstall esp32 ($?)"
exit 1
fi
echo "Test successful!"
if [ "$RELEASE_PRE" == "false" ]; then
echo "Testing $PACKAGE_JSON_REL install ..."
echo "Installing esp32 ..."
arduino-cli core install esp32:esp32 --additional-urls "file://$OUTPUT_DIR/$PACKAGE_JSON_REL"
if [ $? -ne 0 ]; then
echo "ERROR: Failed to install esp32 ($?)"
exit 1
fi
echo "Compiling example ..."
arduino-cli compile --fqbn esp32:esp32:esp32 "$GITHUB_WORKSPACE"/libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino
if [ $? -ne 0 ]; then
echo "ERROR: Failed to compile example ($?)"
exit 1
fi
echo "Uninstalling esp32 ..."
arduino-cli core uninstall esp32:esp32
if [ $? -ne 0 ]; then
echo "ERROR: Failed to uninstall esp32 ($?)"
exit 1
fi
echo "Test successful!"
fi
# Upload package JSONs
echo "Uploading $PACKAGE_JSON_DEV ..."
echo "Download URL: "`git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_DEV"`
echo "Pages URL: "`git_safe_upload_to_pages "$PACKAGE_JSON_DEV" "$OUTPUT_DIR/$PACKAGE_JSON_DEV"`
echo "Download URL: $(git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_DEV")"
echo "Pages URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_DEV" "$OUTPUT_DIR/$PACKAGE_JSON_DEV")"
echo "Download CN URL: $(git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN")"
echo "Pages CN URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_DEV_CN" "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN")"
echo
if [ "$RELEASE_PRE" == "false" ]; then
echo "Uploading $PACKAGE_JSON_REL ..."
echo "Download URL: "`git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_REL"`
echo "Pages URL: "`git_safe_upload_to_pages "$PACKAGE_JSON_REL" "$OUTPUT_DIR/$PACKAGE_JSON_REL"`
echo "Download URL: $(git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_REL")"
echo "Pages URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_REL" "$OUTPUT_DIR/$PACKAGE_JSON_REL")"
echo "Download CN URL: $(git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN")"
echo "Pages CN URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_REL_CN" "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN")"
echo
fi

57
.github/scripts/release_append_cn.py vendored Executable file
View file

@ -0,0 +1,57 @@
#!/usr/bin/env python3
# Arduino IDE provides by default a package file for the ESP32. This causes version conflicts
# when the user tries to use the JSON file with the Chinese mirrors.
#
# The downside is that the Arduino IDE will always warn the user that updates are available as it
# will consider the version from the Chinese mirrors as a pre-release version.
#
# This script is used to append "-cn" to all versions in the package_esp32_index_cn.json file so that
# the user can select the Chinese mirrors without conflicts.
#
# If Arduino ever stops providing the package_esp32_index.json file by default,
# this script can be removed and the tags reverted.
import json
def append_cn_to_versions(obj):
if isinstance(obj, dict):
# Skip tools that are not from the esp32 package
packager = obj.get("packager")
if packager is not None and packager != "esp32":
return
for key, value in obj.items():
if key == "version" and isinstance(value, str):
if not value.endswith("-cn"):
obj[key] = value + "-cn"
else:
append_cn_to_versions(value)
elif isinstance(obj, list):
for item in obj:
append_cn_to_versions(item)
def process_json_file(input_path, output_path=None):
with open(input_path, "r", encoding="utf-8") as f:
data = json.load(f)
append_cn_to_versions(data)
if output_path is None:
output_path = input_path
with open(output_path, "w", encoding="utf-8") as f:
json.dump(data, f, indent=2)
print(f"Updated JSON written to {output_path}")
if __name__ == "__main__":
import sys
if len(sys.argv) < 2:
print("Usage: python release_append_cn.py input.json [output.json]")
else:
input_file = sys.argv[1]
output_file = sys.argv[2] if len(sys.argv) > 2 else None
process_json_file(input_file, output_file)

84
.github/scripts/set_push_chunks.sh vendored Normal file
View file

@ -0,0 +1,84 @@
#!/bin/bash
build_all=false
chunks_count=0
if [[ $CORE_CHANGED == 'true' ]] || [[ $IS_PR != 'true' ]]; then
echo "Core files changed or not a PR. Building all."
build_all=true
chunks_count=$MAX_CHUNKS
elif [[ $LIB_CHANGED == 'true' ]]; then
echo "Libraries changed. Building only affected sketches."
if [[ $NETWORKING_CHANGED == 'true' ]]; then
echo "Networking libraries changed. Building networking related sketches."
networking_sketches="$(find libraries/WiFi -name '*.ino') "
networking_sketches+="$(find libraries/Ethernet -name '*.ino') "
networking_sketches+="$(find libraries/PPP -name '*.ino') "
networking_sketches+="$(find libraries/NetworkClientSecure -name '*.ino') "
networking_sketches+="$(find libraries/WebServer -name '*.ino') "
fi
if [[ $FS_CHANGED == 'true' ]]; then
echo "FS libraries changed. Building FS related sketches."
fs_sketches="$(find libraries/SD -name '*.ino') "
fs_sketches+="$(find libraries/SD_MMC -name '*.ino') "
fs_sketches+="$(find libraries/SPIFFS -name '*.ino') "
fs_sketches+="$(find libraries/LittleFS -name '*.ino') "
fs_sketches+="$(find libraries/FFat -name '*.ino') "
fi
sketches="$networking_sketches $fs_sketches"
for file in $LIB_FILES; do
lib=$(echo "$file" | awk -F "/" '{print $1"/"$2}')
if [[ "$file" == *.ino ]]; then
# If file ends with .ino, add it to the list of sketches
echo "Sketch found: $file"
sketches+="$file "
elif [[ "$file" == "$lib/src/"* ]]; then
# If file is inside the src directory, find all sketches in the lib/examples directory
echo "Library src file found: $file"
if [[ -d $lib/examples ]]; then
lib_sketches=$(find "$lib"/examples -name '*.ino')
sketches+="$lib_sketches "
echo "Library sketches: $lib_sketches"
fi
else
# If file is in a example folder but it is not a sketch, find all sketches in the current directory
echo "File in example folder found: $file"
sketch=$(find "$(dirname "$file")" -name '*.ino')
sketches+="$sketch "
echo "Sketch in example folder: $sketch"
fi
echo ""
done
fi
if [[ -n $sketches ]]; then
# Remove duplicates
sketches=$(echo "$sketches" | tr ' ' '\n' | sort | uniq)
for sketch in $sketches; do
echo "$sketch" >> sketches_found.txt
chunks_count=$((chunks_count+1))
done
echo "Number of sketches found: $chunks_count"
echo "Sketches:"
echo "$sketches"
if [[ $chunks_count -gt $MAX_CHUNKS ]]; then
echo "More sketches than the allowed number of chunks found. Limiting to $MAX_CHUNKS chunks."
chunks_count=$MAX_CHUNKS
fi
fi
chunks='["0"'
for i in $(seq 1 $(( chunks_count - 1 )) ); do
chunks+=",\"$i\""
done
chunks+="]"
{
echo "build_all=$build_all"
echo "build_libraries=$BUILD_LIBRARIES"
echo "build_static_sketches=$BUILD_STATIC_SKETCHES"
echo "build_idf=$BUILD_IDF"
echo "chunk_count=$chunks_count"
echo "chunks=$chunks"
} >> "$GITHUB_OUTPUT"

View file

@ -1,7 +1,60 @@
#!/bin/bash
function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [extra-options]
while [ ! -z "$1" ]; do
if [ -d "$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs" ]; then
SDKCONFIG_DIR="$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs"
elif [ -d "$GITHUB_WORKSPACE/tools/esp32-arduino-libs" ]; then
SDKCONFIG_DIR="$GITHUB_WORKSPACE/tools/esp32-arduino-libs"
else
SDKCONFIG_DIR="tools/esp32-arduino-libs"
fi
function check_requirements { # check_requirements <sketchdir> <sdkconfig_path>
local sketchdir=$1
local sdkconfig_path=$2
local has_requirements=1
local requirements
local requirements_or
if [ ! -f "$sdkconfig_path" ] || [ ! -f "$sketchdir/ci.json" ]; then
echo "WARNING: sdkconfig or ci.json not found. Assuming requirements are met." 1>&2
# Return 1 on error to force the sketch to be built and fail. This way the
# CI will fail and the user will know that the sketch has a problem.
else
# Check if the sketch requires any configuration options (AND)
requirements=$(jq -r '.requires[]? // empty' "$sketchdir/ci.json")
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then
for requirement in $requirements; do
requirement=$(echo "$requirement" | xargs)
found_line=$(grep -E "^$requirement" "$sdkconfig_path")
if [[ "$found_line" == "" ]]; then
has_requirements=0
fi
done
fi
# Check if the sketch requires any configuration options (OR)
requirements_or=$(jq -r '.requires_any[]? // empty' "$sketchdir/ci.json")
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then
local found=false
for requirement in $requirements_or; do
requirement=$(echo "$requirement" | xargs)
found_line=$(grep -E "^$requirement" "$sdkconfig_path")
if [[ "$found_line" != "" ]]; then
found=true
break
fi
done
if [[ "$found" == "false" ]]; then
has_requirements=0
fi
fi
fi
echo $has_requirements
}
function build_sketch { # build_sketch <ide_path> <user_path> <path-to-ino> [extra-options]
while [ -n "$1" ]; do
case "$1" in
-ai )
shift
@ -27,6 +80,18 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
shift
sketchdir=$1
;;
-i )
shift
chunk_index=$1
;;
-l )
shift
log_compilation=$1
;;
-d )
shift
debug_level="DebugLevel=$1"
;;
* )
break
;;
@ -34,9 +99,10 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
shift
done
xtra_opts=$*
xtra_opts=("$@")
len=0
if [ -z $sketchdir ]; then
if [ -z "$sketchdir" ]; then
echo "ERROR: Sketch directory not provided"
echo "$USAGE"
exit 1
@ -44,8 +110,8 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
# No FQBN was passed, try to get it from other options
if [ -z $fqbn ]; then
if [ -z $target ]; then
if [ -z "$fqbn" ]; then
if [ -z "$target" ]; then
echo "ERROR: Unspecified chip"
echo "$USAGE"
exit 1
@ -56,48 +122,83 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
# precedence. Note that the following logic also falls to the default
# parameters if no arguments were passed and no file was found.
if [ -z $options ] && [ -f $sketchdir/cfg.json ]; then
if [ -z "$options" ] && [ -f "$sketchdir"/ci.json ]; then
# The config file could contain multiple FQBNs for one chip. If
# that's the case we build one time for every FQBN.
len=`jq -r --arg chip $target '.targets[] | select(.name==$chip) | .fqbn | length' $sketchdir/cfg.json`
fqbn=`jq -r --arg chip $target '.targets[] | select(.name==$chip) | .fqbn' $sketchdir/cfg.json`
else
len=$(jq -r --arg target "$target" '.fqbn[$target] | length' "$sketchdir"/ci.json)
if [ "$len" -gt 0 ]; then
fqbn=$(jq -r --arg target "$target" '.fqbn[$target] | sort' "$sketchdir"/ci.json)
fi
fi
if [ -n "$options" ] || [ "$len" -eq 0 ]; then
# Since we are passing options, we will end up with only one FQBN to
# build.
len=1
# Default FQBN options if none were passed in the command line.
if [ -f "$sketchdir"/ci.json ]; then
fqbn_append=$(jq -r '.fqbn_append' "$sketchdir"/ci.json)
if [ "$fqbn_append" == "null" ]; then
fqbn_append=""
fi
fi
esp32_opts="PSRAM=enabled,PartitionScheme=huge_app"
esp32s2_opts="PSRAM=enabled,PartitionScheme=huge_app"
esp32s3_opts="PSRAM=opi,USBMode=default,PartitionScheme=huge_app"
esp32c3_opts="PartitionScheme=huge_app"
esp32c6_opts="PartitionScheme=huge_app"
esp32h2_opts="PartitionScheme=huge_app"
# Default FQBN options if none were passed in the command line.
# Replace any double commas with a single one and strip leading and
# trailing commas.
esp32_opts=$(echo "PSRAM=enabled,$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')
esp32s2_opts=$(echo "PSRAM=enabled,$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')
esp32s3_opts=$(echo "PSRAM=opi,USBMode=default,$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')
esp32c3_opts=$(echo "$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')
esp32c6_opts=$(echo "$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')
esp32h2_opts=$(echo "$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')
esp32p4_opts=$(echo "PSRAM=enabled,USBMode=default,$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')
esp32c5_opts=$(echo "$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')
# Select the common part of the FQBN based on the target. The rest will be
# appended depending on the passed options.
opt=""
case "$target" in
"esp32")
fqbn="espressif:esp32:esp32:${options:-$esp32_opts}"
[ -n "${options:-$esp32_opts}" ] && opt=":${options:-$esp32_opts}"
fqbn="espressif:esp32:esp32$opt"
;;
"esp32s2")
fqbn="espressif:esp32:esp32s2:${options:-$esp32s2_opts}"
[ -n "${options:-$esp32s2_opts}" ] && opt=":${options:-$esp32s2_opts}"
fqbn="espressif:esp32:esp32s2$opt"
;;
"esp32c3")
fqbn="espressif:esp32:esp32c3:${options:-$esp32c3_opts}"
[ -n "${options:-$esp32c3_opts}" ] && opt=":${options:-$esp32c3_opts}"
fqbn="espressif:esp32:esp32c3$opt"
;;
"esp32s3")
fqbn="espressif:esp32:esp32s3:${options:-$esp32s3_opts}"
[ -n "${options:-$esp32s3_opts}" ] && opt=":${options:-$esp32s3_opts}"
fqbn="espressif:esp32:esp32s3$opt"
;;
"esp32c6")
fqbn="espressif:esp32:esp32c6:${options:-$esp32c6_opts}"
[ -n "${options:-$esp32c6_opts}" ] && opt=":${options:-$esp32c6_opts}"
fqbn="espressif:esp32:esp32c6$opt"
;;
"esp32h2")
fqbn="espressif:esp32:esp32h2:${options:-$esp32h2_opts}"
[ -n "${options:-$esp32h2_opts}" ] && opt=":${options:-$esp32h2_opts}"
fqbn="espressif:esp32:esp32h2$opt"
;;
"esp32p4")
[ -n "${options:-$esp32p4_opts}" ] && opt=":${options:-$esp32p4_opts}"
fqbn="espressif:esp32:esp32p4$opt"
;;
"esp32c5")
[ -n "${options:-$esp32c5_opts}" ] && opt=":${options:-$esp32c5_opts}"
fqbn="espressif:esp32:esp32c5$opt"
;;
*)
echo "ERROR: Invalid chip: $target"
exit 1
;;
esac
@ -113,11 +214,11 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
fi
if [ -z "$fqbn" ]; then
echo "No FQBN passed or unvalid chip: $target"
echo "No FQBN passed or invalid chip: $target"
exit 1
fi
# The directory that will hold all the artifcats (the build directory) is
# The directory that will hold all the artifacts (the build directory) is
# provided through:
# 1. An env variable called ARDUINO_BUILD_DIR.
# 2. Created at the sketch level as "build" in the case of a single
@ -125,69 +226,107 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
# 3. Created at the sketch level as "buildX" where X is the number
# of configuration built in case of a multiconfiguration test.
sketchname=$(basename $sketchdir)
sketchname=$(basename "$sketchdir")
local has_requirements
if [[ -n $target ]] && [[ -f "$sketchdir/.skip.$target" ]]; then
echo "Skipping $sketchname for target $target"
exit 0
if [ -f "$sketchdir"/ci.json ]; then
# If the target is listed as false, skip the sketch. Otherwise, include it.
is_target=$(jq -r --arg target "$target" '.targets[$target]' "$sketchdir"/ci.json)
if [[ "$is_target" == "false" ]]; then
echo "Skipping $sketchname for target $target"
exit 0
fi
has_requirements=$(check_requirements "$sketchdir" "$SDKCONFIG_DIR/$target/sdkconfig")
if [ "$has_requirements" == "0" ]; then
echo "Target $target does not meet the requirements for $sketchname. Skipping."
exit 0
fi
fi
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
if [ -n "$ARDUINO_BUILD_DIR" ]; then
build_dir="$ARDUINO_BUILD_DIR"
elif [ $len -eq 1 ]; then
elif [ "$len" -eq 1 ]; then
# build_dir="$sketchdir/build"
build_dir="$HOME/.arduino/tests/$sketchname/build.tmp"
build_dir="$HOME/.arduino/tests/$target/$sketchname/build.tmp"
fi
mkdir -p "$ARDUINO_CACHE_DIR"
for i in `seq 0 $(($len - 1))`
do
if [ $len -ne 1 ]; then
# build_dir="$sketchdir/build$i"
build_dir="$HOME/.arduino/tests/$sketchname/build$i.tmp"
fi
rm -rf $build_dir
mkdir -p $build_dir
output_file="$HOME/.arduino/cli_compile_output.txt"
sizes_file="$GITHUB_WORKSPACE/cli_compile_$chunk_index.json"
currfqbn=`echo $fqbn | jq -r --argjson i $i '.[$i]'`
mkdir -p "$ARDUINO_CACHE_DIR"
for i in $(seq 0 $((len - 1))); do
if [ "$len" -ne 1 ]; then
# build_dir="$sketchdir/build$i"
build_dir="$HOME/.arduino/tests/$target/$sketchname/build$i.tmp"
fi
rm -rf "$build_dir"
mkdir -p "$build_dir"
currfqbn=$(echo "$fqbn" | jq -r --argjson i "$i" '.[$i]')
if [ -f "$ide_path/arduino-cli" ]; then
echo "Building $sketchname with arduino-cli and FQBN=$currfqbn"
curroptions=`echo "$currfqbn" | cut -d':' -f4`
currfqbn=`echo "$currfqbn" | cut -d':' -f1-3`
$ide_path/arduino-cli compile \
curroptions=$(echo "$currfqbn" | cut -d':' -f4)
currfqbn=$(echo "$currfqbn" | cut -d':' -f1-3)
"$ide_path"/arduino-cli compile \
--fqbn "$currfqbn" \
--board-options "$curroptions" \
--warnings "all" \
--build-property "compiler.warning_flags.all=-Wall -Werror=all -Wextra" \
--build-cache-path "$ARDUINO_CACHE_DIR" \
--build-path "$build_dir" \
$xtra_opts "${sketchdir}"
exit_status=$?
if [ $exit_status -ne 0 ]; then
echo ""ERROR: Compilation failed with error code $exit_status""
exit $exit_status
"${xtra_opts[@]}" "${sketchdir}" \
2>&1 | tee "$output_file"
exit_status=${PIPESTATUS[0]}
if [ "$exit_status" -ne 0 ]; then
echo "ERROR: Compilation failed with error code $exit_status"
exit "$exit_status"
fi
if [ -n "$log_compilation" ]; then
#Extract the program storage space and dynamic memory usage in bytes and percentage in separate variables from the output, just the value without the string
flash_bytes=$(grep -oE 'Sketch uses ([0-9]+) bytes' "$output_file" | awk '{print $3}')
flash_percentage=$(grep -oE 'Sketch uses ([0-9]+) bytes \(([0-9]+)%\)' "$output_file" | awk '{print $5}' | tr -d '(%)')
ram_bytes=$(grep -oE 'Global variables use ([0-9]+) bytes' "$output_file" | awk '{print $4}')
ram_percentage=$(grep -oE 'Global variables use ([0-9]+) bytes \(([0-9]+)%\)' "$output_file" | awk '{print $6}' | tr -d '(%)')
# Extract the directory path excluding the filename
directory_path=$(dirname "$sketch")
# Define the constant part
constant_part="/home/runner/Arduino/hardware/espressif/esp32/libraries/"
# Extract the desired substring
lib_sketch_name="${directory_path#"$constant_part"}"
#append json file where key is fqbn, sketch name, sizes -> extracted values
echo "{\"name\": \"$lib_sketch_name\",
\"sizes\": [{
\"flash_bytes\": $flash_bytes,
\"flash_percentage\": $flash_percentage,
\"ram_bytes\": $ram_bytes,
\"ram_percentage\": $ram_percentage
}]
}," >> "$sizes_file"
fi
elif [ -f "$ide_path/arduino-builder" ]; then
echo "Building $sketchname with arduino-builder and FQBN=$currfqbn"
echo "Build path = $build_dir"
$ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \
-fqbn=\"$currfqbn\" \
"$ide_path"/arduino-builder -compile -logger=human -core-api-version=10810 \
-fqbn=\""$currfqbn"\" \
-warnings="all" \
-tools "$ide_path/tools-builder" \
-hardware "$user_path/hardware" \
-libraries "$user_path/libraries" \
-build-cache "$ARDUINO_CACHE_DIR" \
-build-path "$build_dir" \
$xtra_opts "${sketchdir}/${sketchname}.ino"
"${xtra_opts[@]}" "${sketchdir}/${sketchname}.ino"
exit_status=$?
if [ $exit_status -ne 0 ]; then
echo ""ERROR: Compilation failed with error code $exit_status""
echo "ERROR: Compilation failed with error code $exit_status"
exit $exit_status
fi
# $ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \
@ -204,48 +343,72 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
# $xtra_opts "${sketchdir}/${sketchname}.ino"
fi
done
unset fqbn
unset xtra_opts
unset options
}
function count_sketches(){ # count_sketches <path> [target]
function count_sketches { # count_sketches <path> [target] [file] [ignore-requirements]
local path=$1
local target=$2
local ignore_requirements=$3
local file=$4
local sketches
if [ $# -lt 1 ]; then
echo "ERROR: Illegal number of parameters"
echo "USAGE: ${0} count <path> [target]"
echo "ERROR: Illegal number of parameters"
echo "USAGE: ${0} count <path> [target]"
fi
rm -rf sketches.txt
touch sketches.txt
if [ ! -d "$path" ]; then
touch sketches.txt
return 0
fi
local sketches=$(find $path -name *.ino | sort)
if [ -f "$file" ]; then
sketches=$(cat "$file")
else
sketches=$(find "$path" -name '*.ino' | sort)
fi
local sketchnum=0
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
local sketchdir
local sketchdirname
local sketchname
local has_requirements
sketchdir=$(dirname "$sketch")
sketchdirname=$(basename "$sketchdir")
sketchname=$(basename "$sketch")
if [[ "$sketchdirname.ino" != "$sketchname" ]]; then
continue
elif [[ -n $target ]] && [[ -f "$sketchdir/.skip.$target" ]]; then
continue
else
echo $sketch >> sketches.txt
sketchnum=$(($sketchnum + 1))
elif [[ -n $target ]] && [[ -f $sketchdir/ci.json ]]; then
# If the target is listed as false, skip the sketch. Otherwise, include it.
is_target=$(jq -r --arg target "$target" '.targets[$target]' "$sketchdir"/ci.json)
if [[ "$is_target" == "false" ]]; then
continue
fi
if [ "$ignore_requirements" != "1" ]; then
has_requirements=$(check_requirements "$sketchdir" "$SDKCONFIG_DIR/$target/sdkconfig")
if [ "$has_requirements" == "0" ]; then
continue
fi
fi
fi
echo "$sketch" >> sketches.txt
sketchnum=$((sketchnum + 1))
done
return $sketchnum
}
function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <path> <chunk> <total-chunks> [extra-options]
local args=""
while [ ! -z "$1" ]; do
function build_sketches { # build_sketches <ide_path> <user_path> <target> <path> <chunk> <total-chunks> [extra-options]
local args=()
while [ -n "$1" ]; do
case $1 in
-ai )
shift
@ -258,12 +421,12 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
-t )
shift
target=$1
args+=" -t $target"
args+=("-t" "$target")
;;
-fqbn )
shift
fqbn=$1
args+=" -fqbn $fqbn"
args+=("-fqbn" "$fqbn")
;;
-p )
shift
@ -277,6 +440,19 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
shift
chunk_max=$1
;;
-l )
shift
log_compilation=$1
;;
-f )
shift
sketches_file=$1
;;
-d )
shift
debug_level="$1"
args+=("-d" "$debug_level")
;;
* )
break
;;
@ -284,10 +460,10 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
shift
done
local xtra_opts=$*
local xtra_opts=("$@")
if [ -z $chunk_index ] || [ -z $chunk_max ]; then
echo "ERROR: Invalid chunk paramters"
if [ -z "$chunk_index" ] || [ -z "$chunk_max" ]; then
echo "ERROR: Invalid chunk parameters"
echo "$USAGE"
exit 1
fi
@ -297,21 +473,29 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
return 1
fi
if [ "$chunk_index" -gt "$chunk_max" ] && [ "$chunk_max" -ge 2 ]; then
if [ "$chunk_index" -gt "$chunk_max" ] && [ "$chunk_max" -ge 2 ]; then
chunk_index=$chunk_max
fi
set +e
count_sketches "$path" "$target"
local sketchcount=$?
if [ -n "$sketches_file" ]; then
count_sketches "$path" "$target" "0" "$sketches_file"
local sketchcount=$?
else
count_sketches "$path" "$target"
local sketchcount=$?
fi
set -e
local sketches=$(cat sketches.txt)
local sketches
sketches=$(cat sketches.txt)
rm -rf sketches.txt
local chunk_size=$(( $sketchcount / $chunk_max ))
local all_chunks=$(( $chunk_max * $chunk_size ))
local chunk_size
local all_chunks
chunk_size=$(( sketchcount / chunk_max ))
all_chunks=$(( chunk_max * chunk_size ))
if [ "$all_chunks" -lt "$sketchcount" ]; then
chunk_size=$(( $chunk_size + 1 ))
chunk_size=$(( chunk_size + 1 ))
fi
local start_index=0
@ -320,19 +504,20 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
start_index=$chunk_index
end_index=$sketchcount
else
start_index=$(( $chunk_index * $chunk_size ))
start_index=$(( chunk_index * chunk_size ))
if [ "$sketchcount" -le "$start_index" ]; then
echo "Skipping job"
echo "No sketches to build for $target in this chunk"
return 0
fi
end_index=$(( $(( $chunk_index + 1 )) * $chunk_size ))
end_index=$(( $(( chunk_index + 1 )) * chunk_size ))
if [ "$end_index" -gt "$sketchcount" ]; then
end_index=$sketchcount
fi
fi
local start_num=$(( $start_index + 1 ))
local start_num
start_num=$(( start_index + 1 ))
echo "Found $sketchcount Sketches for target '$target'";
echo "Chunk Index : $chunk_index"
echo "Chunk Count : $chunk_max"
@ -340,53 +525,89 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
echo "Start Sketch: $start_num"
echo "End Sketch : $end_index"
#if fqbn is not passed then set it to default for compilation log
if [ -z "$fqbn" ]; then
log_fqbn="espressif:esp32:$target"
else
log_fqbn=$fqbn
fi
sizes_file="$GITHUB_WORKSPACE/cli_compile_$chunk_index.json"
if [ -n "$log_compilation" ]; then
#echo board,target and start of sketches to sizes_file json
echo "{ \"board\": \"$log_fqbn\",
\"target\": \"$target\",
\"sketches\": [" >> "$sizes_file"
fi
local sketchnum=0
args+=" -ai $ide_path -au $user_path"
args+=("-ai" "$ide_path" "-au" "$user_path" "-i" "$chunk_index")
if [ -n "$log_compilation" ]; then
args+=("-l" "$log_compilation")
fi
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
sketchnum=$(($sketchnum + 1))
local sketchdir
local sketchdirname
sketchdir=$(dirname "$sketch")
sketchdirname=$(basename "$sketchdir")
sketchnum=$((sketchnum + 1))
if [ "$sketchnum" -le "$start_index" ] \
|| [ "$sketchnum" -gt "$end_index" ]; then
continue
fi
echo ""
echo "Building Sketch Index $(($sketchnum - 1)) - $sketchdirname"
build_sketch $args -s $sketchdir $xtra_opts
echo "Building Sketch Index $sketchnum - $sketchdirname"
build_sketch "${args[@]}" -s "$sketchdir" "${xtra_opts[@]}"
local result=$?
if [ $result -ne 0 ]; then
return $result
fi
done
if [ -n "$log_compilation" ]; then
#remove last comma from json
if [ "$i" -eq $((len - 1)) ]; then
sed -i '$ s/.$//' "$sizes_file"
fi
#echo end of sketches sizes_file json
echo "]" >> "$sizes_file"
#echo end of board sizes_file json
echo "}," >> "$sizes_file"
fi
return 0
}
USAGE="
USAGE: ${0} [command] [options]
Available commands:
count: Count sketches.
build: Build a sketch.
chunk_build: Build a chunk of sketches.
count: Count sketches.
build: Build a sketch.
chunk_build: Build a chunk of sketches.
check_requirements: Check if target meets sketch requirements.
"
cmd=$1
shift
if [ -z $cmd ]; then
if [ -z "$cmd" ]; then
echo "ERROR: No command supplied"
echo "$USAGE"
exit 2
fi
case "$cmd" in
"count") count_sketches $*
"count") count_sketches "$@"
;;
"build") build_sketch $*
"build") build_sketch "$@"
;;
"chunk_build") build_sketches $*
"chunk_build") build_sketches "$@"
;;
"check_requirements") check_requirements "$@"
;;
*)
echo "ERROR: Unrecognized command"
echo "$USAGE"
exit 2
esac

View file

@ -2,19 +2,20 @@
USAGE="
USAGE:
${0} -c <chunk_build_opts>
Example: ${0} -c -t esp32 -i 0 -m 15
${0} -c -type <test_type> <chunk_build_opts>
Example: ${0} -c -type validation -t esp32 -i 0 -m 15
${0} -s sketch_name <build_opts>
Example: ${0} -s hello_world -t esp32
Example: ${0} -s hello_world -t esp32
${0} -clean
Remove build and test generated files
Remove build and test generated files
"
function clean(){
rm -rf tests/*/build*/
function clean {
rm -rf tests/.pytest_cache
rm -rf tests/*/__pycache__/
rm -rf tests/*/*.xml
find tests/ -type d -name 'build*' -exec rm -rf "{}" \+
find tests/ -type d -name '__pycache__' -exec rm -rf "{}" \+
find tests/ -name '*.xml' -exec rm -rf "{}" \+
find tests/ -name 'result_*.json' -exec rm -rf "{}" \+
}
SCRIPTS_DIR="./.github/scripts"
@ -22,7 +23,7 @@ BUILD_CMD=""
chunk_build=0
while [ ! -z "$1" ]; do
while [ -n "$1" ]; do
case $1 in
-c )
chunk_build=1
@ -35,30 +36,45 @@ while [ ! -z "$1" ]; do
echo "$USAGE"
exit 0
;;
-type )
shift
test_type=$1
;;
-clean )
clean
exit 0
;;
* )
break
;;
break
;;
esac
shift
done
#source ${SCRIPTS_DIR}/install-arduino-ide.sh
source ${SCRIPTS_DIR}/install-arduino-cli.sh
source ${SCRIPTS_DIR}/install-arduino-core-esp32.sh
source "${SCRIPTS_DIR}/install-arduino-cli.sh"
source "${SCRIPTS_DIR}/install-arduino-core-esp32.sh"
args="-ai $ARDUINO_IDE_PATH -au $ARDUINO_USR_PATH"
args=("-ai" "$ARDUINO_IDE_PATH" "-au" "$ARDUINO_USR_PATH")
if [[ $test_type == "all" ]] || [[ -z $test_type ]]; then
if [ -n "$sketch" ]; then
tmp_sketch_path=$(find tests -name "$sketch".ino)
test_type=$(basename "$(dirname "$(dirname "$tmp_sketch_path")")")
echo "Sketch $sketch test type: $test_type"
test_folder="$PWD/tests/$test_type"
else
test_folder="$PWD/tests"
fi
else
test_folder="$PWD/tests/$test_type"
fi
if [ $chunk_build -eq 1 ]; then
BUILD_CMD="${SCRIPTS_DIR}/sketch_utils.sh chunk_build"
args+=" -p $PWD/tests"
args+=("-p" "$test_folder" "-i" "0" "-m" "1")
else
BUILD_CMD="${SCRIPTS_DIR}/sketch_utils.sh build"
args+=" -s $PWD/tests/$sketch"
args+=("-s" "$test_folder/$sketch")
fi
${BUILD_CMD} ${args} $*
${BUILD_CMD} "${args[@]}" "$@"

28
.github/scripts/tests_matrix.sh vendored Normal file
View file

@ -0,0 +1,28 @@
#!/bin/bash
build_types="'validation'"
hw_types="'validation'"
wokwi_types="'validation'"
qemu_types="'validation'"
if [[ $IS_PR != 'true' ]] || [[ $PERFORMANCE_ENABLED == 'true' ]]; then
build_types+=",'performance'"
hw_types+=",'performance'"
#wokwi_types+=",'performance'"
#qemu_types+=",'performance'"
fi
targets="'esp32','esp32s2','esp32s3','esp32c3','esp32c6','esp32h2','esp32p4'"
mkdir -p info
echo "[$wokwi_types]" > info/wokwi_types.txt
echo "[$targets]" > info/targets.txt
{
echo "build-types=[$build_types]"
echo "hw-types=[$hw_types]"
echo "wokwi-types=[$wokwi_types]"
echo "qemu-types=[$qemu_types]"
echo "targets=[$targets]"
} >> "$GITHUB_OUTPUT"

View file

@ -1,58 +1,168 @@
#!/bin/bash
function run_test() {
function run_test {
local target=$1
local sketch=$2
local options=$3
local erase_flash=$4
local sketchdir=$(dirname $sketch)
local sketchname=$(basename $sketchdir)
local sketchdir
local sketchname
local result=0
local error=0
local sdkconfig_path
local extra_args
local test_type
if [ $options -eq 0 ] && [ -f $sketchdir/cfg.json ]; then
len=`jq -r --arg chip $target '.targets[] | select(.name==$chip) | .fqbn | length' $sketchdir/cfg.json`
sketchdir=$(dirname "$sketch")
sketchname=$(basename "$sketchdir")
test_type=$(basename "$(dirname "$sketchdir")")
if [ "$options" -eq 0 ] && [ -f "$sketchdir"/ci.json ]; then
len=$(jq -r --arg target "$target" '.fqbn[$target] | length' "$sketchdir"/ci.json)
if [ "$len" -eq 0 ]; then
len=1
fi
else
len=1
fi
if [ $len -eq 1 ]; then
# build_dir="tests/$sketchname/build"
build_dir="$HOME/.arduino/tests/$sketchname/build.tmp"
report_file="tests/$sketchname/$sketchname.xml"
if [ "$len" -eq 1 ]; then
sdkconfig_path="$HOME/.arduino/tests/$target/$sketchname/build.tmp/sdkconfig"
else
sdkconfig_path="$HOME/.arduino/tests/$target/$sketchname/build0.tmp/sdkconfig"
fi
for i in `seq 0 $(($len - 1))`
do
echo "Running test: $sketchname -- Config: $i"
if [ $erase_flash -eq 1 ]; then
esptool.py -c $target erase_flash
if [ -f "$sketchdir"/ci.json ]; then
# If the target or platform is listed as false, skip the sketch. Otherwise, include it.
is_target=$(jq -r --arg target "$target" '.targets[$target]' "$sketchdir"/ci.json)
selected_platform=$(jq -r --arg platform "$platform" '.platforms[$platform]' "$sketchdir"/ci.json)
if [[ $is_target == "false" ]] || [[ $selected_platform == "false" ]]; then
printf "\033[93mSkipping %s test for %s, platform: %s\033[0m\n" "$sketchname" "$target" "$platform"
printf "\n\n\n"
return 0
fi
fi
if [ ! -f "$sdkconfig_path" ]; then
printf "\033[93mSketch %s build not found in %s\nMight be due to missing target requirements or build failure\033[0m\n" "$(dirname "$sdkconfig_path")" "$sketchname"
printf "\n\n\n"
return 0
fi
local compiled_target
compiled_target=$(grep -E "CONFIG_IDF_TARGET=" "$sdkconfig_path" | cut -d'"' -f2)
if [ "$compiled_target" != "$target" ]; then
printf "\033[91mError: Sketch %s compiled for %s, expected %s\033[0m\n" "$sketchname" "$compiled_target" "$target"
printf "\n\n\n"
return 1
fi
if [ "$len" -eq 1 ]; then
# build_dir="$sketchdir/build"
build_dir="$HOME/.arduino/tests/$target/$sketchname/build.tmp"
report_file="$sketchdir/$target/$sketchname.xml"
fi
for i in $(seq 0 $((len - 1))); do
fqbn="Default"
if [ "$len" -ne 1 ]; then
fqbn=$(jq -r --arg target "$target" --argjson i "$i" '.fqbn[$target] | sort | .[$i]' "$sketchdir"/ci.json)
elif [ -f "$sketchdir"/ci.json ]; then
has_fqbn=$(jq -r --arg target "$target" '.fqbn[$target]' "$sketchdir"/ci.json)
if [ "$has_fqbn" != "null" ]; then
fqbn=$(jq -r --arg target "$target" '.fqbn[$target] | .[0]' "$sketchdir"/ci.json)
fi
fi
if [ $len -ne 1 ]; then
# build_dir="tests/$sketchname/build$i"
build_dir="$HOME/.arduino/tests/$sketchname/build$i.tmp"
report_file="tests/$sketchname/$sketchname$i.xml"
printf "\033[95mRunning test: %s -- Config: %s\033[0m\n" "$sketchname" "$fqbn"
if [ "$erase_flash" -eq 1 ]; then
esptool.py -c "$target" erase_flash
fi
pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file
result=$?
if [ "$len" -ne 1 ]; then
# build_dir="$sketchdir/build$i"
build_dir="$HOME/.arduino/tests/$target/$sketchname/build$i.tmp"
report_file="$sketchdir/$target/$sketchname$i.xml"
fi
if [ $platform == "wokwi" ]; then
extra_args=("--target" "$target" "--embedded-services" "arduino,wokwi" "--wokwi-timeout=$wokwi_timeout")
if [[ -f "$sketchdir/scenario.yaml" ]]; then
extra_args+=("--wokwi-scenario" "$sketchdir/scenario.yaml")
fi
if [[ -f "$sketchdir/diagram.$target.json" ]]; then
extra_args+=("--wokwi-diagram" "$sketchdir/diagram.$target.json")
fi
elif [ $platform == "qemu" ]; then
PATH=$HOME/qemu/bin:$PATH
extra_args=("--embedded-services" "qemu" "--qemu-image-path" "$build_dir/$sketchname.ino.merged.bin")
if [ "$target" == "esp32" ] || [ "$target" == "esp32s3" ]; then
extra_args+=("--qemu-prog-path" "qemu-system-xtensa" "--qemu-cli-args=\"-machine $target -m 4M -nographic\"")
elif [ "$target" == "esp32c3" ]; then
extra_args+=("--qemu-prog-path" "qemu-system-riscv32" "--qemu-cli-args=\"-machine $target -icount 3 -nographic\"")
else
printf "\033[91mUnsupported QEMU target: %s\033[0m\n" "$target"
exit 1
fi
else
extra_args=("--embedded-services" "esp,arduino")
fi
rm "$sketchdir"/diagram.json 2>/dev/null || true
result=0
printf "\033[95mpytest \"%s/test_%s.py\" --build-dir \"%s\" --junit-xml=\"%s\" -o junit_suite_name=%s_%s_%s_%s%s %s\033[0m\n" "$sketchdir" "$sketchname" "$build_dir" "$report_file" "$test_type" "$platform" "$target" "$sketchname" "$i" "${extra_args[*]@Q}"
bash -c "set +e; pytest \"$sketchdir/test_$sketchname.py\" --build-dir \"$build_dir\" --junit-xml=\"$report_file\" -o junit_suite_name=${test_type}_${platform}_${target}_${sketchname}${i} ${extra_args[*]@Q}; exit \$?" || result=$?
printf "\n"
if [ $result -ne 0 ]; then
return $result
result=0
printf "\033[95mRetrying test: %s -- Config: %s\033[0m\n" "$sketchname" "$i"
printf "\033[95mpytest \"%s/test_%s.py\" --build-dir \"%s\" --junit-xml=\"%s\" -o junit_suite_name=%s_%s_%s_%s%s %s\033[0m\n" "$sketchdir" "$sketchname" "$build_dir" "$report_file" "$test_type" "$platform" "$target" "$sketchname" "$i" "${extra_args[*]@Q}"
bash -c "set +e; pytest \"$sketchdir/test_$sketchname.py\" --build-dir \"$build_dir\" --junit-xml=\"$report_file\" -o junit_suite_name=${test_type}_${platform}_${target}_${sketchname}${i} ${extra_args[*]@Q}; exit \$?" || result=$?
printf "\n"
if [ $result -ne 0 ]; then
printf "\033[91mFailed test: %s -- Config: %s\033[0m\n\n" "$sketchname" "$i"
error=$result
fi
fi
done
return $error
}
SCRIPTS_DIR="./.github/scripts"
COUNT_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh count"
platform="hardware"
wokwi_timeout=60000
chunk_run=0
options=0
erase=0
while [ ! -z "$1" ]; do
while [ -n "$1" ]; do
case $1 in
-c )
chunk_run=1
;;
-Q )
if [ ! -d "$QEMU_PATH" ]; then
echo "QEMU path $QEMU_PATH does not exist"
exit 1
fi
platform="qemu"
;;
-W )
shift
wokwi_timeout=$1
if [[ -z $WOKWI_CLI_TOKEN ]]; then
echo "Wokwi CLI token is not set"
exit 1
fi
platform="wokwi"
;;
-o )
options=1
;;
@ -79,72 +189,102 @@ while [ ! -z "$1" ]; do
echo "$USAGE"
exit 0
;;
-type )
shift
test_type=$1
;;
* )
break
;;
break
;;
esac
shift
done
source ${SCRIPTS_DIR}/install-arduino-ide.sh
if [ ! $platform == "qemu" ]; then
source "${SCRIPTS_DIR}/install-arduino-ide.sh"
fi
# If sketch is provided and test type is not, test type is inferred from the sketch path
if [[ $test_type == "all" ]] || [[ -z $test_type ]]; then
if [ -n "$sketch" ]; then
tmp_sketch_path=$(find tests -name "$sketch".ino)
test_type=$(basename "$(dirname "$(dirname "$tmp_sketch_path")")")
echo "Sketch $sketch test type: $test_type"
test_folder="$PWD/tests/$test_type"
else
test_folder="$PWD/tests"
fi
else
test_folder="$PWD/tests/$test_type"
fi
if [ $chunk_run -eq 0 ]; then
run_test $target $PWD/tests/$sketch/$sketch.ino $options $erase
if [ -z "$sketch" ]; then
echo "ERROR: Sketch name is required for single test run"
exit 1
fi
run_test "$target" "$test_folder"/"$sketch"/"$sketch".ino $options $erase
exit $?
else
if [ "$chunk_max" -le 0 ]; then
echo "ERROR: Chunks count must be positive number"
return 1
fi
if [ "$chunk_max" -le 0 ]; then
echo "ERROR: Chunks count must be positive number"
exit 1
fi
if [ "$chunk_index" -ge "$chunk_max" ] && [ "$chunk_max" -ge 2 ]; then
echo "ERROR: Chunk index must be less than chunks count"
return 1
fi
if [ "$chunk_index" -ge "$chunk_max" ] && [ "$chunk_max" -ge 2 ]; then
echo "ERROR: Chunk index must be less than chunks count"
exit 1
fi
set +e
${COUNT_SKETCHES} $PWD/tests $target
sketchcount=$?
set -e
sketches=$(cat sketches.txt)
rm -rf sketches.txt
set +e
# Ignore requirements as we don't have the libs. The requirements will be checked in the run_test function
${COUNT_SKETCHES} "$test_folder" "$target" "1"
sketchcount=$?
set -e
sketches=$(cat sketches.txt)
rm -rf sketches.txt
chunk_size=$(( $sketchcount / $chunk_max ))
all_chunks=$(( $chunk_max * $chunk_size ))
if [ "$all_chunks" -lt "$sketchcount" ]; then
chunk_size=$(( $chunk_size + 1 ))
fi
chunk_size=$(( sketchcount / chunk_max ))
all_chunks=$(( chunk_max * chunk_size ))
if [ "$all_chunks" -lt "$sketchcount" ]; then
chunk_size=$(( chunk_size + 1 ))
fi
start_index=0
end_index=0
if [ "$chunk_index" -ge "$chunk_max" ]; then
start_index=$chunk_index
end_index=$sketchcount
else
start_index=$(( $chunk_index * $chunk_size ))
if [ "$sketchcount" -le "$start_index" ]; then
echo "Skipping job"
return 0
fi
start_index=0
end_index=0
if [ "$chunk_index" -ge "$chunk_max" ]; then
start_index=$chunk_index
end_index=$sketchcount
else
start_index=$(( chunk_index * chunk_size ))
if [ "$sketchcount" -le "$start_index" ]; then
exit 0
fi
end_index=$(( $(( $chunk_index + 1 )) * $chunk_size ))
if [ "$end_index" -gt "$sketchcount" ]; then
end_index=$sketchcount
fi
fi
end_index=$(( $(( chunk_index + 1 )) * chunk_size ))
if [ "$end_index" -gt "$sketchcount" ]; then
end_index=$sketchcount
fi
fi
start_num=$(( $start_index + 1 ))
sketchnum=0
sketchnum=0
error=0
for sketch in $sketches; do
for sketch in $sketches; do
sketchnum=$(($sketchnum + 1))
if [ "$sketchnum" -le "$start_index" ] \
|| [ "$sketchnum" -gt "$end_index" ]; then
continue
fi
echo ""
echo "Sketch Index $(($sketchnum - 1))"
sketchnum=$((sketchnum + 1))
if [ "$sketchnum" -le "$start_index" ] \
|| [ "$sketchnum" -gt "$end_index" ]; then
continue
fi
run_test $target $sketch $options $erase
done
printf "\033[95mSketch Index %s\033[0m\n" "$((sketchnum - 1))"
exit_code=0
run_test "$target" "$sketch" $options $erase || exit_code=$?
if [ $exit_code -ne 0 ]; then
error=$exit_code
fi
done
exit $error
fi

View file

@ -1,20 +1,22 @@
#!/bin/bash
# Disable shellcheck warning about using 'cat' to read a file.
# shellcheck disable=SC2002
# For reference: add tools for all boards by replacing one line in each board
# "[board].upload.tool=esptool_py" to "[board].upload.tool=esptool_py\n[board].upload.tool.default=esptool_py\n[board].upload.tool.network=esp_ota"
#cat boards.txt | sed "s/\([a-zA-Z0-9_\-]*\)\.upload\.tool\=esptool_py/\1\.upload\.tool\=esptool_py\\n\1\.upload\.tool\.default\=esptool_py\\n\1\.upload\.tool\.network\=esp_ota/"
if [ ! $# -eq 3 ]; then
echo "Bad number of arguments: $#" >&2
echo "usage: $0 <major> <minor> <patch>" >&2
exit 1
echo "Bad number of arguments: $#" >&2
echo "usage: $0 <major> <minor> <patch>" >&2
exit 1
fi
re='^[0-9]+$'
if [[ ! $1 =~ $re ]] || [[ ! $2 =~ $re ]] || [[ ! $3 =~ $re ]] ; then
echo "error: Not a valid version: $1.$2.$3" >&2
echo "usage: $0 <major> <minor> <patch>" >&2
exit 1
echo "error: Not a valid version: $1.$2.$3" >&2
echo "usage: $0 <major> <minor> <patch>" >&2
exit 1
fi
ESP_ARDUINO_VERSION_MAJOR="$1"
@ -22,7 +24,15 @@ ESP_ARDUINO_VERSION_MINOR="$2"
ESP_ARDUINO_VERSION_PATCH="$3"
ESP_ARDUINO_VERSION="$ESP_ARDUINO_VERSION_MAJOR.$ESP_ARDUINO_VERSION_MINOR.$ESP_ARDUINO_VERSION_PATCH"
# Get ESP-IDF version from push.yml (this way we can ensure that the version is correct even if the local libs are not up to date)
ESP_IDF_VERSION=$(grep "idf_ver:" .github/workflows/push.yml | sed 's/.*release-v\([^"]*\).*/\1/')
if [ -z "$ESP_IDF_VERSION" ]; then
echo "Error: ESP-IDF version not found in push.yml" >&2
exit 1
fi
echo "New Arduino Version: $ESP_ARDUINO_VERSION"
echo "ESP-IDF Version: $ESP_IDF_VERSION"
echo "Updating platform.txt..."
cat platform.txt | sed "s/version=.*/version=$ESP_ARDUINO_VERSION/g" > __platform.txt && mv __platform.txt platform.txt
@ -30,10 +40,28 @@ cat platform.txt | sed "s/version=.*/version=$ESP_ARDUINO_VERSION/g" > __platfor
echo "Updating package.json..."
cat package.json | sed "s/.*\"version\":.*/ \"version\": \"$ESP_ARDUINO_VERSION\",/g" > __package.json && mv __package.json package.json
echo "Updating docs/conf_common.py..."
cat docs/conf_common.py | \
sed "s/.. |version| replace:: .*/.. |version| replace:: $ESP_ARDUINO_VERSION/g" | \
sed "s/.. |idf_version| replace:: .*/.. |idf_version| replace:: $ESP_IDF_VERSION/g" > docs/__conf_common.py && mv docs/__conf_common.py docs/conf_common.py
echo "Updating .gitlab/workflows/common.yml..."
cat .gitlab/workflows/common.yml | \
sed "s/ESP_IDF_VERSION:.*/ESP_IDF_VERSION: \"$ESP_IDF_VERSION\"/g" | \
sed "s/ESP_ARDUINO_VERSION:.*/ESP_ARDUINO_VERSION: \"$ESP_ARDUINO_VERSION\"/g" > .gitlab/workflows/__common.yml && mv .gitlab/workflows/__common.yml .gitlab/workflows/common.yml
echo "Updating cores/esp32/esp_arduino_version.h..."
cat cores/esp32/esp_arduino_version.h | \
sed "s/#define ESP_ARDUINO_VERSION_MAJOR.*/#define ESP_ARDUINO_VERSION_MAJOR $ESP_ARDUINO_VERSION_MAJOR/g" | \
sed "s/#define ESP_ARDUINO_VERSION_MINOR.*/#define ESP_ARDUINO_VERSION_MINOR $ESP_ARDUINO_VERSION_MINOR/g" | \
sed "s/#define ESP_ARDUINO_VERSION_PATCH.*/#define ESP_ARDUINO_VERSION_PATCH $ESP_ARDUINO_VERSION_PATCH/g" > __esp_arduino_version.h && mv __esp_arduino_version.h cores/esp32/esp_arduino_version.h
sed "s/#define ESP_ARDUINO_VERSION_MAJOR.*/#define ESP_ARDUINO_VERSION_MAJOR $ESP_ARDUINO_VERSION_MAJOR/g" | \
sed "s/#define ESP_ARDUINO_VERSION_MINOR.*/#define ESP_ARDUINO_VERSION_MINOR $ESP_ARDUINO_VERSION_MINOR/g" | \
sed "s/#define ESP_ARDUINO_VERSION_PATCH.*/#define ESP_ARDUINO_VERSION_PATCH $ESP_ARDUINO_VERSION_PATCH/g" > __esp_arduino_version.h && mv __esp_arduino_version.h cores/esp32/esp_arduino_version.h
libraries=$(find libraries -maxdepth 1 -mindepth 1 -type d -exec basename {} \;)
for lib in $libraries; do
if [ -f "libraries/$lib/library.properties" ]; then
echo "Updating Library $lib..."
cat "libraries/$lib/library.properties" | sed "s/version=.*/version=$ESP_ARDUINO_VERSION/g" > "libraries/$lib/__library.properties" && mv "libraries/$lib/__library.properties" "libraries/$lib/library.properties"
fi
done
exit 0

236
.github/scripts/update_esptool.py vendored Normal file
View file

@ -0,0 +1,236 @@
#!/usr/bin/env python3
# This script is used to re-package the esptool if needed and update the JSON file
# for the Arduino ESP32 platform.
#
# The script has only been tested on macOS.
#
# For regular esptool releases, the generated packages already contain the correct permissions,
# extensions and are uploaded to the GitHub release assets. In this case, the script will only
# update the JSON file with the information from the GitHub release.
#
# The script can be used in two modes:
# 1. Local build: The build artifacts must be already downloaded and extracted in the base_folder.
# This is useful for esptool versions that are not yet released and that are grabbed from the
# GitHub build artifacts.
# 2. Release build: The script will get the release information from GitHub and update the JSON file.
# This is useful for esptool versions that are already released and that are uploaded to the
# GitHub release assets.
#
# For local build, the artifacts must be already downloaded and extracted in the base_folder
# set with the -l option.
# For example, a base folder "esptool" should contain the following folders extracted directly
# from the GitHub build artifacts:
# esptool/esptool-linux-aarch64
# esptool/esptool-linux-amd64
# esptool/esptool-linux-armv7
# esptool/esptool-macos-amd64
# esptool/esptool-macos-arm64
# esptool/esptool-windows-amd64
import argparse
import json
import os
import shutil
import stat
import tarfile
import zipfile
import hashlib
import requests
from pathlib import Path
def compute_sha256(filepath):
sha256 = hashlib.sha256()
with open(filepath, "rb") as f:
for block in iter(lambda: f.read(4096), b""):
sha256.update(block)
return f"SHA-256:{sha256.hexdigest()}"
def get_file_size(filepath):
return os.path.getsize(filepath)
def update_json_for_host(tmp_json_path, version, host, url, archiveFileName, checksum, size):
with open(tmp_json_path) as f:
data = json.load(f)
for pkg in data.get("packages", []):
for tool in pkg.get("tools", []):
if tool.get("name") == "esptool_py":
tool["version"] = version
if url is None:
# If the URL is not set, we need to find the old URL and update it
for system in tool.get("systems", []):
if system.get("host") == host:
url = system.get("url").replace(system.get("archiveFileName"), archiveFileName)
break
else:
print(f"No old URL found for host {host}. Using empty URL.")
url = ""
# Preserve existing systems order and update or append the new system
systems = tool.get("systems", [])
system_updated = False
for i, system in enumerate(systems):
if system.get("host") == host:
systems[i] = {
"host": host,
"url": url,
"archiveFileName": archiveFileName,
"checksum": checksum,
"size": str(size),
}
system_updated = True
break
if not system_updated:
systems.append({
"host": host,
"url": url,
"archiveFileName": archiveFileName,
"checksum": checksum,
"size": str(size),
})
tool["systems"] = systems
with open(tmp_json_path, "w") as f:
json.dump(data, f, indent=2, sort_keys=False, ensure_ascii=False)
f.write("\n")
def update_tools_dependencies(tmp_json_path, version):
with open(tmp_json_path) as f:
data = json.load(f)
for pkg in data.get("packages", []):
for platform in pkg.get("platforms", []):
for dep in platform.get("toolsDependencies", []):
if dep.get("name") == "esptool_py":
dep["version"] = version
with open(tmp_json_path, "w") as f:
json.dump(data, f, indent=2, sort_keys=False, ensure_ascii=False)
f.write("\n")
def create_archives(version, base_folder):
archive_files = []
for dirpath in Path(base_folder).glob("esptool-*"):
if not dirpath.is_dir():
continue
base = dirpath.name[len("esptool-"):]
if "windows" in dirpath.name:
zipfile_name = f"esptool-v{version}-{base}.zip"
print(f"Creating {zipfile_name} from {dirpath} ...")
with zipfile.ZipFile(zipfile_name, "w", zipfile.ZIP_DEFLATED) as zipf:
for root, _, files in os.walk(dirpath):
for file in files:
full_path = os.path.join(root, file)
zipf.write(full_path, os.path.relpath(full_path, start=dirpath))
archive_files.append(zipfile_name)
else:
tarfile_name = f"esptool-v{version}-{base}.tar.gz"
print(f"Creating {tarfile_name} from {dirpath} ...")
for root, dirs, files in os.walk(dirpath):
for name in dirs + files:
os.chmod(os.path.join(root, name), stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |
stat.S_IRGRP | stat.S_IXGRP |
stat.S_IROTH | stat.S_IXOTH)
with tarfile.open(tarfile_name, "w:gz") as tar:
tar.add(dirpath, arcname=dirpath.name)
archive_files.append(tarfile_name)
return archive_files
def determine_hosts(archive_name):
if "linux-amd64" in archive_name:
return ["x86_64-pc-linux-gnu"]
elif "linux-armv7" in archive_name:
return ["arm-linux-gnueabihf"]
elif "linux-aarch64" in archive_name:
return ["aarch64-linux-gnu"]
elif "macos-amd64" in archive_name:
return ["x86_64-apple-darwin"]
elif "macos-arm64" in archive_name:
return ["arm64-apple-darwin"]
elif "windows-amd64" in archive_name:
return ["x86_64-mingw32", "i686-mingw32"]
else:
return []
def update_json_from_local_build(tmp_json_path, version, base_folder, archive_files):
for archive in archive_files:
print(f"Processing archive: {archive}")
hosts = determine_hosts(archive)
if not hosts:
print(f"Skipping unknown archive type: {archive}")
continue
archive_path = Path(archive)
checksum = compute_sha256(archive_path)
size = get_file_size(archive_path)
for host in hosts:
update_json_for_host(tmp_json_path, version, host, None, archive_path.name, checksum, size)
def update_json_from_release(tmp_json_path, version, release_info):
assets = release_info.get("assets", [])
for asset in assets:
if (asset.get("name").endswith(".tar.gz") or asset.get("name").endswith(".zip")) and "esptool" in asset.get("name"):
asset_fname = asset.get("name")
print(f"Processing asset: {asset_fname}")
hosts = determine_hosts(asset_fname)
if not hosts:
print(f"Skipping unknown archive type: {asset_fname}")
continue
asset_url = asset.get("browser_download_url")
asset_checksum = asset.get("digest").replace("sha256:", "SHA-256:")
asset_size = asset.get("size")
if asset_checksum is None:
asset_checksum = ""
print(f"Asset {asset_fname} has no checksum. Please set the checksum in the JSON file.")
for host in hosts:
update_json_for_host(tmp_json_path, version, host, asset_url, asset_fname, asset_checksum, asset_size)
def get_release_info(version):
url = f"https://api.github.com/repos/espressif/esptool/releases/tags/v{version}"
response = requests.get(url)
response.raise_for_status()
return response.json()
def main():
parser = argparse.ArgumentParser(description="Repack esptool and update JSON metadata.")
parser.add_argument("version", help="Version of the esptool (e.g. 5.0.dev1)")
parser.add_argument("-l", "--local", dest="base_folder", help="Enable local build mode and set the base folder with unpacked artifacts")
args = parser.parse_args()
script_dir = Path(__file__).resolve().parent
json_path = (script_dir / "../../package/package_esp32_index.template.json").resolve()
tmp_json_path = Path(str(json_path) + ".tmp")
shutil.copy(json_path, tmp_json_path)
local_build = args.base_folder is not None
if local_build:
os.chdir(args.base_folder)
os.environ['COPYFILE_DISABLE'] = 'true' # this disables including resource forks in tar files on macOS
# Clear any existing archive files
for file in Path(args.base_folder).glob("esptool-*.*"):
file.unlink()
archive_files = create_archives(args.version, args.base_folder)
update_json_from_local_build(tmp_json_path, args.version, args.base_folder, archive_files)
else:
release_info = get_release_info(args.version)
update_json_from_release(tmp_json_path, args.version, release_info)
print(f"Updating esptool version fields to {args.version}")
update_tools_dependencies(tmp_json_path, args.version)
shutil.move(tmp_json_path, json_path)
print(f"Done. JSON updated at {json_path}")
if __name__ == "__main__":
main()

View file

@ -1,11 +1,12 @@
#!/bin/bash
CHANGED_FILES=$1
echo "Pushing '$CHANGED_FILES' as $GITHUB_ACTOR"
git config --global github.user "$GITHUB_ACTOR"
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
echo "Pushing '$CHANGED_FILES' as github-actions[bot]"
git config --global github.user "github-actions[bot]"
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
for tool in $CHANGED_FILES; do
git add tools/$tool.exe
git add tools/"$tool".exe
done
git commit -m "Push binary to tools"
git commit -m "change(tools): Push generated binaries to PR"
git push

View file

@ -1,6 +1,6 @@
name: Boards Test - Remote trigger
# The workflow will run on remote dispath with event-type set to "test-boards"
# The workflow will run on remote dispatch with event-type set to "test-boards"
on:
repository_dispatch:
types: [test-boards]
@ -15,13 +15,12 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.client_payload.branch }}
- name: Get boards fqbns
run:
bash .github/scripts/find_all_boards.sh
run: bash .github/scripts/find_all_boards.sh
setup-chunks:
needs: find-boards
@ -33,18 +32,17 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.client_payload.branch }}
- run: npm install
- name: Setup jq
uses: dcarbone/install-jq-action@v1.0.1
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
- id: set-test-chunks
name: Set Chunks
run:
echo "test-chunks<<EOF" >> $GITHUB_OUTPUT
run: echo "test-chunks<<EOF" >> $GITHUB_OUTPUT
echo "$( jq -nc '${{ needs.find-boards.outputs.fqbns }} | [_nwise( ${{ needs.find-boards.outputs.board-count }}/15 | ceil)]')" >> $GITHUB_OUTPUT
@ -61,23 +59,22 @@ jobs:
strategy:
fail-fast: false
matrix:
matrix:
chunk: ${{ fromJSON(needs.setup-chunks.outputs['test-chunks']) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.client_payload.branch }}
- name: Echo FQBNS to file
run:
echo "$FQBN" > fqbns.json
env:
run: echo "$FQBN" > fqbns.json
env:
FQBN: ${{ toJSON(matrix.chunk) }}
- name: Compile sketch
uses: P-R-O-C-H-Y/compile-sketches@main
uses: P-R-O-C-H-Y/compile-sketches@a62f069b92dc8f5053da4ac439ea6d1950cf6379 # main
with:
platforms: |
${{ env.REPOSITORY }}
@ -88,5 +85,4 @@ jobs:
enable-warnings-report: false
cli-compile-flags: |
- --warnings="all"
sketch-paths:
"- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"
sketch-paths: "- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"

View file

@ -3,6 +3,10 @@ name: Boards Test
# The workflow will run on schedule and labeled pull requests
on:
pull_request:
paths:
- "boards.txt"
- "libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"
- ".github/workflows/boards.yml"
env:
# It's convenient to set variables for values used multiple times in the workflow
@ -18,14 +22,13 @@ jobs:
steps:
# This step makes the contents of the repository available to the workflow
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup jq
uses: dcarbone/install-jq-action@v1.0.1
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
- name: Get board name
run:
bash .github/scripts/find_new_boards.sh ${{ github.repository }} ${{github.event.number}}
run: bash .github/scripts/find_new_boards.sh ${{ github.repository }} ${{github.base_ref}}
test-boards:
needs: find-boards
@ -38,12 +41,13 @@ jobs:
name: "espressif:esp32"
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.find-boards.outputs.fqbns) }}
steps:
# This step makes the contents of the repository available to the workflow
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Check if build.board is uppercase
run: |
@ -55,8 +59,21 @@ jobs:
exit 1;
fi
- name: Get libs cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
key: libs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package/package_esp32_index.template.json', 'tools/get.py') }}
path: |
./tools/dist
./tools/esp32-arduino-libs
./tools/esptool
./tools/mk*
./tools/openocd-esp32
./tools/riscv32-*
./tools/xtensa-*
- name: Compile sketch
uses: P-R-O-C-H-Y/compile-sketches@main
uses: P-R-O-C-H-Y/compile-sketches@a62f069b92dc8f5053da4ac439ea6d1950cf6379 # main
with:
platforms: |
${{ env.REPOSITORY }}
@ -67,5 +84,5 @@ jobs:
cli-compile-flags: |
- --warnings="all"
exit-on-fail: true
sketch-paths:
"- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"
sketch-paths: "- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"
verbose: true

View file

@ -3,35 +3,44 @@ name: Build Python Tools
on:
pull_request:
paths:
- 'tools/get.py'
- 'tools/espota.py'
- 'tools/gen_esp32part.py'
- 'tools/gen_insights_package.py'
- ".github/workflows/build_py_tools.yml"
- "tools/get.py"
- "tools/espota.py"
- "tools/gen_esp32part.py"
- "tools/gen_insights_package.py"
jobs:
find-changed-tools:
name: Check if tools have been changed
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.verify-changed-files.outputs.any_changed }}
all_changed_files: ${{ steps.verify-changed-files.outputs.all_changed_files }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 2
ref: ${{ github.event.pull_request.head.ref }}
- name: Check if checkout failed
if: failure()
run: |
echo "Checkout failed."
echo "Make sure you are using a branch inside the repository and not a fork."
- name: Verify Python Tools Changed
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1
id: verify-changed-files
with:
fetch_depth: '2'
since_last_remote_commit: 'true'
fetch_depth: "2"
since_last_remote_commit: "true"
files: |
tools/get.py
tools/espota.py
tools/gen_esp32part.py
tools/gen_insights_package.py
- name: List all changed files
shell: bash
run: |
@ -47,27 +56,21 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-20.04, ARM, ARM64]
os: [windows-latest, macos-latest, ubuntu-latest, ubuntu-24.04-arm]
include:
- os: windows-latest
TARGET: win64
EXTEN: .exe
SEPARATOR: ';'
- os: macos-latest
TARGET: macos
SEPARATOR: ':'
- os: ubuntu-20.04
TARGET: linux-amd64
SEPARATOR: ':'
- os: ARM
CONTAINER: python:3.8-bullseye
TARGET: arm
SEPARATOR: ':'
- os: ARM64
CONTAINER: python:3.8-bullseye
TARGET: arm64
SEPARATOR: ':'
container: ${{ matrix.CONTAINER }} # use python container on ARM
- os: windows-latest
TARGET: win64
EXTEN: .exe
SEPARATOR: ";"
- os: macos-latest
TARGET: macos
SEPARATOR: ":"
- os: ubuntu-latest
TARGET: linux-amd64
SEPARATOR: ":"
- os: ubuntu-24.04-arm
TARGET: arm
SEPARATOR: ":"
env:
DISTPATH: pytools-${{ matrix.TARGET }}
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi"
@ -86,26 +89,30 @@ jobs:
for tool in ${{ env.CHANGED_TOOLS }}; do
echo "tool $tool was changed"
done
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ secrets.TOOLS_UPLOAD_PAT }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Python 3.8
# Skip setting python on ARM because of missing compatibility: https://github.com/actions/setup-python/issues/108
if: matrix.os != 'ARM' && matrix.os != 'ARM64'
uses: actions/setup-python@master
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller requests
- name: Build with PyInstaller
shell: bash
run: |
for tool in ${{ env.CHANGED_TOOLS }}; do
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=.github/pytools/espressif.ico tools/$tool.py
done
- name: Sign binaries
if: matrix.os == 'windows-latest'
env:
@ -118,12 +125,14 @@ jobs:
{
./.github/pytools/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/$node.exe
}
- name: Test binaries
shell: bash
run: |
for tool in ${{ env.CHANGED_TOOLS }}; do
./${{ env.DISTPATH }}/$tool${{ matrix.EXTEN }} -h
done
- name: Push binary to tools
if: matrix.os == 'windows-latest'
env:
@ -134,8 +143,9 @@ jobs:
cp -f ./${{ env.DISTPATH }}/$tool.exe tools/$tool.exe
done
bash .github/scripts/upload_py_tools.sh "${{ env.CHANGED_TOOLS }}"
- name: Archive artifact
uses: actions/upload-artifact@master
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ env.DISTPATH }}
path: ${{ env.DISTPATH }}

31
.github/workflows/codeql_actions.yml vendored Normal file
View file

@ -0,0 +1,31 @@
name: CodeQL Actions Analysis
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
paths:
- ".github/workflows/*.yml"
- ".github/workflows/*.yaml"
jobs:
codeql-analysis:
name: CodeQL Actions Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Initialize CodeQL
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
with:
languages: actions
config-file: ./.github/codeql/codeql-config.yml
- name: Run CodeQL Analysis
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
with:
category: "Analysis: Actions"

30
.github/workflows/codeql_python.yml vendored Normal file
View file

@ -0,0 +1,30 @@
name: CodeQL Python Analysis
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
paths:
- "**/*.py"
jobs:
codeql-analysis:
name: CodeQL Python Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Initialize CodeQL
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
with:
languages: python
config-file: ./.github/codeql/codeql-config.yml
- name: Run CodeQL Analysis
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
with:
category: "Analysis: Python"

View file

@ -11,12 +11,18 @@ jobs:
pull-request-style-linter:
runs-on: ubuntu-latest
steps:
- name: Check out PR head
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check out PR head
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: DangerJS pull request linter
uses: espressif/shared-github-dangerjs@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: DangerJS pull request linter
uses: espressif/shared-github-dangerjs@fb17367fd3e8ff7412603b8e946d9b19ffdb2d7f # v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
instructions-cla-link: "https://cla-assistant.io/espressif/arduino-esp32"
instructions-contributions-file: "docs/en/contributing.rst"
rule-max-commits: "false"
rule-target-branch: "false"
commit-messages-min-summary-length: "10"

View file

@ -3,18 +3,17 @@ name: Documentation Build and Deploy CI
on:
push:
branches:
- master
- release/*
- master
- release/v2.x
paths:
- 'docs/**'
- '.github/workflows/docs_build.yml'
- "docs/**"
- ".github/workflows/docs_build.yml"
pull_request:
paths:
- 'docs/**'
- '.github/workflows/docs_build.yml'
- "docs/**"
- ".github/workflows/docs_build.yml"
jobs:
build-docs:
name: Build ESP-Docs
runs-on: ubuntu-22.04
@ -22,23 +21,28 @@ jobs:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build
run: |
sudo apt update
sudo apt install python3-pip python3-setuptools
# GitHub CI installs pip3 and setuptools outside the path.
# Update the path to include them and run.
cd ./docs
PATH=/home/runner/.local/bin:$PATH pip3 install -r requirements.txt --prefer-binary
PATH=/home/runner/.local/bin:$PATH SPHINXOPTS="-W" build-docs -l en
- name: Archive Docs
uses: actions/upload-artifact@v2
with:
name: docs
path: docs
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4
with:
cache-dependency-path: docs/requirements.txt
cache: "pip"
python-version: "3.10"
- name: Build
run: |
sudo apt update
sudo apt install python3-pip python3-setuptools
# GitHub CI installs pip3 and setuptools outside the path.
# Update the path to include them and run.
cd ./docs
PATH=/home/runner/.local/bin:$PATH pip3 install -r requirements.txt --prefer-binary
PATH=/home/runner/.local/bin:$PATH SPHINXOPTS="-W" build-docs -l en
- name: Archive Docs
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: docs
path: docs

View file

@ -1,18 +1,19 @@
name: Documentation Build and Production Deploy CI
on:
release:
types: [published]
workflow_run:
workflows: ["ESP32 Arduino Release"]
types:
- completed
push:
branches:
- release/*
- master
- release/v2.x
- master
paths:
- 'docs/**'
- '.github/workflows/docs_deploy.yml'
- "docs/**"
- ".github/workflows/docs_deploy.yml"
jobs:
deploy-prod-docs:
name: Deploy Documentation on Production
runs-on: ubuntu-22.04
@ -20,32 +21,42 @@ jobs:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Deploy Documentation
env:
# Deploy to production server
# DOCS_BUILD_DIR: "./docs/_build/"
DOCS_DEPLOY_PRIVATEKEY: ${{ secrets.DOCS_KEY }}
DOCS_DEPLOY_PATH: ${{ secrets.DOCS_PATH }}
DOCS_DEPLOY_SERVER: ${{ secrets.DOCS_SERVER }}
DOCS_DEPLOY_SERVER_USER: ${{ secrets.DOCS_USER }}
DOCS_DEPLOY_URL_BASE: ${{ secrets.DOCS_URL }}
run: |
sudo apt update
sudo apt install python3-pip python3-setuptools
source ./docs/utils.sh
add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER
export GIT_VER=$(git describe --always)
echo "PIP install requirements..."
pip3 install --user -r ./docs/requirements.txt
echo "Building the Docs..."
cd ./docs && build-docs -l en
echo "Deploy the Docs..."
export DOCS_BUILD_DIR=$GITHUB_WORKSPACE/docs/
cd $GITHUB_WORKSPACE/docs
deploy-docs
- name: Check if release workflow is successful
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion != 'success' }}
run: |
echo "Release workflow failed. Exiting..."
exit 1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4
with:
cache-dependency-path: docs/requirements.txt
cache: "pip"
python-version: "3.10"
- name: Deploy Documentation
env:
# Deploy to production server
# DOCS_BUILD_DIR: "./docs/_build/"
DOCS_DEPLOY_PRIVATEKEY: ${{ secrets.DOCS_KEY }}
DOCS_DEPLOY_PATH: ${{ secrets.DOCS_PATH }}
DOCS_DEPLOY_SERVER: ${{ secrets.DOCS_SERVER }}
DOCS_DEPLOY_SERVER_USER: ${{ secrets.DOCS_USER }}
DOCS_DEPLOY_URL_BASE: ${{ secrets.DOCS_URL }}
run: |
sudo apt update
sudo apt install python3-pip python3-setuptools
source ./docs/utils.sh
add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER
export GIT_VER=$(git describe --always)
echo "PIP install requirements..."
pip3 install --user -r ./docs/requirements.txt
echo "Building the Docs..."
cd ./docs && build-docs -l en
echo "Deploy the Docs..."
export DOCS_BUILD_DIR=$GITHUB_WORKSPACE/docs/
cd $GITHUB_WORKSPACE/docs
deploy-docs

View file

@ -3,21 +3,22 @@ name: GitHub Pages CI
on:
push:
branches:
- master
- pages
- master
- pages
paths:
- 'README.md'
- '.github/scripts/on-pages.sh'
- '.github/workflows/gh-pages.yml'
- "README.md"
- ".github/scripts/on-pages.sh"
- ".github/workflows/gh-pages.yml"
jobs:
build-pages:
name: Build GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Copy Files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash ./.github/scripts/on-pages.sh
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Copy Files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash ./.github/scripts/on-pages.sh

View file

@ -1,118 +0,0 @@
name: Run tests in hardware
on:
pull_request:
types: [opened, reopened, synchronize, labeled]
schedule:
- cron: '0 2 * * *'
env:
MAX_CHUNKS: 15
concurrency:
group: hil-${{github.event.pull_request.number || github.ref}}
cancel-in-progress: true
jobs:
gen_chunks:
if: |
contains(github.event.pull_request.labels.*.name, 'hil_test') ||
(github.event_name == 'schedule' && github.repository == 'espressif/arduino-esp32')
name: Generate Chunks matrix
runs-on: ubuntu-latest
outputs:
chunks: ${{ steps.gen-chunks.outputs.chunks }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Generate Chunks matrix
id: gen-chunks
run: |
set +e
.github/scripts/sketch_utils.sh count tests
sketches=$?
if [[ $sketches -ge ${{env.MAX_CHUNKS}} ]]; then
$sketches=${{env.MAX_CHUNKS}}
fi
set -e
rm sketches.txt
CHUNKS=$(jq -c -n '$ARGS.positional' --args `seq 0 1 $((sketches - 1))`)
echo "chunks=${CHUNKS}" >>$GITHUB_OUTPUT
Build:
needs: gen_chunks
name: ${{matrix.chip}}-Build#${{matrix.chunks}}
runs-on: ubuntu-latest
strategy:
matrix:
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
chunks: ${{fromJson(needs.gen_chunks.outputs.chunks)}}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Build sketches
run: |
bash .github/scripts/tests_build.sh -c -t ${{matrix.chip}} -i ${{matrix.chunks}} -m ${{env.MAX_CHUNKS}}
- name: Upload ${{matrix.chip}}-${{matrix.chunks}} artifacts
uses: actions/upload-artifact@v3
with:
name: ${{matrix.chip}}-${{matrix.chunks}}.artifacts
path: |
~/.arduino/tests/*/build*.tmp/*.bin
~/.arduino/tests/*/build*.tmp/*.json
if-no-files-found: error
Test:
needs: [gen_chunks, Build]
name: ${{matrix.chip}}-Test#${{matrix.chunks}}
strategy:
fail-fast: false
matrix:
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
chunks: ${{fromJson(needs.gen_chunks.outputs.chunks)}}
runs-on: [arduino, "${{matrix.chip}}"]
container:
image: python:3.10.1-bullseye
options: --privileged
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download ${{matrix.chip}}-${{matrix.chunks}} artifacts
uses: actions/download-artifact@v3
with:
name: ${{matrix.chip}}-${{matrix.chunks}}.artifacts
path: ~/.arduino/tests/
- name: Install dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
apt update && apt install -y -qq jq
- name: Run Tests
run: |
bash .github/scripts/tests_run.sh -c -t ${{matrix.chip}} -i ${{matrix.chunks}} -m ${{env.MAX_CHUNKS}} -e
- name: Upload test result artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: test_results-${{matrix.chip}}-${{matrix.chunks}}
path: tests/*/*.xml
event_file:
name: "Event File"
if: |
contains(github.event.pull_request.labels.*.name, 'hil_test') ||
github.event_name == 'schedule'
needs: Test
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{github.event_path}}

View file

@ -9,7 +9,8 @@
{
"name": "ArduinoBLE",
"exclude_targets": [
"esp32s2"
"esp32s2",
"esp32p4"
],
"sketch_path": [
"~/Arduino/libraries/ArduinoBLE/examples/Central/Scan/Scan.ino"
@ -23,16 +24,52 @@
]
},
{
"source-url": "https://github.com/me-no-dev/ESPAsyncWebServer.git",
"source-url": "https://github.com/ESP32Async/ESPAsyncWebServer.git",
"required-libs": [
{"source-url": "https://github.com/me-no-dev/AsyncTCP.git"}
{"source-url": "https://github.com/ESP32Async/AsyncTCP.git"}
],
"exclude_targets": [],
"sketch_path": [
"~/Arduino/libraries/ESPAsyncWebServer/examples/Auth/Auth.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/CORS/CORS.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/CaptivePortal/CaptivePortal.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/ESP_AsyncFSBrowser/ESP_AsyncFSBrowser.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/regex_patterns/regex_patterns.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/simple_server/simple_server.ino"
"~/Arduino/libraries/ESPAsyncWebServer/examples/CatchAllHandler/CatchAllHandler.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/ChunkResponse/ChunkResponse.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/ChunkRetryResponse/ChunkRetryResponse.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/EndBegin/EndBegin.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/Filters/Filters.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/FlashResponse/FlashResponse.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/HeaderManipulation/HeaderManipulation.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/Headers/Headers.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/Json/Json.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/Logging/Logging.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/MessagePack/MessagePack.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/Middleware/Middleware.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/Params/Params.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/PartitionDownloader/PartitionDownloader.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/PerfTests/PerfTests.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/RateLimit/RateLimit.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/Redirect/Redirect.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/RequestContinuation/RequestContinuation.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/RequestContinuationComplete/RequestContinuationComplete.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/ResumableDownload/ResumableDownload.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/Rewrite/Rewrite.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/ServerSentEvents/ServerSentEvents.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/ServerState/ServerState.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/SkipServerMiddleware/SkipServerMiddleware.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/SlowChunkResponse/SlowChunkResponse.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/StaticFile/StaticFile.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/Templates/Templates.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/Upload/Upload.ino",
"~/Arduino/libraries/ESPAsyncWebServer/examples/WebSocket/WebSocket.ino"
]
},
{
"name": "EthernetESP32",
"exclude_targets": [],
"sketch_path": [
"~/Arduino/libraries/EthernetESP32/examples/LegacyEthernetTest/LegacyEthernetTest.ino",
"~/Arduino/libraries/EthernetESP32/examples/TwoEthernets/TwoEthernets.ino"
]
},
{
@ -62,5 +99,13 @@
"sketch_path": [
"~/Arduino/libraries/WS2812FX/examples/ws2812fx_spi/ws2812fx_spi.ino"
]
},
{
"name": "ZACwire for TSic",
"exclude_targets": [],
"sketch_path": [
"~/Arduino/libraries/ZACwire_for_TSic/examples/ReadingTwoTSICs/ReadingTwoTSICs.ino",
"~/Arduino/libraries/ZACwire_for_TSic/examples/ReadSingleTSIC206/ReadSingleTSIC206.ino"
]
}
]
]

View file

@ -7,7 +7,11 @@ on:
# Schedule weekly builds on every Sunday at 4 am
schedule:
- cron: '0 4 * * SUN'
- cron: "0 4 * * SUN"
concurrency:
group: libs-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
# It's convenient to set variables for values used multiple times in the workflow
@ -23,7 +27,6 @@ jobs:
contains(github.event.pull_request.labels.*.name, 'lib_test') ||
(github.event_name == 'schedule' && github.repository == 'espressif/arduino-esp32')
runs-on: ubuntu-latest
env:
REPOSITORY: |
- source-path: '.'
@ -38,6 +41,7 @@ jobs:
- esp32s3
- esp32c6
- esp32h2
- esp32p4
include:
- target: esp32
@ -52,15 +56,16 @@ jobs:
fqbn: espressif:esp32:esp32c6
- target: esp32h2
fqbn: espressif:esp32:esp32h2
- target: esp32p4
fqbn: espressif:esp32:esp32p4
steps:
# This step makes the contents of the repository available to the workflow
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Compile sketch
uses: P-R-O-C-H-Y/compile-sketches@main
uses: P-R-O-C-H-Y/compile-sketches@a62f069b92dc8f5053da4ac439ea6d1950cf6379 # main
with:
platforms: |
${{ env.REPOSITORY }}
@ -75,61 +80,66 @@ jobs:
- --warnings="all"
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}-${{ matrix.target }}
path: ${{ env.SKETCHES_REPORTS_PATH }}
report-to-file:
needs: compile-sketch # Wait for the compile job to finish to get the data for the report
needs: compile-sketch # Wait for the compile job to finish to get the data for the report
if: github.event_name == 'schedule' # Only run the job when the workflow is triggered by a schedule
runs-on: ubuntu-latest
steps:
# Check out repository
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ env.GITHUB_TOKEN }}
fetch-depth: '0'
fetch-depth: "0"
- name: Switch branch
run:
git checkout remotes/origin/gh-pages
run: git checkout remotes/origin/gh-pages
# This step is needed to get the size data produced by the compile jobs
- name: Download sketches reports artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with:
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
pattern: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}-*
merge-multiple: true
path: ${{ env.SKETCHES_REPORTS_PATH }}
- name: Report results
uses: P-R-O-C-H-Y/report-size-deltas@main
uses: P-R-O-C-H-Y/report-size-deltas@4a79caa6dcc3579024293638b97156106edc588e # main
with:
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
destination-file: ${{ env.RESULT_LIBRARY_TEST_FILE }}
- name: Append file with action URL
run:
echo "/ [GitHub Action Link](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})" >> ${{ env.RESULT_LIBRARY_TEST_FILE }}
run: echo "/ [GitHub Action Link](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})" >> ${{ env.RESULT_LIBRARY_TEST_FILE }}
- name: Push to github repo
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add ${{ env.RESULT_LIBRARY_TEST_FILE }}
git commit -m "Generated External Libraries Test Results"
git push origin HEAD:gh-pages
event_file:
name: "Event File"
if: |
contains(github.event.pull_request.labels.*.name, 'lib_test')
needs: compile-sketch
#Upload PR number as artifact
upload-pr-number:
name: Upload PR number
if: (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'lib_test'))
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v2
with:
name: Event File
path: ${{github.event_path}}
- name: Save the PR number in an artifact
shell: bash
env:
PR_NUM: ${{ github.event.number }}
run: echo $PR_NUM > pr_num.txt
- name: Upload PR number
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: pr_number
path: ./pr_num.txt
overwrite: true

64
.github/workflows/pre-commit-status.yml vendored Normal file
View file

@ -0,0 +1,64 @@
# This needs to be in a separate workflow because it requires higher permissions than the calling workflow
name: Report Pre-commit Check Status
on:
workflow_run:
workflows: [Pre-commit hooks]
types:
- completed
permissions:
statuses: write
jobs:
report-success:
name: Report pre-commit success
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- name: Report success
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const owner = '${{ github.repository_owner }}';
const repo = '${{ github.repository }}'.split('/')[1];
const sha = '${{ github.event.workflow_run.head_sha }}';
core.debug(`owner: ${owner}`);
core.debug(`repo: ${repo}`);
core.debug(`sha: ${sha}`);
const { context: name, state } = (await github.rest.repos.createCommitStatus({
context: 'Pre-commit checks',
description: 'Pre-commit checks successful',
owner: owner,
repo: repo,
sha: sha,
state: 'success',
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}'
})).data;
core.info(`${name} is ${state}`);
report-pending:
name: Report pre-commit pending
if: github.event.workflow_run.conclusion != 'success'
runs-on: ubuntu-latest
steps:
- name: Report pending
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const owner = '${{ github.repository_owner }}';
const repo = '${{ github.repository }}'.split('/')[1];
const sha = '${{ github.event.workflow_run.head_sha }}';
core.debug(`owner: ${owner}`);
core.debug(`repo: ${repo}`);
core.debug(`sha: ${sha}`);
const { context: name, state } = (await github.rest.repos.createCommitStatus({
context: 'Pre-commit checks',
description: 'The pre-commit checks need to be successful before merging',
owner: owner,
repo: repo,
sha: sha,
state: 'pending',
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}'
})).data;
core.info(`${name} is ${state}`);

80
.github/workflows/pre-commit.yml vendored Normal file
View file

@ -0,0 +1,80 @@
name: Pre-commit hooks
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
types: [opened, reopened, synchronize, labeled]
concurrency:
group: pre-commit-${{github.event.pull_request.number || github.ref}}
cancel-in-progress: true
jobs:
lint:
if: |
github.event_name != 'pull_request' ||
contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') ||
contains(github.event.pull_request.labels.*.name, 'Re-trigger Pre-commit Hooks')
name: Check if fixes are needed
runs-on: ubuntu-latest
steps:
- name: Checkout latest commit
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 2
- name: Remove Label
if: contains(github.event.pull_request.labels.*.name, 'Re-trigger Pre-commit Hooks')
run: gh pr edit ${{ github.event.number }} --remove-label 'Re-trigger Pre-commit Hooks'
env:
GH_TOKEN: ${{ github.token }}
- name: Set up Python 3
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4
with:
cache-dependency-path: tools/pre-commit/requirements.txt
cache: "pip"
python-version: "3.x"
- name: Get Python version hash
run: |
echo "Using $(python -VV)"
echo "PY_HASH=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- name: Restore pre-commit cache
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
id: restore-cache
with:
path: |
~/.cache/pre-commit
key: pre-commit-${{ env.PY_HASH }}-${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml', 'tools/pre-commit/requirements.txt') }}
- name: Install python dependencies
run: python -m pip install -r tools/pre-commit/requirements.txt
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1
- name: Run pre-commit hooks in changed files
run: pre-commit run --color=always --show-diff-on-failure --files ${{ steps.changed-files.outputs.all_changed_files }}
- name: Save pre-commit cache
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
if: ${{ always() && steps.restore-cache.outputs.cache-hit != 'true' }}
continue-on-error: true
with:
path: |
~/.cache/pre-commit
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
- name: Push changes using pre-commit-ci-lite
uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0
# Only push changes in PRs
if: ${{ always() && github.event_name == 'pull_request' }}
with:
msg: "ci(pre-commit): Apply automatic fixes"

View file

@ -1,38 +0,0 @@
name: Unit Test Results
on:
workflow_run:
workflows: [Run tests in hardware]
branches-ignore: [master]
types:
- completed
jobs:
unit-test-results:
name: Unit Test Results
runs-on: ubuntu-latest
if: |
github.event.workflow_run.event == 'pull_request' &&
(github.event.workflow_run.conclusion == 'success' ||
github.event.workflow_run.conclusion == 'failure')
steps:
- name: Download and Extract Artifacts
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
mkdir -p artifacts && cd artifacts
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
do
IFS=$'\t' read name url <<< "$artifact"
gh api $url > "$name.zip"
unzip -d "$name" "$name.zip"
done
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "artifacts/**/*.xml"

View file

@ -11,7 +11,6 @@ env:
# It's convenient to set variables for values used multiple times in the workflow
SKETCHES_REPORTS_PATH: artifacts/libraries-report
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
PR_EVENT_PATH: artifacts/Event File/event.json
jobs:
lib-test-results:
@ -25,17 +24,33 @@ jobs:
- name: Download and Extract Artifacts
run: |
mkdir -p artifacts && cd artifacts
mkdir -p libraries-report
mkdir -p workflows
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
do
IFS=$'\t' read name url <<< "$artifact"
gh api $url > "$name.zip"
unzip -d "$name" "$name.zip"
unzip -j "$name.zip" -d "temp_$name"
if [[ "$name" == "pr_number" ]]; then
mv "temp_$name"/* workflows
else
mv "temp_$name"/* libraries-report
fi
rm -r "temp_$name"
done
echo "Contents of parent directory:"
ls -R ..
- name: Read the pr_num file
id: pr_num_reader
uses: juliangruber/read-file-action@b549046febe0fe86f8cb4f93c24e284433f9ab58 # v1.1.7
with:
path: ./artifacts/workflows/pr_num.txt
- name: Report results
uses: P-R-O-C-H-Y/report-size-deltas@main
uses: P-R-O-C-H-Y/report-size-deltas@256d1f13e4195cd7fd436d2f959e6dc4d5e4b406 # libs
with:
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
github-token: ${{ env.GITHUB_TOKEN }}
pr-event-path: ${{ env.PR_EVENT_PATH }}
pr-number: "${{ steps.pr_num_reader.outputs.content }}"

52
.github/workflows/publishsizes-2.x.yml vendored Normal file
View file

@ -0,0 +1,52 @@
name: Sizes Results (master-v2.x)
on:
workflow_dispatch:
env:
# It's convenient to set variables for values used multiple times in the workflow
SKETCHES_REPORTS_PATH: artifacts/sizes-report
RESULT_SIZES_TEST_FILE: SIZES_TEST.md
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
jobs:
sizes-test-results:
name: Sizes Comparison Results
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: gh-pages
- name: Create folder structure
run: |
mkdir -p artifacts && cd artifacts
mkdir -p sizes-report
mkdir -p sizes-report/master
mkdir -p sizes-report/pr
# master folder is a base for comparison
# pr folder is for comparison with master
- name: Download JSON file
run: |
mv master_cli_compile/*.json artifacts/sizes-report/pr/
mv v2.x_cli_compile/*.json artifacts/sizes-report/master/
- name: Report results
uses: P-R-O-C-H-Y/report-size-deltas@2043188c68f483a7b50527c4eacf609d05bb67a5 # sizes_v2
with:
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
github-token: ${{ env.GITHUB_TOKEN }}
destination-file: ${{ env.RESULT_SIZES_TEST_FILE }}
- name: Append file with action URL
run: echo "/ [GitHub Action Link](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})" >> ${{ env.RESULT_SIZES_TEST_FILE }}
- name: Push to github repo
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add ${{ env.RESULT_SIZES_TEST_FILE }}
git commit -m "Generated Sizes Results (master-v2.x)"
git push origin HEAD:gh-pages

73
.github/workflows/publishsizes.yml vendored Normal file
View file

@ -0,0 +1,73 @@
name: Sizes Results
on:
workflow_run:
workflows: [Compilation Tests]
types:
- completed
workflow_dispatch:
env:
# It's convenient to set variables for values used multiple times in the workflow
SKETCHES_REPORTS_PATH: artifacts/sizes-report
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
jobs:
sizes-test-results:
name: Sizes Comparison Results
runs-on: ubuntu-latest
if: |
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: gh-pages
- name: Create folder structure
run: |
mkdir -p artifacts && cd artifacts
mkdir -p sizes-report
mkdir -p sizes-report/master
mkdir -p sizes-report/pr
- name: Download JSON file
run: |
mv master_cli_compile/*.json artifacts/sizes-report/master/
- name: Download and Extract Artifacts
run: |
cd artifacts
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
do
IFS=$'\t' read name url <<< "$artifact"
# Only process pr_number and pr_cli_compile artifacts
if [[ "$name" == "pr_number" || "$name" =~ ^pr_cli_compile_[0-9]+$ ]]; then
gh api $url > "$name.zip"
unzip -o -j "$name.zip" -d "temp_$name"
if [[ "$name" == "pr_number" ]]; then
mv "temp_$name"/* sizes-report
elif [[ "$name" =~ ^pr_cli_compile_[0-9]+$ ]]; then
mv "temp_$name"/* sizes-report/pr
fi
rm -r "temp_$name"
fi
done
echo "Contents of parent directory:"
ls -R ..
- name: Read the pr_num file
id: pr_num_reader
uses: juliangruber/read-file-action@b549046febe0fe86f8cb4f93c24e284433f9ab58 # v1.1.7
with:
path: ./artifacts/sizes-report/pr_num.txt
- name: Report results
uses: P-R-O-C-H-Y/report-size-deltas@bea91d2c99ca80c88a883b39b1c4012f00ec3d09 # sizes_v2
with:
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
github-token: ${{ env.GITHUB_TOKEN }}
pr-number: "${{ steps.pr_num_reader.outputs.content }}"

View file

@ -1,56 +1,224 @@
name: ESP32 Arduino CI
name: Compilation Tests
on:
workflow_dispatch:
inputs:
log_level:
description: "Log level"
default: "none"
type: "choice"
required: true
options:
- "none"
- "error"
- "warn"
- "info"
- "debug"
- "verbose"
schedule:
# Every Sunday at 2:00 UTC run a build with verbose log level
- cron: "0 2 * * SUN"
push:
branches:
- master
- release/*
- master
- release/*
pull_request:
paths:
- "cores/**"
- "libraries/**"
- "!libraries/**.md"
- "!libraries/**.txt"
- "!libraries/**.properties"
- "!libraries/**.py"
- "package/**"
- "idf_component_examples/**"
- "tools/**.py"
- "platform.txt"
- "programmers.txt"
- "idf_component.yml"
- "Kconfig.projbuild"
- "package.json"
- "CMakeLists.txt"
- ".github/workflows/push.yml"
- ".github/scripts/**"
- "!.github/scripts/find_*"
- "!.github/scripts/on-release.sh"
- "!.github/scripts/tests_*"
- "!.github/scripts/upload_*"
- "variants/esp32/**/*"
- "variants/esp32c3/**/*"
- "variants/esp32c5/**/*"
- "variants/esp32c6/**/*"
- "variants/esp32h2/**/*"
- "variants/esp32p4/**/*"
- "variants/esp32s2/**/*"
- "variants/esp32s3/**/*"
concurrency:
group: build-${{github.event.pull_request.number || github.ref}}
cancel-in-progress: true
jobs:
env:
MAX_CHUNKS: 15
jobs:
cmake-check:
name: Check cmake file
runs-on: ubuntu-latest
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }}
steps:
- uses: actions/checkout@v4
- run: bash ./.github/scripts/check-cmakelists.sh
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- run: bash ./.github/scripts/check-cmakelists.sh
gen-chunks:
name: Generate chunks
runs-on: ubuntu-latest
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }}
outputs:
build_all: ${{ steps.set-chunks.outputs.build_all }}
build_libraries: ${{ steps.set-chunks.outputs.build_libraries }}
build_static_sketches: ${{ steps.set-chunks.outputs.build_static_sketches }}
build_idf: ${{ steps.set-chunks.outputs.build_idf }}
chunk_count: ${{ steps.set-chunks.outputs.chunk_count }}
chunks: ${{ steps.set-chunks.outputs.chunks }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1
with:
files_yaml: |
core:
- '.github/**'
- 'cores/**'
- 'package/**'
- 'tools/**'
- 'platform.txt'
- 'programmers.txt'
- "variants/esp32/**/*"
- "variants/esp32c3/**/*"
- "variants/esp32c6/**/*"
- "variants/esp32h2/**/*"
- "variants/esp32p4/**/*"
- "variants/esp32s2/**/*"
- "variants/esp32s3/**/*"
libraries:
- 'libraries/**/examples/**'
- 'libraries/**/src/**'
networking:
- 'libraries/Network/src/**'
fs:
- 'libraries/FS/src/**'
static_sketeches:
- 'libraries/NetworkClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino'
- 'libraries/BLE/examples/Server/Server.ino'
- 'libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino'
- 'libraries/Insights/examples/MinimalDiagnostics/MinimalDiagnostics.ino'
- 'libraries/NetworkClientSecure/src/**'
- 'libraries/BLE/src/**'
- 'libraries/Insights/src/**'
idf:
- 'idf_component.yml'
- 'Kconfig.projbuild'
- 'CMakeLists.txt'
- "idf_component_examples/**"
- name: Set chunks
id: set-chunks
env:
LIB_FILES: ${{ steps.changed-files.outputs.libraries_all_changed_files }}
IS_PR: ${{ github.event_name == 'pull_request' }}
MAX_CHUNKS: ${{ env.MAX_CHUNKS }}
BUILD_IDF: ${{ steps.changed-files.outputs.idf_any_changed == 'true' }}
BUILD_LIBRARIES: ${{ steps.changed-files.outputs.libraries_any_changed == 'true' }}
BUILD_STATIC_SKETCHES: ${{ steps.changed-files.outputs.static_sketeches_any_changed == 'true' }}
FS_CHANGED: ${{ steps.changed-files.outputs.fs_any_changed == 'true' }}
NETWORKING_CHANGED: ${{ steps.changed-files.outputs.networking_any_changed == 'true' }}
CORE_CHANGED: ${{ steps.changed-files.outputs.core_any_changed == 'true' }}
LIB_CHANGED: ${{ steps.changed-files.outputs.libraries_any_changed == 'true' }}
run: |
bash ./.github/scripts/set_push_chunks.sh
- name: Upload sketches found
if: ${{ steps.set-chunks.outputs.build_all == 'false' && steps.set-chunks.outputs.build_libraries == 'true' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: sketches_found
path: sketches_found.txt
overwrite: true
if-no-files-found: error
# Ubuntu
build-arduino-linux:
name: Arduino ${{ matrix.chunk }} on ubuntu-latest
if: ${{ needs.gen-chunks.outputs.build_all == 'true' || needs.gen-chunks.outputs.build_libraries == 'true' }}
needs: gen-chunks
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
chunk: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
chunk: ${{ fromJson(needs.gen-chunks.outputs.chunks) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Cache tools
id: cache-linux
uses: actions/cache@v4
with:
path: |
./tools/dist
~/arduino_ide
key: ${{ runner.os }}-${{ hashFiles('package/package_esp32_index.template.json',
'tools/get.py',
'.github/scripts/install-arduino-ide.sh') }}
- name: Build Sketches
run: bash ./.github/scripts/on-push.sh ${{ matrix.chunk }} 15
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4
with:
python-version: "3.x"
- name: Get libs cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
key: libs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package/package_esp32_index.template.json', 'tools/get.py') }}
path: |
./tools/dist
./tools/esp32-arduino-libs
./tools/esptool
./tools/mk*
./tools/openocd-esp32
./tools/riscv32-*
./tools/xtensa-*
- name: Set Log Level
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "LOG_LEVEL=${{ github.event.inputs.log_level }}" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "schedule" ]; then
echo "LOG_LEVEL=verbose" >> $GITHUB_ENV
else
echo "LOG_LEVEL=none" >> $GITHUB_ENV
fi
- name: Build all sketches
if: ${{ needs.gen-chunks.outputs.build_all == 'true' }}
run: bash ./.github/scripts/on-push.sh ${{ matrix.chunk }} ${{ env.MAX_CHUNKS }} 1 ${{ env.LOG_LEVEL }}
- name: Download sketches found
if: ${{ needs.gen-chunks.outputs.build_all == 'false' && needs.gen-chunks.outputs.build_libraries == 'true' }}
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with:
name: sketches_found
- name: Build selected sketches
if: ${{ needs.gen-chunks.outputs.build_all == 'false' && needs.gen-chunks.outputs.build_libraries == 'true' }}
run: bash ./.github/scripts/on-push.sh ${{ matrix.chunk }} ${{ needs.gen-chunks.outputs.chunk_count }} 1 ${{ env.LOG_LEVEL }} sketches_found.txt
#Upload cli compile json as artifact
- name: Upload cli compile json
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: pr_cli_compile_${{ matrix.chunk }}
path: cli_compile_${{ matrix.chunk }}.json
overwrite: true
# Windows and MacOS
build-arduino-win-mac:
name: Arduino on ${{ matrix.os }}
needs: gen-chunks
if: ${{ needs.gen-chunks.outputs.build_all == 'true' || needs.gen-chunks.outputs.build_static_sketches == 'true' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@ -58,33 +226,21 @@ jobs:
os: [windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Build Sketches
run: bash ./.github/scripts/on-push.sh
# PlatformIO on Windows, Ubuntu and Mac
build-platformio:
name: PlatformIO on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Build Sketches
run: bash ./.github/scripts/on-push.sh 1 1 #equal and non-zero to trigger PIO
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4
with:
python-version: "3.x"
- name: Build Sketches
run: bash ./.github/scripts/on-push.sh
build-esp-idf-component:
name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
runs-on: ubuntu-20.04
needs: gen-chunks
if: |
needs.gen-chunks.outputs.build_all == 'true' ||
needs.gen-chunks.outputs.build_libraries == 'true' ||
needs.gen-chunks.outputs.build_idf == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
@ -92,21 +248,96 @@ jobs:
# See https://hub.docker.com/r/espressif/idf/tags and
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
# for details.
idf_ver: ["release-v5.1"]
idf_target: ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3", "esp32c6", "esp32h2"]
idf_ver: ["release-v5.3","release-v5.4","release-v5.5"]
idf_target:
[
"esp32",
"esp32s2",
"esp32s3",
"esp32c2",
"esp32c3",
"esp32c6",
"esp32h2",
"esp32p4"
]
container: espressif/idf:${{ matrix.idf_ver }}
steps:
- name: Check out arduino-esp32 as a component
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive
path: components/arduino-esp32
- name: Setup jq
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
- name: Build
env:
IDF_TARGET: ${{ matrix.idf_target }}
shell: bash
run: |
. ${IDF_PATH}/export.sh
idf.py create-project test
echo CONFIG_FREERTOS_HZ=1000 > test/sdkconfig.defaults
idf.py -C test -DEXTRA_COMPONENT_DIRS=$PWD/components build
chmod a+x ./components/arduino-esp32/.github/scripts/*
./components/arduino-esp32/.github/scripts/on-push-idf.sh
- name: Upload generated sdkconfig files for debugging
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: always()
with:
name: sdkconfig-${{ matrix.idf_ver }}-${{ matrix.idf_target }}
path: ./components/arduino-esp32/idf_component_examples/**/sdkconfig
# Save artifacts to gh-pages
save-master-artifacts:
name: Save master artifacts
needs: build-arduino-linux
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
# Check out repository
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{secrets.GITHUB_TOKEN}}
fetch-depth: "0"
- name: Switch branch
run: git checkout remotes/origin/gh-pages
- name: Download sketches reports artifact
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with:
pattern: pr_cli_compile_*
merge-multiple: true
path: master_cli_compile
- name: List files in the directory
run: ls -R
- name: Commit json files to gh-pages if on master
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
continue-on-error: true
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add --all
git commit -m "Updated cli compile json files"
git push origin HEAD:gh-pages
#Upload PR number as artifact
upload-pr-number:
name: Upload PR number
if: ${{ github.event_name == 'pull_request' && !startsWith(github.head_ref, 'release/') }}
runs-on: ubuntu-latest
steps:
- name: Save the PR number in an artifact
shell: bash
env:
PR_NUM: ${{ github.event.number }}
run: echo $PR_NUM > pr_num.txt
- name: Upload PR number
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: pr_number
path: ./pr_num.txt
overwrite: true

View file

@ -10,13 +10,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Build Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash ./.github/scripts/on-release.sh
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4
with:
python-version: "3.x"
- name: Install packaging
run: pip install packaging
- name: Install pyserial
run: pip install pyserial
- name: Build Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash ./.github/scripts/on-release.sh

123
.github/workflows/tests.yml vendored Normal file
View file

@ -0,0 +1,123 @@
# This file is used to run the runtime tests for the Arduino core for ESP32.
# The tests are run on the hardware, Wokwi and QEMU emulators.
# The QEMU tests are disabled for now as they are redundant with most of the Wokwi tests.
# As the Wokwi tests require access to secrets, they are run in a separate workflow.
# We need to ensure that the artifacts from previous tests in the chain are propagated for publishing the results.
# This is the current trigger sequence for the tests:
# tests.yml -> tests_wokwi.yml -> tests_results.yml
# ⌙> tests_build.yml
# ⌙> tests_hw.yml
# ⌙> tests_qemu.yml
name: Runtime Tests
on:
workflow_dispatch:
pull_request:
types: [opened, reopened, closed, synchronize, labeled, unlabeled]
paths:
- ".github/workflows/tests*"
- ".github/scripts/*.sh"
- "!.github/scripts/check-cmakelists.sh"
- "!.github/scripts/find_*"
- "!.github/scripts/on-*.sh"
- "!.github/scripts/set_push_chunks.sh"
- "!.github/scripts/update-version.sh"
- "!.github/scripts/upload_py_tools.sh"
- "tests/**"
- "cores/**"
- "libraries/*/src/**.cpp"
- "libraries/*/src/**.h"
- "libraries/*/src/**.c"
- "package/**"
schedule:
- cron: "0 2 * * *"
concurrency:
group: tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
push-event-file:
name: Push event file
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: event_file
path: ${{ github.event_path }}
gen-matrix:
name: Generate matrix
runs-on: ubuntu-latest
outputs:
build-types: ${{ steps.set-matrix.outputs.build-types }}
hw-types: ${{ steps.set-matrix.outputs.hw-types }}
wokwi-types: ${{ steps.set-matrix.outputs.wokwi-types }}
qemu-types: ${{ steps.set-matrix.outputs.qemu-types }}
targets: ${{ steps.set-matrix.outputs.targets }}
env:
IS_PR: ${{ github.event.pull_request.number != null }}
PERFORMANCE_ENABLED: ${{ contains(github.event.pull_request.labels.*.name, 'perf_test') }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: .github/scripts/tests_matrix.sh
- name: Set matrix
id: set-matrix
run: bash .github/scripts/tests_matrix.sh
- name: Upload
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: matrix_info
path: info/*
call-build-tests:
name: Build
uses: ./.github/workflows/tests_build.yml
needs: gen-matrix
strategy:
matrix:
type: ${{ fromJson(needs.gen-matrix.outputs.build-types) }}
chip: ${{ fromJson(needs.gen-matrix.outputs.targets) }}
with:
type: ${{ matrix.type }}
chip: ${{ matrix.chip }}
call-hardware-tests:
name: Hardware
uses: ./.github/workflows/tests_hw.yml
needs: [gen-matrix, call-build-tests]
if: |
github.repository == 'espressif/arduino-esp32' &&
(github.event_name != 'pull_request' ||
contains(github.event.pull_request.labels.*.name, 'hil_test'))
strategy:
fail-fast: false
matrix:
type: ${{ fromJson(needs.gen-matrix.outputs.hw-types) }}
chip: ${{ fromJson(needs.gen-matrix.outputs.targets) }}
with:
type: ${{ matrix.type }}
chip: ${{ matrix.chip }}
# This job is disabled for now
call-qemu-tests:
name: QEMU
uses: ./.github/workflows/tests_qemu.yml
needs: [gen-matrix, call-build-tests]
if: false
strategy:
fail-fast: false
matrix:
type: ${{ fromJson(needs.gen-matrix.outputs.qemu-types) }}
chip: ["esp32", "esp32c3"]
with:
type: ${{ matrix.type }}
chip: ${{ matrix.chip }}
# Wokwi tests are run after this workflow as it needs access to secrets

90
.github/workflows/tests_build.yml vendored Normal file
View file

@ -0,0 +1,90 @@
name: Build tests
on:
workflow_call:
inputs:
type:
type: string
description: "Type of tests to build"
required: true
chip:
type: string
description: "Chip to build tests for"
required: true
jobs:
build-tests:
name: Build ${{ inputs.type }} tests for ${{ inputs.chip }}
runs-on: ubuntu-latest
env:
id: ${{ github.event.pull_request.number || github.ref }}-${{ github.event.pull_request.head.sha || github.sha }}-${{ inputs.chip }}-${{ inputs.type }}
steps:
- name: Check if already built
id: cache-build-binaries
if: github.event.pull_request.number != null
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
key: tests-${{ env.id }}-bin
path: |
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.bin
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.elf
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.json
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/sdkconfig
- name: Evaluate if tests should be built
id: check-build
run: |
cache_exists=${{ steps.cache-build-binaries.outputs.cache-hit == 'true' }}
enabled=true
if [[ $cache_exists == 'true' ]]; then
echo "Already built, skipping"
enabled=false
fi
echo "enabled=$enabled" >> $GITHUB_OUTPUT
- name: Checkout user repository
if: ${{ steps.check-build.outputs.enabled == 'true' }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Get libs cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
if: ${{ steps.check-build.outputs.enabled == 'true' }}
with:
key: libs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package/package_esp32_index.template.json', 'tools/get.py') }}
path: |
./tools/dist
./tools/esp32-arduino-libs
./tools/esptool
./tools/mk*
./tools/openocd-esp32
./tools/riscv32-*
./tools/xtensa-*
- name: Build sketches
if: ${{ steps.check-build.outputs.enabled == 'true' }}
run: |
bash .github/scripts/tests_build.sh -c -type ${{ inputs.type }} -t ${{ inputs.chip }}
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} binaries as cache
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
if: steps.check-build.outputs.enabled == 'true' && github.event.pull_request.number != null
with:
key: tests-${{ env.id }}-bin
path: |
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.bin
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.elf
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.json
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/sdkconfig
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} binaries as artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: tests-bin-${{ inputs.chip }}-${{ inputs.type }}
overwrite: true
path: |
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.bin
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.elf
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.json
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/sdkconfig

118
.github/workflows/tests_hw.yml vendored Normal file
View file

@ -0,0 +1,118 @@
name: Hardware tests
on:
workflow_call:
inputs:
type:
type: string
description: "Type of tests to run"
required: true
chip:
type: string
description: "Chip to run tests for"
required: true
env:
DEBIAN_FRONTEND: noninteractive
defaults:
run:
shell: bash
jobs:
hardware-test:
name: Hardware ${{ inputs.chip }} ${{ inputs.type }} tests
runs-on: ["arduino", "${{ inputs.chip }}"]
env:
id: ${{ github.event.pull_request.number || github.ref }}-${{ github.event.pull_request.head.sha || github.sha }}-${{ inputs.chip }}-${{ inputs.type }}
container:
image: python:3.10.1-bullseye
options: --privileged --device-cgroup-rule="c 188:* rmw" --device-cgroup-rule="c 166:* rmw"
steps:
- name: Clean workspace
run: |
rm -rf ./*
rm -rf ~/.arduino/tests
- name: Check if already passed
id: cache-results
if: github.event.pull_request.number != null
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
key: tests-${{ env.id }}-results-hw
path: |
tests/**/*.xml
tests/**/result_*.json
- name: Evaluate if tests should be run
id: check-tests
run: |
cache_exists=${{ steps.cache-results.outputs.cache-hit == 'true' }}
enabled=true
if [[ $cache_exists == 'true' ]]; then
echo "Already ran, skipping"
enabled=false
fi
echo "enabled=$enabled" >> $GITHUB_OUTPUT
- name: Checkout user repository
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: |
*
# setup-python currently only works on ubuntu images
# - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4
# if: ${{ steps.check-tests.outputs.enabled == 'true' }}
# with:
# cache-dependency-path: tests/requirements.txt
# cache: 'pip'
# python-version: '3.10.1'
- name: Install dependencies
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: |
pip install -U pip
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
apt update
apt install -y jq
- name: Get binaries
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with:
name: tests-bin-${{ inputs.chip }}-${{ inputs.type }}
path: |
~/.arduino/tests/${{ inputs.chip }}
- name: List binaries
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: |
ls -laR ~/.arduino/tests
- name: Run Tests
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: |
bash .github/scripts/tests_run.sh -c -type ${{ inputs.type }} -t ${{ inputs.chip }} -i 0 -m 1 -e
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} hardware results as cache
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
if: steps.check-tests.outputs.enabled == 'true' && github.event.pull_request.number != null
with:
key: tests-${{ env.id }}-results-hw
path: |
tests/**/*.xml
tests/**/result_*.json
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} hardware results as artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: always()
with:
name: tests-results-hw-${{ inputs.chip }}-${{ inputs.type }}
overwrite: true
path: |
tests/**/*.xml
tests/**/result_*.json

143
.github/workflows/tests_qemu.yml vendored Normal file
View file

@ -0,0 +1,143 @@
name: QEMU tests
on:
workflow_call:
inputs:
chip:
required: true
type: string
type:
required: true
type: string
jobs:
qemu-test:
name: QEMU ${{ inputs.chip }} ${{ inputs.type }} tests
env:
id: ${{ github.event.pull_request.number || github.ref }}-${{ github.event.pull_request.head.sha || github.sha }}-${{ inputs.chip }}-${{ inputs.type }}
QEMU_INSTALL_PATH: "$HOME"
runs-on: ubuntu-latest
steps:
- name: Check if already passed
id: get-cache-results
if: github.event.pull_request.number != null
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
key: tests-${{ env.id }}-results-qemu
path: |
tests/**/*.xml
tests/**/result_*.json
- name: Evaluate if tests should be run
id: check-tests
run: |
cache_exists=${{ steps.get-cache-results.outputs.cache-hit == 'true' }}
enabled=true
if [[ $cache_exists == 'true' ]]; then
echo "Already ran, skipping"
enabled=false
fi
echo "enabled=$enabled" >> $GITHUB_OUTPUT
- name: Checkout user repository
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/*
!.github
# To avoid giving unknown scripts elevated permissions, download them from the master branch
- name: Get CI scripts from master
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: |
mkdir -p .github
cd .github
curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
with:
cache-dependency-path: tests/requirements.txt
cache: "pip"
python-version: "3.x"
- name: Install Python dependencies
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: |
pip install -U pip
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
- name: Install APT dependencies
uses: awalsh128/cache-apt-pkgs-action@5902b33ae29014e6ca012c5d8025d4346556bd40 # v1.4.3
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
with:
packages: libpixman-1-0 libnuma1 libglib2.0-0 libslirp0 libsdl2-2.0-0
version: 1.0
- name: Get QEMU version
uses: pozetroninc/github-action-get-latest-release@2a61c339ea7ef0a336d1daa35ef0cb1418e7676c # v0.8.0
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
id: get-qemu-version
with:
token: ${{secrets.GITHUB_TOKEN}}
owner: espressif
repo: qemu
excludes: prerelease, draft
- name: Cache QEMU
id: cache-qemu
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
with:
path: |
~/qemu
key: qemu-${{ steps.get-qemu-version.outputs.release }}-${{ hashFiles('.github/workflows/tests_qemu.yml') }}
- name: Download QEMU
if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' && steps.check-tests.outputs.enabled == 'true' }}
run: |
cd ${{ env.QEMU_INSTALL_PATH }}
underscore_release=$(echo ${{ steps.get-qemu-version.outputs.release }} | sed 's/\-/_/g')
curl -L https://github.com/espressif/qemu/releases/download/${{ steps.get-qemu-version.outputs.release }}/qemu-riscv32-softmmu-${underscore_release}-x86_64-linux-gnu.tar.xz > qemu-riscv32.tar.xz
curl -L https://github.com/espressif/qemu/releases/download/${{ steps.get-qemu-version.outputs.release }}/qemu-xtensa-softmmu-${underscore_release}-x86_64-linux-gnu.tar.xz > qemu-xtensa.tar.xz
tar -xf qemu-riscv32.tar.xz
tar -xf qemu-xtensa.tar.xz
rm qemu-*
echo "QEMU_PATH=${{ env.QEMU_INSTALL_PATH }}/qemu" >> $GITHUB_ENV
- name: Get binaries
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with:
name: tests-bin-${{ inputs.chip }}-${{ inputs.type }}
path: |
~/.arduino/tests/${{ inputs.chip }}
- name: Run Tests
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: QEMU_PATH="${{ env.QEMU_INSTALL_PATH }}" bash .github/scripts/tests_run.sh -c -type ${{inputs.type}} -t ${{inputs.chip}} -i 0 -m 1 -Q
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} QEMU results as cache
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
if: steps.check-tests.outputs.enabled == 'true' && github.event.pull_request.number != null
with:
key: tests-${{ env.id }}-results-qemu
path: |
tests/**/*.xml
tests/**/result_*.json
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} QEMU results as artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: always()
with:
name: tests-results-qemu-${{ inputs.chip }}-${{ inputs.type }}
overwrite: true
path: |
tests/**/*.xml
tests/**/result_*.json

195
.github/workflows/tests_results.yml vendored Normal file
View file

@ -0,0 +1,195 @@
name: Publish and clean test results
on:
workflow_run:
workflows: ["Wokwi tests"]
types:
- completed
# No permissions by default
permissions: { contents: read }
jobs:
unit-test-results:
name: Unit Test Results
if: |
github.event.workflow_run.conclusion == 'success' ||
github.event.workflow_run.conclusion == 'failure' ||
github.event.workflow_run.conclusion == 'timed_out'
runs-on: ubuntu-latest
permissions:
actions: write
statuses: write
checks: write
pull-requests: write
contents: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: gh-pages
- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@07ab29fd4a977ae4d2b275087cf67563dfdf0295 # v9
with:
run_id: ${{ github.event.workflow_run.id }}
path: ./artifacts
- name: Get original info
run: |
original_event=$(cat ./artifacts/parent-artifacts/event.txt)
original_action=$(cat ./artifacts/parent-artifacts/action.txt)
original_sha=$(cat ./artifacts/parent-artifacts/sha.txt)
original_ref=$(cat ./artifacts/parent-artifacts/ref.txt)
original_conclusion=$(cat ./artifacts/parent-artifacts/conclusion.txt)
original_run_id=$(cat ./artifacts/parent-artifacts/run_id.txt)
# Sanitize the values to avoid security issues
# Event: Allow alphabetical characters and underscores
original_event=$(echo "$original_event" | tr -cd '[:alpha:]_')
# Action: Allow alphabetical characters and underscores
original_action=$(echo "$original_action" | tr -cd '[:alpha:]_')
# SHA: Allow alphanumeric characters
original_sha=$(echo "$original_sha" | tr -cd '[:alnum:]')
# Ref: Allow alphanumeric characters, slashes, underscores, dots, and dashes
original_ref=$(echo "$original_ref" | tr -cd '[:alnum:]/_.-')
# Conclusion: Allow alphabetical characters and underscores
original_conclusion=$(echo "$original_conclusion" | tr -cd '[:alpha:]_')
# Run ID: Allow numeric characters
original_run_id=$(echo "$original_run_id" | tr -cd '[:digit:]')
echo "original_event=$original_event" >> $GITHUB_ENV
echo "original_action=$original_action" >> $GITHUB_ENV
echo "original_sha=$original_sha" >> $GITHUB_ENV
echo "original_ref=$original_ref" >> $GITHUB_ENV
echo "original_conclusion=$original_conclusion" >> $GITHUB_ENV
echo "original_run_id=$original_run_id" >> $GITHUB_ENV
echo "original_event = $original_event"
echo "original_action = $original_action"
echo "original_sha = $original_sha"
echo "original_ref = $original_ref"
echo "original_conclusion = $original_conclusion"
echo "original_run_id = $original_run_id"
- name: Print links to other runs
run: |
echo "Build, Hardware and QEMU tests: https://github.com/${{ github.repository }}/actions/runs/${{ env.original_run_id }}"
echo "Wokwi tests: https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}"
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@170bf24d20d201b842d7a52403b73ed297e6645b # v2.18.0
with:
commit: ${{ env.original_sha }}
event_file: ./artifacts/parent-artifacts/event_file/event.json
event_name: ${{ env.original_event }}
files: ./artifacts/**/*.xml
action_fail: true
compare_to_earlier_commit: false
json_file: ./unity_results.json
json_suite_details: true
- name: Upload JSON
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: ${{ always() }}
with:
name: unity_results
overwrite: true
path: |
./unity_results.json
- name: Fail if tests failed
if: ${{ env.original_conclusion == 'failure' || env.original_conclusion == 'timed_out' || github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out' }}
run: exit 1
- name: Clean up caches
if: always()
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const ref = process.env.original_ref;
const key_prefix = 'tests-' + ref + '-';
if (process.env.original_event == 'pull_request' && process.env.original_action != 'closed') {
console.log('Skipping cache cleanup for open PR');
return;
}
await github.paginate(github.rest.actions.getActionsCacheList, {
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100,
key: key_prefix
}).then(caches => {
if (caches) {
for (const cache of caches) {
console.log(`Deleting cache: ${cache.key}`);
github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id
});
}
}
});
- name: Report conclusion
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: always()
with:
script: |
const owner = '${{ github.repository_owner }}';
const repo = '${{ github.repository }}'.split('/')[1];
const sha = process.env.original_sha;
core.debug(`owner: ${owner}`);
core.debug(`repo: ${repo}`);
core.debug(`sha: ${sha}`);
const { context: name, state } = (await github.rest.repos.createCommitStatus({
context: `Runtime Tests / Report results (${process.env.original_event} -> workflow_run -> workflow_run)`,
owner: owner,
repo: repo,
sha: sha,
state: '${{ job.status }}',
description: '${{ job.status }}' == 'success' ? 'Runtime tests successful' : 'Runtime tests failed',
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
})).data;
core.info(`${name} is ${state}`);
- name: Generate report
if: ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }} # codespell:ignore cancelled
env:
REPORT_FILE: ./runtime-tests-results/RUNTIME_TESTS_REPORT.md
WOKWI_RUN_ID: ${{ github.event.workflow_run.id }}
BUILD_RUN_ID: ${{ env.original_run_id }}
IS_FAILING: ${{ env.original_conclusion == 'failure' || env.original_conclusion == 'timed_out' || github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out' || job.status == 'failure' }}
run: |
rm -rf artifacts $REPORT_FILE
mv -f ./unity_results.json ./runtime-tests-results/unity_results.json
touch $REPORT_FILE
python3 ./runtime-tests-results/table_generator.py ./runtime-tests-results/unity_results.json >> $REPORT_FILE
- name: Generate badge
if: ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }} # codespell:ignore cancelled
uses: jaywcjlove/generated-badges@0e078ae4d4bab3777ea4f137de496ab44688f5ad # v1.0.13
with:
label: Runtime Tests
status: ${{ job.status == 'success' && 'passing' || 'failing' }}
output: runtime-tests-results/badge.svg
color: ${{ job.status == 'success' && 'green' || 'red' }}
style: flat
- name: Push badge
if: ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }} # codespell:ignore cancelled
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if [[ `git status --porcelain` ]]; then
git add --all
git commit -m "Updated runtime tests report"
git push origin HEAD:gh-pages
fi

326
.github/workflows/tests_wokwi.yml vendored Normal file
View file

@ -0,0 +1,326 @@
name: Wokwi tests
on:
workflow_run:
workflows: ["Runtime Tests"]
types:
- completed
# No permissions by default
permissions: { contents: read }
env:
WOKWI_TIMEOUT: 600000 # Milliseconds
jobs:
get-artifacts:
name: Get required artifacts
runs-on: ubuntu-latest
permissions:
actions: read
statuses: write
outputs:
pr_num: ${{ steps.set-ref.outputs.pr_num }}
ref: ${{ steps.set-ref.outputs.ref }}
base: ${{ steps.set-ref.outputs.base }}
targets: ${{ steps.set-ref.outputs.targets }}
types: ${{ steps.set-ref.outputs.types }}
steps:
- name: Report pending
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const owner = '${{ github.repository_owner }}';
const repo = '${{ github.repository }}'.split('/')[1];
const sha = '${{ github.event.workflow_run.head_sha }}';
core.debug(`owner: ${owner}`);
core.debug(`repo: ${repo}`);
core.debug(`sha: ${sha}`);
const { context: name, state } = (await github.rest.repos.createCommitStatus({
context: 'Runtime Tests / Wokwi (Get artifacts) (${{ github.event.workflow_run.event }} -> workflow_run)',
owner: owner,
repo: repo,
sha: sha,
state: 'pending',
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
})).data;
core.info(`${name} is ${state}`);
- name: Download and extract event file
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
name: event_file
path: artifacts/event_file
- name: Download and extract matrix info
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
name: matrix_info
path: artifacts/matrix_info
- name: Try to read PR number
id: set-ref
run: |
pr_num=$(jq -r '.pull_request.number' artifacts/event_file/event.json | tr -cd "[:digit:]")
if [ -z "$pr_num" ] || [ "$pr_num" == "null" ]; then
pr_num=""
fi
ref=$pr_num
if [ -z "$ref" ] || [ "$ref" == "null" ]; then
ref=${{ github.ref }}
fi
action=$(jq -r '.action' artifacts/event_file/event.json | tr -cd "[:alpha:]_")
if [ "$action" == "null" ]; then
action=""
fi
base=$(jq -r '.pull_request.base.ref' artifacts/event_file/event.json | tr -cd "[:alnum:]/_.-")
if [ -z "$base" ] || [ "$base" == "null" ]; then
base=${{ github.ref }}
fi
types=$(cat artifacts/matrix_info/wokwi_types.txt | tr -cd "[:alpha:],[]'")
targets=$(cat artifacts/matrix_info/targets.txt | tr -cd "[:alnum:],[]'")
echo "base = $base"
echo "targets = $targets"
echo "types = $types"
echo "pr_num = $pr_num"
printf "$ref" >> artifacts/ref.txt
printf "Ref = "
cat artifacts/ref.txt
printf "${{ github.event.workflow_run.event }}" >> artifacts/event.txt
printf "\nEvent name = "
cat artifacts/event.txt
printf "${{ github.event.workflow_run.head_sha || github.sha }}" >> artifacts/sha.txt
printf "\nHead SHA = "
cat artifacts/sha.txt
printf "$action" >> artifacts/action.txt
printf "\nAction = "
cat artifacts/action.txt
printf "${{ github.event.workflow_run.id }}" >> artifacts/run_id.txt
printf "\nRun ID = "
cat artifacts/run_id.txt
if [ -z "$ref" ] || [ "$ref" == "null" ]; then
echo "Failed to get PR number or ref"
exit 1
fi
conclusion="${{ github.event.workflow_run.conclusion }}"
printf "$conclusion" >> artifacts/conclusion.txt
printf "\nConclusion = "
cat artifacts/conclusion.txt
echo "pr_num=$pr_num" >> $GITHUB_OUTPUT
echo "base=$base" >> $GITHUB_OUTPUT
echo "targets=$targets" >> $GITHUB_OUTPUT
echo "types=$types" >> $GITHUB_OUTPUT
echo "ref=$ref" >> $GITHUB_OUTPUT
- name: Download and extract parent hardware results
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
pattern: tests-results-hw-*
merge-multiple: true
path: artifacts/results/hw
- name: Download and extract parent QEMU results
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
pattern: tests-results-qemu-*
merge-multiple: true
path: artifacts/results/qemu
- name: Upload parent artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: parent-artifacts
path: artifacts
if-no-files-found: error
- name: Report conclusion
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: always()
with:
script: |
const owner = '${{ github.repository_owner }}';
const repo = '${{ github.repository }}'.split('/')[1];
const sha = '${{ github.event.workflow_run.head_sha }}';
core.debug(`owner: ${owner}`);
core.debug(`repo: ${repo}`);
core.debug(`sha: ${sha}`);
const { context: name, state } = (await github.rest.repos.createCommitStatus({
context: 'Runtime Tests / Wokwi (Get artifacts) (${{ github.event.workflow_run.event }} -> workflow_run)',
owner: owner,
repo: repo,
sha: sha,
state: '${{ job.status }}',
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
})).data;
core.info(`${name} is ${state}`);
wokwi-test:
name: Wokwi ${{ matrix.chip }} ${{ matrix.type }} tests
if: |
github.event.workflow_run.conclusion == 'success' ||
github.event.workflow_run.conclusion == 'failure' ||
github.event.workflow_run.conclusion == 'timed_out'
runs-on: ubuntu-latest
needs: get-artifacts
env:
id: ${{ needs.get-artifacts.outputs.ref }}-${{ github.event.workflow_run.head_sha || github.sha }}-${{ matrix.chip }}-${{ matrix.type }}
permissions:
actions: read
statuses: write
strategy:
fail-fast: false
matrix:
type: ${{ fromJson(needs.get-artifacts.outputs.types) }}
chip: ${{ fromJson(needs.get-artifacts.outputs.targets) }}
steps:
- name: Report pending
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const owner = '${{ github.repository_owner }}';
const repo = '${{ github.repository }}'.split('/')[1];
const sha = '${{ github.event.workflow_run.head_sha }}';
core.debug(`owner: ${owner}`);
core.debug(`repo: ${repo}`);
core.debug(`sha: ${sha}`);
const { context: name, state } = (await github.rest.repos.createCommitStatus({
context: 'Runtime Tests / Wokwi (${{ matrix.type }}, ${{ matrix.chip }}) / Wokwi ${{ matrix.chip }} ${{ matrix.type }} tests (${{ github.event.workflow_run.event }} -> workflow_run)',
owner: owner,
repo: repo,
sha: sha,
state: 'pending',
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
})).data;
core.info(`${name} is ${state}`);
- name: Check if already passed
id: get-cache-results
if: needs.get-artifacts.outputs.pr_num
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
key: tests-${{ env.id }}-results-wokwi
path: |
tests/**/*.xml
tests/**/result_*.json
- name: Evaluate if tests should be run
id: check-tests
run: |
cache_exists=${{ steps.get-cache-results.outputs.cache-hit == 'true' }}
enabled=true
if [[ $cache_exists == 'true' ]]; then
echo "Already ran, skipping"
enabled=false
fi
echo "enabled=$enabled" >> $GITHUB_OUTPUT
# Note that changes to the workflows and tests will only be picked up after the PR is merged
# DO NOT CHECKOUT THE USER'S REPOSITORY IN THIS WORKFLOW. IT HAS HIGH SECURITY RISKS.
- name: Checkout repository
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ needs.get-artifacts.outputs.base || github.ref }}
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
with:
cache-dependency-path: tests/requirements.txt
cache: "pip"
python-version: "3.x"
- name: Install dependencies
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: |
pip install -U pip
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
- name: Install Wokwi CLI
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: curl -L https://wokwi.com/ci/install.sh | sh
- name: Wokwi CI Server
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
uses: wokwi/wokwi-ci-server-action@a6fabb5a49e080158c7a1d121ea5b789536a82c3 # v1
- name: Get binaries
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
name: tests-bin-${{ matrix.chip }}-${{ matrix.type }}
path: |
~/.arduino/tests/${{ matrix.chip }}
- name: Run Tests
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
env:
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
run: |
bash .github/scripts/tests_run.sh -c -type ${{ matrix.type }} -t ${{ matrix.chip }} -i 0 -m 1 -W ${{ env.WOKWI_TIMEOUT }}
- name: Upload ${{ matrix.chip }} ${{ matrix.type }} Wokwi results as cache
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
if: steps.check-tests.outputs.enabled == 'true' && needs.get-artifacts.outputs.pr_num
with:
key: tests-${{ env.id }}-results-wokwi
path: |
tests/**/*.xml
tests/**/result_*.json
- name: Upload ${{ matrix.chip }} ${{ matrix.type }} Wokwi results as artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: always()
with:
name: tests-results-wokwi-${{ matrix.chip }}-${{ matrix.type }}
overwrite: true
path: |
tests/**/*.xml
tests/**/result_*.json
- name: Report conclusion
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: always()
with:
script: |
const owner = '${{ github.repository_owner }}';
const repo = '${{ github.repository }}'.split('/')[1];
const sha = '${{ github.event.workflow_run.head_sha }}';
core.debug(`owner: ${owner}`);
core.debug(`repo: ${repo}`);
core.debug(`sha: ${sha}`);
const { context: name, state } = (await github.rest.repos.createCommitStatus({
context: 'Runtime Tests / Wokwi (${{ matrix.type }}, ${{ matrix.chip }}) / Wokwi ${{ matrix.chip }} ${{ matrix.type }} tests (${{ github.event.workflow_run.event }} -> workflow_run)',
owner: owner,
repo: repo,
sha: sha,
state: '${{ job.status }}',
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
})).data;
core.info(`${name} is ${state}`);

View file

@ -1,20 +1,59 @@
name: Push components to https://components.espressif.com
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: 'Version to push to the component registry'
required: true
git_ref:
description: 'Git ref with the source to push to the component registry'
required: true
workflow_run:
workflows: ["ESP32 Arduino Release"]
types:
- completed
permissions:
contents: read
jobs:
upload_components:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get the release tag
env:
head_branch: ${{ inputs.tag || github.event.workflow_run.head_branch }}
run: |
if [ "${{ github.event.workflow_run.conclusion }}" != "success" ] && [ "${{ github.event_name }}" == "workflow_run" ]; then
echo "Release workflow failed. Exiting..."
exit 1
fi
# Read and sanitize the branch/tag name
branch=$(echo "$head_branch" | tr -cd '[:alnum:]/_.-')
if [[ $branch == refs/tags/* ]]; then
tag="${branch#refs/tags/}"
elif [[ $branch =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
tag=$branch
else
echo "Tag not found in $branch. Exiting..."
exit 1
fi
echo "Tag: $tag"
echo "RELEASE_TAG=$tag" >> $GITHUB_ENV
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ inputs.git_ref || env.RELEASE_TAG }}
submodules: "recursive"
- name: Upload components to the component registry
uses: espressif/upload-components-ci-action@v1
uses: espressif/upload-components-ci-action@b78a19fa5424714997596d3ecffa634aef8ae20b # v1.0.5
with:
name: arduino-esp32
version: ${{ github.ref_name }}
version: ${{ env.RELEASE_TAG }}
namespace: espressif
api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}

13
.gitignore vendored
View file

@ -1,4 +1,5 @@
tools/esp32-arduino-libs
tools/xtensa-esp-elf
tools/xtensa-esp32-elf
tools/xtensa-esp32s2-elf
tools/xtensa-esp32s3-elf
@ -21,7 +22,7 @@ tools/openocd-esp32
# Ignore build folder
/build
# Ignore files built by Visual Studio/Visual Micro
[Dd]ebug/
[Rr]elease/
@ -44,3 +45,13 @@ debug.cfg
debug.svd
debug_custom.json
libraries/Insights/examples/*/*.ino.zip
# Vale Style
.vale/styles/*
!.vale/styles/Vocab/
.vale/styles/Vocab/*
!.vale/styles/Vocab/Espressif/
# Ignore Lib Builder Docker run scripts
/run.sh
/run.ps1

25
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,25 @@
workflow:
rules:
# Disable those non-protected push triggered pipelines
- if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^\d+\.\d+(\.\d+)?($|-)/ && $CI_PIPELINE_SOURCE == "push"'
when: never
# when running merged result pipelines, CI_COMMIT_SHA represents the temp commit it created.
# Please use PIPELINE_COMMIT_SHA at all places that require a commit sha of the original commit.
- if: $CI_OPEN_MERGE_REQUESTS != null
variables:
PIPELINE_COMMIT_SHA: $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
IS_MR_PIPELINE: 1
- if: $CI_OPEN_MERGE_REQUESTS == null
variables:
PIPELINE_COMMIT_SHA: $CI_COMMIT_SHA
IS_MR_PIPELINE: 0
- if: '$CI_PIPELINE_SOURCE == "schedule"'
variables:
IS_SCHEDULED_RUN: "true"
- when: always
# Place the default settings in `.gitlab/workflows/common.yml` instead
include:
- ".gitlab/workflows/common.yml"
- ".gitlab/workflows/sample.yml"

View file

@ -0,0 +1,26 @@
#####################
# Default Variables #
#####################
stages:
- pre_check
- build
- test
- result
variables:
ESP_IDF_VERSION: "5.5"
ESP_ARDUINO_VERSION: "3.3.0"
#############
# `default` #
#############
default:
retry:
max: 2
when:
# In case of a runner failure we could hop to another one, or a network error could go away.
- runner_system_failure
# Job execution timeout may be caused by a network issue.
- job_execution_timeout

View file

@ -0,0 +1,6 @@
hello-world:
stage: test
script:
- echo "Hello, World from GitLab CI!"
rules:
- if: $CI_PIPELINE_SOURCE == "push"

110
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,110 @@
exclude: |
(?x)(
^\.github\/|
^tests\/performance\/coremark\/.*\.[ch]$|
^tests\/performance\/superpi\/.*\.(cpp|h)$|
LICENSE\.md$
)
default_language_version:
# force all unspecified python hooks to run python3
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b" # v5.0.0
hooks:
# Generic checks
- id: check-case-conflict
- id: check-symlinks
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
exclude: ^.*\.(bin|BIN)$
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
# JSON formatting
- id: pretty-format-json
stages: [manual]
args: [--autofix]
types_or: [json]
exclude: |
(?x)(
diagram\..*\.json$|
package\.json$|
^package\/.*$
)
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: "f6446549e5e97ec9665b9b03e75b87b445857f9a" # v18.1.3
hooks:
# C/C++ formatting
- id: clang-format
types_or: [c, c++]
exclude: ^.*\/build_opt\.h$
- repo: https://github.com/psf/black-pre-commit-mirror
rev: "a4920527036bb9a3f3e6055d595849d67d0da066" # 25.1.0
hooks:
# Python formatting
- id: black
types_or: [python]
args: [--line-length=120] #From the arduino code style. Add as argument rather than creating a new config file.
- repo: https://github.com/PyCQA/flake8
rev: "16f5f28a384f0781bebb37a08aa45e65b9526c50" # 7.2.0
hooks:
# Python linting
- id: flake8
types_or: [python]
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-simplify
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "ffb6a759a979008c0e6dff86e39f4745a2d9eac4" # v3.1.0
hooks:
# YAML formatting
- id: prettier
types_or: [yaml]
- repo: https://github.com/codespell-project/codespell
rev: "63c8f8312b7559622c0d82815639671ae42132ac" # v2.4.1
hooks:
# Spell checking
- id: codespell
exclude: ^.*\.(svd|SVD)$
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "a23f6b85d0fdd5bb9d564e2579e678033debbdff" # v0.10.0.1
hooks:
# Bash linting
- id: shellcheck
types: [shell]
- repo: https://github.com/openstack/bashate
rev: "fbd7c2534c2701351c603ff700ddf08202430a31" # 2.1.1
hooks:
# Bash formatting
- id: bashate
types: [shell]
args: ["-i", "E006"] # Ignore E006: Line too long
- repo: https://github.com/errata-ai/vale
rev: "dc4c47923788a413fb5677de6e3370d514aecb78" # v3.11.2
hooks:
# Sync vale styles and lint markdown and reStructuredText
- id: vale
name: vale-sync
language_version: "1.23.2"
pass_filenames: false
args: [sync]
types_or: [markdown, rst]
- id: vale
language_version: "1.23.2"
types_or: [markdown, rst]

4
.prettierignore Normal file
View file

@ -0,0 +1,4 @@
__pycache__/
.clang-format
.licenses/
/.git/

11
.shellcheckrc Normal file
View file

@ -0,0 +1,11 @@
# Shellcheck configuration file for ESP32 Arduino core
# Optional checks. https://github.com/koalaman/shellcheck/wiki/optional
enable=add-default-case,deprecate-which,avoid-nullary-conditions
# Enable search for external sources
external-sources=true
# Search folder for sourced files.
# Set to the folder where the original script is located.
source-path=SCRIPTDIR

118
.vale.ini Normal file
View file

@ -0,0 +1,118 @@
###################
### Vale Config ###
###################
# This is a Vale linter configuration file.
# - Repo: arduino-esp32
# - Based on Default config: v0-1-1
# It lists all necessary parameters to configure Vale for your project.
# For official documentation on all config settings, see
# https://vale.sh/docs/topics/config
##############
### Global ###
##############
# This section lists core settings applying to Vale itself.
# Specify path to external resources (e.g., styles and vocab files).
# The path value may be absolute or relative to this configuration file.
StylesPath = .vale/styles
# Specify the minimum alert severity that Vale will report.
MinAlertLevel = error # "suggestion", "warning", or "error"
# Specify vocabulary for special treatment.
# Create a folder in <StylesPath>/Vocab/<name>/and add its name here
# The folder should contain two files:
# - accept.txt -- lists words with accepted case-sensitive spelling
# - reject.txt -- lists words whose occurrences throw an error
# Vocab = Espressif
# Specify the packages to import into your project.
# A package is a zip file containing a number of rules (style) written in YAML.
# For a list of official packages, see Package Hub at https://vale.sh/hub/
# For official documentation on packages, see
# https://vale.sh/docs/topics/packages/
# Before linting, navigate to your project and run `vale sync` to download
# the official packages specified below.
# Packages = Package1, Package2, \
# https://example.com/path/to/package/Package.zip
Packages = Google, Microsoft, RedHat, \
https://dl.espressif.com/dl/esp-vale-config/Espressif-latest.zip
###############
### Formats ###
###############
# This section enables association of "unknown" formats with the ones
# supported by Vale. For official documentation on supported formats, see
# https://vale.sh/docs/topics/scoping/
[formats]
# For example, treat MDX files as Markdown files.
# mdx = md
################################
### Format-specific settings ###
################################
# This section lists the settings that apply to specific file formats
# based on their glob pattern.
# Settings provided under a more specific glob pattern,
# such as [*.{md,txt}] will override those in [*].
[*.{md,rst}]
# Enable styles to activate all rules included in them.
# BasedOnStyles = Style1, Style2
BasedOnStyles = Vale, Espressif-latest
### Deactivate individual rules ###
### in enabled styles.
# Style1.Rule1 = NO
Vale.Repetition = NO
Vale.Spelling = NO
Espressif-latest.Admonitions = NO
Espressif-latest.Contractions = NO
Espressif-latest.Monospace = NO
### Change default severity level ###
### of an activated rule.
# Choose between "suggestion", "warning", or "error".
# Style1.Rule2 = error
### Activate individual rules ###
### in non-enabled styles stored in <StylesPath>.
# Style1.Rule = YES
Google.Gender = YES
Google.GenderBias = YES
Google.Slang = YES
Google.Spacing = YES
Microsoft.DateNumbers = YES
Microsoft.Ellipses = YES
Microsoft.FirstPerson = YES
Microsoft.Hyphens = YES
Microsoft.Ordinal = YES
Microsoft.OxfordComma = YES
Microsoft.Percentages = YES
Microsoft.RangeTime = YES
Microsoft.Semicolon = YES
Microsoft.SentenceLength = YES
Microsoft.Suspended = YES
Microsoft.Units = YES
Microsoft.URLFormat = YES
Microsoft.We = YES
Microsoft.Wordiness = YES
RedHat.Contractions = YES
RedHat.RepeatedWords = YES

View file

@ -5,8 +5,8 @@
# export ARDUINO_SKIP_IDF_VERSION_CHECK=1
# idf.py build
set(min_supported_idf_version "5.1.0")
set(max_supported_idf_version "5.1.99")
set(min_supported_idf_version "5.3.0")
set(max_supported_idf_version "5.5.99")
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}")
if ("${idf_version}" AND NOT "$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}")
@ -25,6 +25,7 @@ endif()
set(CORE_SRCS
cores/esp32/base64.cpp
cores/esp32/cbuf.cpp
cores/esp32/ColorFormat.c
cores/esp32/chip-debug-report.cpp
cores/esp32/esp32-hal-adc.c
cores/esp32/esp32-hal-bt.c
@ -32,6 +33,7 @@ set(CORE_SRCS
cores/esp32/esp32-hal-dac.c
cores/esp32/esp32-hal-gpio.c
cores/esp32/esp32-hal-i2c.c
cores/esp32/esp32-hal-i2c-ng.c
cores/esp32/esp32-hal-i2c-slave.c
cores/esp32/esp32-hal-ledc.c
cores/esp32/esp32-hal-matrix.c
@ -45,15 +47,18 @@ set(CORE_SRCS
cores/esp32/esp32-hal-timer.c
cores/esp32/esp32-hal-tinyusb.c
cores/esp32/esp32-hal-touch.c
cores/esp32/esp32-hal-touch-ng.c
cores/esp32/esp32-hal-uart.c
cores/esp32/esp32-hal-rmt.c
cores/esp32/Esp.cpp
cores/esp32/freertos_stats.cpp
cores/esp32/FunctionalInterrupt.cpp
cores/esp32/HardwareSerial.cpp
cores/esp32/HEXBuilder.cpp
cores/esp32/IPAddress.cpp
cores/esp32/libb64/cdecode.c
cores/esp32/libb64/cencode.c
cores/esp32/MacAddress.cpp
cores/esp32/main.cpp
cores/esp32/MD5Builder.cpp
cores/esp32/Print.cpp
@ -82,6 +87,7 @@ set(ARDUINO_ALL_LIBRARIES
DNSServer
EEPROM
ESP_I2S
ESP_NOW
ESP_SR
ESPmDNS
Ethernet
@ -91,7 +97,11 @@ set(ARDUINO_ALL_LIBRARIES
HTTPUpdate
Insights
LittleFS
Matter
NetBIOS
Network
OpenThread
PPP
Preferences
RainMaker
SD_MMC
@ -103,14 +113,14 @@ set(ARDUINO_ALL_LIBRARIES
Update
USB
WebServer
WiFiClientSecure
NetworkClientSecure
WiFi
WiFiProv
Wire
Zigbee
)
set(ARDUINO_LIBRARY_ArduinoOTA_SRCS libraries/ArduinoOTA/src/ArduinoOTA.cpp)
set(ARDUINO_LIBRARY_ArduinoOTA_REQUIRES esp_https_ota)
set(ARDUINO_LIBRARY_AsyncUDP_SRCS libraries/AsyncUDP/src/AsyncUDP.cpp)
@ -125,13 +135,17 @@ set(ARDUINO_LIBRARY_DNSServer_SRCS libraries/DNSServer/src/DNSServer.cpp)
set(ARDUINO_LIBRARY_EEPROM_SRCS libraries/EEPROM/src/EEPROM.cpp)
set(ARDUINO_LIBRARY_ESP_I2S_SRCS libraries/ESP_I2S/src/ESP_I2S.cpp)
set(ARDUINO_LIBRARY_ESP_SR_SRCS
set(ARDUINO_LIBRARY_ESP_NOW_SRCS
libraries/ESP_NOW/src/ESP32_NOW.cpp
libraries/ESP_NOW/src/ESP32_NOW_Serial.cpp)
set(ARDUINO_LIBRARY_ESP_SR_SRCS
libraries/ESP_SR/src/ESP_SR.cpp
libraries/ESP_SR/src/esp32-hal-sr.c)
set(ARDUINO_LIBRARY_ESPmDNS_SRCS libraries/ESPmDNS/src/ESPmDNS.cpp)
set(ARDUINO_LIBRARY_Ethernet_SRCS libraries/Ethernet/src/ETH.cpp)
set(ARDUINO_LIBRARY_FFat_SRCS libraries/FFat/src/FFat.cpp)
@ -150,6 +164,33 @@ set(ARDUINO_LIBRARY_LittleFS_SRCS libraries/LittleFS/src/LittleFS.cpp)
set(ARDUINO_LIBRARY_NetBIOS_SRCS libraries/NetBIOS/src/NetBIOS.cpp)
set(ARDUINO_LIBRARY_OpenThread_SRCS
libraries/OpenThread/src/OThread.cpp
libraries/OpenThread/src/OThreadCLI.cpp
libraries/OpenThread/src/OThreadCLI_Util.cpp)
set(ARDUINO_LIBRARY_Matter_SRCS
libraries/Matter/src/MatterEndpoints/MatterGenericSwitch.cpp
libraries/Matter/src/MatterEndpoints/MatterOnOffLight.cpp
libraries/Matter/src/MatterEndpoints/MatterDimmableLight.cpp
libraries/Matter/src/MatterEndpoints/MatterColorTemperatureLight.cpp
libraries/Matter/src/MatterEndpoints/MatterColorLight.cpp
libraries/Matter/src/MatterEndpoints/MatterEnhancedColorLight.cpp
libraries/Matter/src/MatterEndpoints/MatterFan.cpp
libraries/Matter/src/MatterEndpoints/MatterTemperatureSensor.cpp
libraries/Matter/src/MatterEndpoints/MatterHumiditySensor.cpp
libraries/Matter/src/MatterEndpoints/MatterContactSensor.cpp
libraries/Matter/src/MatterEndpoints/MatterPressureSensor.cpp
libraries/Matter/src/MatterEndpoints/MatterOccupancySensor.cpp
libraries/Matter/src/MatterEndpoints/MatterOnOffPlugin.cpp
libraries/Matter/src/MatterEndpoints/MatterThermostat.cpp
libraries/Matter/src/Matter.cpp
libraries/Matter/src/MatterEndPoint.cpp)
set(ARDUINO_LIBRARY_PPP_SRCS
libraries/PPP/src/PPP.cpp
libraries/PPP/src/ppp.c)
set(ARDUINO_LIBRARY_Preferences_SRCS libraries/Preferences/src/Preferences.cpp)
set(ARDUINO_LIBRARY_RainMaker_SRCS
@ -180,12 +221,22 @@ set(ARDUINO_LIBRARY_Ticker_SRCS libraries/Ticker/src/Ticker.cpp)
set(ARDUINO_LIBRARY_Update_SRCS
libraries/Update/src/Updater.cpp
libraries/Update/src/HttpsOTAUpdate.cpp)
set(ARDUINO_LIBRARY_USB_SRCS
libraries/USB/src/USBHID.cpp
libraries/USB/src/USBMIDI.cpp
libraries/USB/src/USBHIDMouse.cpp
libraries/USB/src/USBHIDKeyboard.cpp
libraries/USB/src/keyboardLayout/KeyboardLayout_da_DK.cpp
libraries/USB/src/keyboardLayout/KeyboardLayout_de_DE.cpp
libraries/USB/src/keyboardLayout/KeyboardLayout_en_US.cpp
libraries/USB/src/keyboardLayout/KeyboardLayout_es_ES.cpp
libraries/USB/src/keyboardLayout/KeyboardLayout_fr_FR.cpp
libraries/USB/src/keyboardLayout/KeyboardLayout_hu_HU.cpp
libraries/USB/src/keyboardLayout/KeyboardLayout_it_IT.cpp
libraries/USB/src/keyboardLayout/KeyboardLayout_pt_BR.cpp
libraries/USB/src/keyboardLayout/KeyboardLayout_pt_PT.cpp
libraries/USB/src/keyboardLayout/KeyboardLayout_sv_SE.cpp
libraries/USB/src/USBHIDGamepad.cpp
libraries/USB/src/USBHIDConsumerControl.cpp
libraries/USB/src/USBHIDSystemControl.cpp
@ -195,28 +246,71 @@ set(ARDUINO_LIBRARY_USB_SRCS
set(ARDUINO_LIBRARY_WebServer_SRCS
libraries/WebServer/src/WebServer.cpp
libraries/WebServer/src/Parsing.cpp
libraries/WebServer/src/detail/mimetable.cpp)
libraries/WebServer/src/detail/mimetable.cpp
libraries/WebServer/src/middleware/MiddlewareChain.cpp
libraries/WebServer/src/middleware/AuthenticationMiddleware.cpp
libraries/WebServer/src/middleware/CorsMiddleware.cpp
libraries/WebServer/src/middleware/LoggingMiddleware.cpp)
set(ARDUINO_LIBRARY_WiFiClientSecure_SRCS
libraries/WiFiClientSecure/src/ssl_client.cpp
libraries/WiFiClientSecure/src/WiFiClientSecure.cpp)
set(ARDUINO_LIBRARY_NetworkClientSecure_SRCS
libraries/NetworkClientSecure/src/ssl_client.cpp
libraries/NetworkClientSecure/src/NetworkClientSecure.cpp)
set(ARDUINO_LIBRARY_Network_SRCS
libraries/Network/src/NetworkInterface.cpp
libraries/Network/src/NetworkEvents.cpp
libraries/Network/src/NetworkManager.cpp
libraries/Network/src/NetworkClient.cpp
libraries/Network/src/NetworkServer.cpp
libraries/Network/src/NetworkUdp.cpp)
set(ARDUINO_LIBRARY_WiFi_SRCS
libraries/WiFi/src/WiFiAP.cpp
libraries/WiFi/src/WiFiClient.cpp
libraries/WiFi/src/WiFi.cpp
libraries/WiFi/src/WiFiGeneric.cpp
libraries/WiFi/src/WiFiMulti.cpp
libraries/WiFi/src/WiFiScan.cpp
libraries/WiFi/src/WiFiServer.cpp
libraries/WiFi/src/WiFiSTA.cpp
libraries/WiFi/src/WiFiUdp.cpp)
libraries/WiFi/src/STA.cpp
libraries/WiFi/src/AP.cpp)
set(ARDUINO_LIBRARY_WiFiProv_SRCS libraries/WiFiProv/src/WiFiProv.cpp)
set(ARDUINO_LIBRARY_Wire_SRCS libraries/Wire/src/Wire.cpp)
set(ARDUINO_LIBRARY_Zigbee_SRCS
libraries/Zigbee/src/ZigbeeCore.cpp
libraries/Zigbee/src/ZigbeeEP.cpp
libraries/Zigbee/src/ZigbeeHandlers.cpp
libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.cpp
libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.cpp
libraries/Zigbee/src/ep/ZigbeeDimmableLight.cpp
libraries/Zigbee/src/ep/ZigbeeLight.cpp
libraries/Zigbee/src/ep/ZigbeeSwitch.cpp
libraries/Zigbee/src/ep/ZigbeeTempSensor.cpp
libraries/Zigbee/src/ep/ZigbeeThermostat.cpp
libraries/Zigbee/src/ep/ZigbeeFlowSensor.cpp
libraries/Zigbee/src/ep/ZigbeePressureSensor.cpp
libraries/Zigbee/src/ep/ZigbeeOccupancySensor.cpp
libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.cpp
libraries/Zigbee/src/ep/ZigbeeContactSwitch.cpp
libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.cpp
libraries/Zigbee/src/ep/ZigbeeWindowCovering.cpp
libraries/Zigbee/src/ep/ZigbeeVibrationSensor.cpp
libraries/Zigbee/src/ep/ZigbeeAnalog.cpp
libraries/Zigbee/src/ep/ZigbeeRangeExtender.cpp
libraries/Zigbee/src/ep/ZigbeeGateway.cpp
libraries/Zigbee/src/ep/ZigbeeWindSpeedSensor.cpp
libraries/Zigbee/src/ep/ZigbeeIlluminanceSensor.cpp
libraries/Zigbee/src/ep/ZigbeePM25Sensor.cpp
libraries/Zigbee/src/ep/ZigbeeElectricalMeasurement.cpp
libraries/Zigbee/src/ep/ZigbeeBinary.cpp
libraries/Zigbee/src/ep/ZigbeePowerOutlet.cpp
libraries/Zigbee/src/ep/ZigbeeFanControl.cpp
)
set(ARDUINO_LIBRARY_BLE_SRCS
libraries/BLE/src/BLE2901.cpp
libraries/BLE/src/BLE2902.cpp
libraries/BLE/src/BLE2904.cpp
libraries/BLE/src/BLEAddress.cpp
@ -268,8 +362,20 @@ endforeach()
set(includedirs variants/${CONFIG_ARDUINO_VARIANT}/ cores/esp32/ ${ARDUINO_LIBRARIES_INCLUDEDIRS})
set(srcs ${CORE_SRCS} ${ARDUINO_LIBRARIES_SRCS})
set(priv_includes cores/esp32/libb64)
set(requires spi_flash esp_partition mbedtls wifi_provisioning wpa_supplicant esp_adc esp_eth http_parser)
set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid ${ARDUINO_LIBRARIES_REQUIRES})
set(requires spi_flash esp_partition mbedtls wpa_supplicant esp_adc esp_eth http_parser esp_ringbuf esp_driver_gptimer esp_driver_usb_serial_jtag driver esp_http_client esp_https_ota)
set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid usb esp_psram ${ARDUINO_LIBRARIES_REQUIRES})
if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_OpenThread)
#if(CONFIG_SOC_IEEE802154_SUPPORTED) # Does not work!
#if(CONFIG_OPENTHREAD_ENABLED) # Does not work!
if(IDF_TARGET STREQUAL "esp32c6" OR IDF_TARGET STREQUAL "esp32h2" OR IDF_TARGET STREQUAL "esp32c5") # Sadly only this works
list(APPEND requires openthread)
endif()
endif()
if(IDF_TARGET STREQUAL "esp32p4")
list(APPEND requires esp_driver_touch_sens)
endif()
idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires})
@ -287,7 +393,7 @@ target_compile_options(${COMPONENT_TARGET} PUBLIC
-DARDUINO_ARCH_ESP32
-DARDUINO_BOARD="${idf_target_caps}_DEV"
-DARDUINO_VARIANT="${CONFIG_ARDUINO_VARIANT}"
-DESP32)
-DESP32=ESP32)
if(CONFIG_AUTOSTART_ARDUINO)
# in autostart mode, arduino-esp32 contains app_main() function and needs to
@ -310,9 +416,21 @@ function(maybe_add_component component_name)
endif()
endfunction()
if(IDF_TARGET MATCHES "esp32s2|esp32s3" AND CONFIG_TINYUSB_ENABLED)
if(IDF_TARGET MATCHES "esp32s2|esp32s3|esp32p4" AND CONFIG_TINYUSB_ENABLED)
maybe_add_component(arduino_tinyusb)
endif()
if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_ArduinoOTA)
maybe_add_component(esp_https_ota)
endif()
if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_ESP_SR)
maybe_add_component(espressif__esp_sr)
endif()
if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_Matter)
maybe_add_component(espressif__esp_matter)
endif()
if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_LittleFS)
maybe_add_component(joltwallet__littlefs)
endif()
if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_WiFiProv)
maybe_add_component(espressif__network_provisioning)
endif()

View file

@ -5,7 +5,7 @@
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
identity and expression, level of experience, education, socioeconomic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

View file

@ -209,7 +209,7 @@ config ARDUHAL_ESP_LOG
default "n"
help
This option will redefine the ESP_LOGx macros to Arduino's log_x macros.
To enable for your application, add the follwing after your includes:
To enable for your application, add the following after your includes:
#ifdef ARDUINO_ARCH_ESP32
#include "esp32-hal-log.h"
#endif
@ -256,119 +256,31 @@ config ARDUINO_SELECTIVE_COMPILATION
bool "Include only specific Arduino libraries"
default n
config ARDUINO_SELECTIVE_ArduinoOTA
bool "Enable ArduinoOTA"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
select ARDUINO_SELECTIVE_ESPmDNS
default y
config ARDUINO_SELECTIVE_AsyncUDP
bool "Enable AsyncUDP"
config ARDUINO_SELECTIVE_SPI
bool "Enable SPI"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_AzureIoT
bool "Enable AzureIoT"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_HTTPClient
default y
config ARDUINO_SELECTIVE_BLE
bool "Enable BLE"
config ARDUINO_SELECTIVE_Wire
bool "Enable Wire"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_BluetoothSerial
bool "Enable BluetoothSerial"
config ARDUINO_SELECTIVE_ESP_SR
bool "Enable ESP-SR"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_DNSServer
bool "Enable DNSServer"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
default y
config ARDUINO_SELECTIVE_EEPROM
bool "Enable EEPROM"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_ESP32
bool "Enable ESP32"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_ESPmDNS
bool "Enable ESPmDNS"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
default y
config ARDUINO_SELECTIVE_FFat
bool "Enable FFat"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_FS
default y
config ARDUINO_SELECTIVE_FS
bool "Enable FS"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_HTTPClient
bool "Enable HTTPClient"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
select ARDUINO_SELECTIVE_WiFiClientSecure
default y
config ARDUINO_SELECTIVE_LITTLEFS
bool "Enable LITTLEFS"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_FS
default y
config ARDUINO_SELECTIVE_NetBIOS
bool "Enable NetBIOS"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
default y
config ARDUINO_SELECTIVE_Preferences
bool "Enable Preferences"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_SD
bool "Enable SD"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_FS
default y
config ARDUINO_SELECTIVE_SD_MMC
bool "Enable SD_MMC"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_FS
default y
config ARDUINO_SELECTIVE_SimpleBLE
bool "Enable SimpleBLE"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_SPI
bool "Enable SPI"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_SPIFFS
bool "Enable SPIFFS"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_FS
default y
config ARDUINO_SELECTIVE_Ticker
bool "Enable Ticker"
depends on ARDUINO_SELECTIVE_COMPILATION
@ -379,34 +291,142 @@ config ARDUINO_SELECTIVE_Update
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_Zigbee
bool "Enable Zigbee"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_FS
bool "Enable FS"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_SD
bool "Enable SD"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_FS
default y
config ARDUINO_SELECTIVE_SD_MMC
bool "Enable SD_MMC"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_FS
default y
config ARDUINO_SELECTIVE_SPIFFS
bool "Enable SPIFFS"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_FS
default y
config ARDUINO_SELECTIVE_FFat
bool "Enable FFat"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_FS
default y
config ARDUINO_SELECTIVE_LittleFS
bool "Enable LittleFS"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_FS
default y
config ARDUINO_SELECTIVE_Network
bool "Enable Networking"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_Ethernet
bool "Enable Ethernet"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_PPP
bool "Enable PPP"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_ArduinoOTA
bool "Enable ArduinoOTA"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network
select ARDUINO_SELECTIVE_ESPmDNS
default y
config ARDUINO_SELECTIVE_AsyncUDP
bool "Enable AsyncUDP"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network
default y
config ARDUINO_SELECTIVE_DNSServer
bool "Enable DNSServer"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network
default y
config ARDUINO_SELECTIVE_ESPmDNS
bool "Enable ESPmDNS"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network
default y
config ARDUINO_SELECTIVE_HTTPClient
bool "Enable HTTPClient"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network
select ARDUINO_SELECTIVE_NetworkClientSecure
default y
config ARDUINO_SELECTIVE_Matter
bool "Enable Matter"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network
default y
config ARDUINO_SELECTIVE_NetBIOS
bool "Enable NetBIOS"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network
default y
config ARDUINO_SELECTIVE_WebServer
bool "Enable WebServer"
depends on ARDUINO_SELECTIVE_COMPILATION
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network
default y
select ARDUINO_SELECTIVE_FS
config ARDUINO_SELECTIVE_WiFi
bool "Enable WiFi"
depends on ARDUINO_SELECTIVE_COMPILATION
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network
default y
config ARDUINO_SELECTIVE_WiFiClientSecure
bool "Enable WiFiClientSecure"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
config ARDUINO_SELECTIVE_NetworkClientSecure
bool "Enable NetworkClientSecure"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network
default y
config ARDUINO_SELECTIVE_WiFiProv
bool "Enable WiFiProv"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network && ARDUINO_SELECTIVE_WiFi
default y
config ARDUINO_SELECTIVE_Wire
bool "Enable Wire"
config ARDUINO_SELECTIVE_BLE
bool "Enable BLE"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_BluetoothSerial
bool "Enable BluetoothSerial"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_SimpleBLE
bool "Enable SimpleBLE"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_RainMaker
bool "Enable RainMaker"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_OpenThread
bool "Enable OpenThread"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
config ARDUINO_SELECTIVE_Insights
bool "Enable Insights"
depends on ARDUINO_SELECTIVE_COMPILATION
default y
endmenu

View file

@ -4,7 +4,7 @@ Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -500,4 +500,4 @@ if necessary. Here is a sample; alter the names:
signature of Ty Coon, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
That's all there is to it!

View file

@ -1,8 +1,13 @@
# Arduino core for the ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 and ESP32-H2
# Arduino core for the ESP32, ESP32-C3, ESP32-C6, ESP32-H2, ESP32-P4, ESP32-S2 and ESP32-S3.
![Build Status](https://github.com/espressif/arduino-esp32/workflows/ESP32%20Arduino%20CI/badge.svg) [![External Libraries Test](https://github.com/espressif/arduino-esp32/actions/workflows/lib.yml/badge.svg?branch=master&event=schedule)](https://github.com/espressif/arduino-esp32/actions/workflows/lib.yml?link=http://https://github.com/espressif/arduino-esp32/blob/master/LIBRARIES_TEST.md)
[![Build Status](https://img.shields.io/github/actions/workflow/status/espressif/arduino-esp32/push.yml?branch=master&event=push&label=Compilation%20Tests)](https://github.com/espressif/arduino-esp32/actions/workflows/push.yml?query=branch%3Amaster+event%3Apush)
[![Verbose Build Status](https://img.shields.io/github/actions/workflow/status/espressif/arduino-esp32/push.yml?branch=master&event=schedule&label=Compilation%20Tests%20(Verbose))](https://github.com/espressif/arduino-esp32/actions/workflows/push.yml?query=branch%3Amaster+event%3Aschedule)
[![External Libraries Test](https://img.shields.io/github/actions/workflow/status/espressif/arduino-esp32/lib.yml?branch=master&event=schedule&label=External%20Libraries%20Test)](https://github.com/espressif/arduino-esp32/blob/gh-pages/LIBRARIES_TEST.md)
[![Runtime Tests](https://github.com/espressif/arduino-esp32/blob/gh-pages/runtime-tests-results/badge.svg)](https://github.com/espressif/arduino-esp32/blob/gh-pages/runtime-tests-results/RUNTIME_TESTS_REPORT.md)
### Need help or have a question? Join the chat at [Gitter](https://gitter.im/espressif/arduino-esp32) or [open a new Discussion](https://github.com/espressif/arduino-esp32/discussions)
### Need help or have a question? Join the chat at [Discord](https://discord.gg/8xY6e9crwv) or [open a new Discussion](https://github.com/espressif/arduino-esp32/discussions)
[![Discord invite](https://img.shields.io/discord/1327272229427216425?logo=discord&logoColor=white&logoSize=auto&label=Discord)](https://discord.gg/8xY6e9crwv)
## Contents
@ -16,9 +21,17 @@
### Development Status
Latest Stable Release [![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Release Date](https://img.shields.io/github/release-date/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Downloads](https://img.shields.io/github/downloads/espressif/arduino-esp32/latest/total.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/)
#### Latest Stable Release
Latest Development Release [![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32/all.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/) [![Release Date](https://img.shields.io/github/release-date-pre/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/) [![Downloads](https://img.shields.io/github/downloads-pre/espressif/arduino-esp32/latest/total.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/)
[![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/)
[![Release Date](https://img.shields.io/github/release-date/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/)
[![Downloads](https://img.shields.io/github/downloads/espressif/arduino-esp32/latest/total.svg)](https://github.com/espressif/arduino-esp32/releases/latest/)
#### Latest Development Release
[![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32/all.svg)](https://github.com/espressif/arduino-esp32/releases/)
[![Release Date](https://img.shields.io/github/release-date-pre/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/)
[![Downloads](https://img.shields.io/github/downloads-pre/espressif/arduino-esp32/latest/total.svg)](https://github.com/espressif/arduino-esp32/releases/)
### Development Planning
@ -54,11 +67,17 @@ Here are the ESP32 series supported by the Arduino-ESP32 project:
| **SoC** | **Stable** | **Development** | **Datasheet** |
|----------|:----------:|:---------------:|:-------------------------------------------------------------------------------------------------:|
| ESP32 | Yes | Yes | [ESP32](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) |
| ESP32-S2 | Yes | Yes | [ESP32-S2](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) |
| ESP32-C3 | Yes | Yes | [ESP32-C3](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) |
| ESP32-C6 | Yes | Yes | [ESP32-C6](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf) |
| ESP32-H2 | Yes | Yes | [ESP32-H2](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf) |
| ESP32-P4 | Yes | Yes | [ESP32-P4](https://www.espressif.com/sites/default/files/documentation/esp32-p4_datasheet_en.pdf) |
| ESP32-S2 | Yes | Yes | [ESP32-S2](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) |
| ESP32-S3 | Yes | Yes | [ESP32-S3](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) |
| ESP32-C6 | No | Yes | [ESP32-C6](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf) |
| ESP32-H2 | No | Yes | [ESP32-H2](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf) |
> [!NOTE]
> ESP32-C2 is also supported by Arduino-ESP32 but requires using Arduino as an ESP-IDF component or rebuilding the static libraries.
> For more information, see the [Arduino as an ESP-IDF component documentation](https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html) or the
> [Lib Builder documentation](https://docs.espressif.com/projects/arduino-esp32/en/latest/lib_builder.html), respectively.
For more details visit the [supported chips](https://docs.espressif.com/projects/arduino-esp32/en/latest/getting_started.html#supported-soc-s) documentation page.
@ -68,7 +87,7 @@ You can use [EspExceptionDecoder](https://github.com/me-no-dev/EspExceptionDecod
### Issue/Bug report template
Before reporting an issue, make sure you've searched for similar one that was already created. Also make sure to go through all the issues labelled as [Type: For reference](https://github.com/espressif/arduino-esp32/issues?q=is%3Aissue+label%3A%22Type%3A+For+reference%22+).
Before reporting an issue, make sure you've searched for similar one that was already created. Also make sure to go through all the issues labeled as [Type: For reference](https://github.com/espressif/arduino-esp32/issues?q=is%3Aissue+label%3A%22Type%3A+For+reference%22+).
Finally, if you are sure no one else had the issue, follow the **Issue template** or **Feature request template** while reporting any [new Issue](https://github.com/espressif/arduino-esp32/issues/new/choose).

19221
boards.txt

File diff suppressed because it is too large Load diff

View file

@ -33,7 +33,6 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "esp32-hal.h"
#include "esp8266-compat.h"
#include "soc/gpio_reg.h"
@ -41,12 +40,15 @@
#include "binary.h"
#include "extra_attr.h"
#define PI 3.1415926535897932384626433832795
#define HALF_PI 1.5707963267948966192313216916398
#define TWO_PI 6.283185307179586476925286766559
#include "pins_arduino.h"
#include "esp32-hal.h"
#define PI 3.1415926535897932384626433832795
#define HALF_PI 1.5707963267948966192313216916398
#define TWO_PI 6.283185307179586476925286766559
#define DEG_TO_RAD 0.017453292519943295769236907684886
#define RAD_TO_DEG 57.295779513082320876798154814105
#define EULER 2.718281828459045235360287471352
#define EULER 2.718281828459045235360287471352
#define SERIAL 0x0
#define DISPLAY 0x1
@ -63,7 +65,7 @@
#define ONLOW_WE 0x0C
#define ONHIGH_WE 0x0D
#define DEFAULT 1
#define DEFAULT 1
#define EXTERNAL 0
#ifndef __STRINGIFY
@ -71,76 +73,79 @@
#endif
// can't define max() / min() because of conflicts with C++
#define _min(a,b) ((a)<(b)?(a):(b))
#define _max(a,b) ((a)>(b)?(a):(b))
#define _abs(x) ((x)>0?(x):-(x)) // abs() comes from STL
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
#define _round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) // round() comes from STL
#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG)
#define sq(x) ((x)*(x))
#define _min(a, b) ((a) < (b) ? (a) : (b))
#define _max(a, b) ((a) > (b) ? (a) : (b))
#define _abs(x) ((x) > 0 ? (x) : -(x)) // abs() comes from STL
#define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
#define _round(x) ((x) >= 0 ? (long)((x) + 0.5) : (long)((x) - 0.5)) // round() comes from STL
#define radians(deg) ((deg) * DEG_TO_RAD)
#define degrees(rad) ((rad) * RAD_TO_DEG)
#define sq(x) ((x) * (x))
// ESP32xx runs FreeRTOS... disabling interrupts can lead to issues, such as Watchdog Timeout
#define sei() portENABLE_INTERRUPTS()
#define cli() portDISABLE_INTERRUPTS()
#define interrupts() sei()
#define sei() portENABLE_INTERRUPTS()
#define cli() portDISABLE_INTERRUPTS()
#define interrupts() sei()
#define noInterrupts() cli()
#define clockCyclesPerMicrosecond() ( (long int)getCpuFrequencyMhz() )
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
#define clockCyclesPerMicrosecond() ((long int)getCpuFrequencyMhz())
#define clockCyclesToMicroseconds(a) ((a) / clockCyclesPerMicrosecond())
#define microsecondsToClockCycles(a) ((a) * clockCyclesPerMicrosecond())
#define lowByte(w) ((uint8_t) ((w) & 0xff))
#define highByte(w) ((uint8_t) ((w) >> 8))
#define lowByte(w) ((uint8_t)((w) & 0xff))
#define highByte(w) ((uint8_t)((w) >> 8))
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
#define bitToggle(value, bit) ((value) ^= (1UL << (bit)))
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
#define bitToggle(value, bit) ((value) ^= (1UL << (bit)))
#define bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet(value, bit) : bitClear(value, bit))
// avr-libc defines _NOP() since 1.6.2
#ifndef _NOP
#define _NOP() do { __asm__ volatile ("nop"); } while (0)
#define _NOP() \
do { \
__asm__ volatile("nop"); \
} while (0)
#endif
#define bit(b) (1UL << (b))
#define _BV(b) (1UL << (b))
#define digitalPinToTimer(pin) (0)
#define analogInPinToBit(P) (P)
#define digitalPinToTimer(pin) (0)
#define analogInPinToBit(P) (P)
#if SOC_GPIO_PIN_COUNT <= 32
#define digitalPinToPort(pin) (0)
#define digitalPinToBitMask(pin) (1UL << digitalPinToGPIONumber(pin))
#define portOutputRegister(port) ((volatile uint32_t*)GPIO_OUT_REG)
#define portInputRegister(port) ((volatile uint32_t*)GPIO_IN_REG)
#define portModeRegister(port) ((volatile uint32_t*)GPIO_ENABLE_REG)
#define digitalPinToPort(pin) (0)
#define digitalPinToBitMask(pin) (1UL << digitalPinToGPIONumber(pin))
#define portOutputRegister(port) ((volatile uint32_t *)GPIO_OUT_REG)
#define portInputRegister(port) ((volatile uint32_t *)GPIO_IN_REG)
#define portModeRegister(port) ((volatile uint32_t *)GPIO_ENABLE_REG)
#elif SOC_GPIO_PIN_COUNT <= 64
#define digitalPinToPort(pin) ((digitalPinToGPIONumber(pin)>31)?1:0)
#define digitalPinToBitMask(pin) (1UL << (digitalPinToGPIONumber(pin)&31))
#define portOutputRegister(port) ((volatile uint32_t*)((port)?GPIO_OUT1_REG:GPIO_OUT_REG))
#define portInputRegister(port) ((volatile uint32_t*)((port)?GPIO_IN1_REG:GPIO_IN_REG))
#define portModeRegister(port) ((volatile uint32_t*)((port)?GPIO_ENABLE1_REG:GPIO_ENABLE_REG))
#define digitalPinToPort(pin) ((digitalPinToGPIONumber(pin) > 31) ? 1 : 0)
#define digitalPinToBitMask(pin) (1UL << (digitalPinToGPIONumber(pin) & 31))
#define portOutputRegister(port) ((volatile uint32_t *)((port) ? GPIO_OUT1_REG : GPIO_OUT_REG))
#define portInputRegister(port) ((volatile uint32_t *)((port) ? GPIO_IN1_REG : GPIO_IN_REG))
#define portModeRegister(port) ((volatile uint32_t *)((port) ? GPIO_ENABLE1_REG : GPIO_ENABLE_REG))
#else
#error SOC_GPIO_PIN_COUNT > 64 not implemented
#endif
#define NOT_A_PIN -1
#define NOT_A_PORT -1
#define NOT_A_PIN -1
#define NOT_A_PORT -1
#define NOT_AN_INTERRUPT -1
#define NOT_ON_TIMER 0
#define NOT_ON_TIMER 0
// some defines generic for all SoC moved from variants/board_name/pins_arduino.h
#define NUM_DIGITAL_PINS SOC_GPIO_PIN_COUNT // All GPIOs
#define NUM_DIGITAL_PINS SOC_GPIO_PIN_COUNT // All GPIOs
#if SOC_ADC_PERIPH_NUM == 1
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0)) // Depends on the SoC (ESP32C6, ESP32H2, ESP32C2, ESP32P4)
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0)) // Depends on the SoC (ESP32C6, ESP32H2, ESP32C2, ESP32P4)
#elif SOC_ADC_PERIPH_NUM == 2
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0)+SOC_ADC_CHANNEL_NUM(1)) // Depends on the SoC (ESP32, ESP32S2, ESP32S3, ESP32C3)
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0) + SOC_ADC_CHANNEL_NUM(1)) // Depends on the SoC (ESP32, ESP32S2, ESP32S3, ESP32C3)
#endif
#define EXTERNAL_NUM_INTERRUPTS NUM_DIGITAL_PINS // All GPIOs
#define analogInputToDigitalPin(p) (((p)<NUM_ANALOG_INPUTS)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) ((((uint8_t)digitalPinToGPIONumber(p))<NUM_DIGITAL_PINS)?digitalPinToGPIONumber(p):NOT_AN_INTERRUPT)
#define digitalPinHasPWM(p) (((uint8_t)digitalPinToGPIONumber(p))<NUM_DIGITAL_PINS)
#define EXTERNAL_NUM_INTERRUPTS NUM_DIGITAL_PINS // All GPIOs
#define analogInputToDigitalPin(p) (((p) < NUM_ANALOG_INPUTS) ? (analogChannelToDigitalPin(p)) : -1)
#define digitalPinToInterrupt(p) ((((uint8_t)digitalPinToGPIONumber(p)) < NUM_DIGITAL_PINS) ? (p) : NOT_AN_INTERRUPT)
#define digitalPinHasPWM(p) (((uint8_t)digitalPinToGPIONumber(p)) < NUM_DIGITAL_PINS)
typedef bool boolean;
typedef uint8_t byte;
@ -150,7 +155,7 @@ typedef unsigned int word;
void setup(void);
void loop(void);
// The default is using Real Hardware random number generator
// The default is using Real Hardware random number generator
// But when randomSeed() is called, it turns to Psedo random
// generator, exactly as done in Arduino mainstream
long random(long);
@ -176,7 +181,7 @@ void initArduino(void);
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder); // codespell:ignore shiftin
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
#ifdef __cplusplus
@ -196,6 +201,7 @@ void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
#include "Udp.h"
#include "HardwareSerial.h"
#include "Esp.h"
#include "freertos_stats.h"
// Use float-compatible stl abs() and round(), we don't use Arduino macros to avoid issues with the C++ libraries
using std::abs;
@ -211,23 +217,33 @@ uint16_t makeWord(uint8_t h, uint8_t l);
#define word(...) makeWord(__VA_ARGS__)
size_t getArduinoLoopTaskStackSize(void);
#define SET_LOOP_TASK_STACK_SIZE(sz) size_t getArduinoLoopTaskStackSize() { return sz;}
#define SET_LOOP_TASK_STACK_SIZE(sz) \
size_t getArduinoLoopTaskStackSize() { \
return sz; \
}
bool shouldPrintChipDebugReport(void);
#define ENABLE_CHIP_DEBUG_REPORT bool shouldPrintChipDebugReport(void){return true;}
#define ENABLE_CHIP_DEBUG_REPORT \
bool shouldPrintChipDebugReport(void) { \
return true; \
}
// allows user to bypass esp_spiram_test()
bool esp_psram_extram_test(void);
#define BYPASS_SPIRAM_TEST(bypass) bool testSPIRAM(void) { if (bypass) return true; else return esp_psram_extram_test(); }
#define BYPASS_SPIRAM_TEST(bypass) \
bool testSPIRAM(void) { \
if (bypass) \
return true; \
else \
return esp_psram_extram_test(); \
}
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
extern "C" bool getLocalTime(struct tm * info, uint32_t ms = 5000);
extern "C" void configTime(long gmtOffset_sec, int daylightOffset_sec,
const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
extern "C" void configTzTime(const char* tz,
const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
extern "C" bool getLocalTime(struct tm *info, uint32_t ms = 5000);
extern "C" void configTime(long gmtOffset_sec, int daylightOffset_sec, const char *server1, const char *server2 = nullptr, const char *server3 = nullptr);
extern "C" void configTzTime(const char *tz, const char *server1, const char *server2 = nullptr, const char *server3 = nullptr);
void setToneChannel(uint8_t channel = 0);
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
@ -235,7 +251,7 @@ void noTone(uint8_t _pin);
#endif /* __cplusplus */
#include "pins_arduino.h"
// must be applied last as it overrides some of the above
#include "io_pin_remap.h"
#endif /* _ESP32_CORE_ARDUINO_H_ */

View file

@ -23,26 +23,25 @@
#include "Stream.h"
#include "IPAddress.h"
class Client: public Stream
{
class Client : public Stream {
public:
virtual int connect(IPAddress ip, uint16_t port) =0;
virtual int connect(const char *host, uint16_t port) =0;
virtual size_t write(uint8_t) =0;
virtual size_t write(const uint8_t *buf, size_t size) =0;
virtual int available() = 0;
virtual int read() = 0;
virtual int read(uint8_t *buf, size_t size) = 0;
virtual int peek() = 0;
virtual void flush() = 0;
virtual void stop() = 0;
virtual uint8_t connected() = 0;
virtual operator bool() = 0;
virtual int connect(IPAddress ip, uint16_t port) = 0;
virtual int connect(const char *host, uint16_t port) = 0;
virtual size_t write(uint8_t) = 0;
virtual size_t write(const uint8_t *buf, size_t size) = 0;
virtual int available() = 0;
virtual int read() = 0;
virtual int read(uint8_t *buf, size_t size) = 0;
virtual int peek() = 0;
virtual void flush() = 0;
virtual void stop() = 0;
virtual uint8_t connected() = 0;
virtual operator bool() = 0;
protected:
uint8_t* rawIPAddress(IPAddress& addr)
{
return addr.raw_address();
}
uint8_t *rawIPAddress(IPAddress &addr) {
return addr.raw_address();
}
};
#endif

281
cores/esp32/ColorFormat.c Normal file
View file

@ -0,0 +1,281 @@
/*
*
* Copyright (c) 2021 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ColorFormat.h"
#include <math.h>
// define a clamp macro to substitute the std::clamp macro which is available from C++17 onwards
#define clamp(a, min, max) ((a) < (min) ? (min) : ((a) > (max) ? (max) : (a)))
const espHsvColor_t HSV_BLACK = {0, 0, 0};
const espHsvColor_t HSV_WHITE = {0, 0, 254};
const espHsvColor_t HSV_RED = {0, 254, 254};
const espHsvColor_t HSV_YELLOW = {42, 254, 254};
const espHsvColor_t HSV_GREEN = {84, 254, 254};
const espHsvColor_t HSV_CYAN = {127, 254, 254};
const espHsvColor_t HSV_BLUE = {169, 254, 254};
const espHsvColor_t HSV_MAGENTA = {211, 254, 254};
const espRgbColor_t RGB_BLACK = {0, 0, 0};
const espRgbColor_t RGB_WHITE = {255, 255, 255};
const espRgbColor_t RGB_RED = {255, 0, 0};
const espRgbColor_t RGB_YELLOW = {255, 255, 0};
const espRgbColor_t RGB_GREEN = {0, 255, 0};
const espRgbColor_t RGB_CYAN = {0, 255, 255};
const espRgbColor_t RGB_BLUE = {0, 0, 255};
const espRgbColor_t RGB_MAGENTA = {255, 0, 255};
// main color temperature values
const espCtColor_t COOL_WHITE_COLOR_TEMPERATURE = {142};
const espCtColor_t DAYLIGHT_WHITE_COLOR_TEMPERATURE = {181};
const espCtColor_t WHITE_COLOR_TEMPERATURE = {250};
const espCtColor_t SOFT_WHITE_COLOR_TEMPERATURE = {370};
const espCtColor_t WARM_WHITE_COLOR_TEMPERATURE = {454};
espRgbColor_t espHsvToRgbColor(uint16_t h, uint8_t s, uint8_t v) {
espHsvColor_t hsv = {h, s, v};
return espHsvColorToRgbColor(hsv);
}
espRgbColor_t espHsvColorToRgbColor(espHsvColor_t hsv) {
espRgbColor_t rgb;
uint8_t region, p, q, t;
uint32_t h, s, v, remainder;
if (hsv.s == 0) {
rgb.r = rgb.g = rgb.b = hsv.v;
} else {
h = hsv.h;
s = hsv.s;
v = hsv.v;
region = h / 43;
remainder = (h - (region * 43)) * 6;
p = (v * (255 - s)) >> 8;
q = (v * (255 - ((s * remainder) >> 8))) >> 8;
t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8;
switch (region) {
case 0: rgb.r = v, rgb.g = t, rgb.b = p; break;
case 1: rgb.r = q, rgb.g = v, rgb.b = p; break;
case 2: rgb.r = p, rgb.g = v, rgb.b = t; break;
case 3: rgb.r = p, rgb.g = q, rgb.b = v; break;
case 4: rgb.r = t, rgb.g = p, rgb.b = v; break;
case 5:
default: rgb.r = v, rgb.g = p, rgb.b = q; break;
}
}
return rgb;
}
espHsvColor_t espRgbToHsvColor(uint8_t r, uint8_t g, uint8_t b) {
espRgbColor_t rgb = {r, g, b};
return espRgbColorToHsvColor(rgb);
}
espHsvColor_t espRgbColorToHsvColor(espRgbColor_t rgb) {
espHsvColor_t hsv;
uint8_t rgbMin, rgbMax;
rgbMin = rgb.r < rgb.g ? (rgb.r < rgb.b ? rgb.r : rgb.b) : (rgb.g < rgb.b ? rgb.g : rgb.b);
rgbMax = rgb.r > rgb.g ? (rgb.r > rgb.b ? rgb.r : rgb.b) : (rgb.g > rgb.b ? rgb.g : rgb.b);
hsv.v = rgbMax;
if (hsv.v == 0) {
hsv.h = 0;
hsv.s = 0;
return hsv;
}
hsv.s = 255 * (rgbMax - rgbMin) / hsv.v;
if (hsv.s == 0) {
hsv.h = 0;
return hsv;
}
if (rgbMax == rgb.r) {
hsv.h = 0 + 43 * (rgb.g - rgb.b) / (rgbMax - rgbMin);
} else if (rgbMax == rgb.g) {
hsv.h = 85 + 43 * (rgb.b - rgb.r) / (rgbMax - rgbMin);
} else {
hsv.h = 171 + 43 * (rgb.r - rgb.g) / (rgbMax - rgbMin);
}
return hsv;
}
espRgbColor_t espXYColorToRgbColor(uint8_t Level, espXyColor_t xy) {
return espXYToRgbColor(Level, xy.x, xy.y, true);
}
espRgbColor_t espXYToRgbColor(uint8_t Level, uint16_t current_X, uint16_t current_Y, bool addXYZScaling) {
// convert xyY color space to RGB
// https://www.easyrgb.com/en/math.php
// https://en.wikipedia.org/wiki/SRGB
// refer https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space
// The current_X/current_Y attribute contains the current value of the normalized chromaticity value of x/y.
// The value of x/y shall be related to the current_X/current_Y attribute by the relationship
// x = current_X/65536
// y = current_Y/65536
// z = 1-x-y
espRgbColor_t rgb;
float x, y, z;
float X, Y, Z;
float r, g, b;
x = ((float)current_X) / 65535.0f;
y = ((float)current_Y) / 65535.0f;
z = 1.0f - x - y;
// Calculate XYZ values
// Y - given brightness in 0 - 1 range
Y = ((float)Level) / 254.0f;
X = (Y / y) * x;
Z = (Y / y) * z;
// X, Y and Z input refer to a D65/2° standard illuminant.
// sR, sG and sB (standard RGB) output range = 0 ÷ 255
// convert XYZ to RGB - CIE XYZ to sRGB
if (addXYZScaling) {
X = X / 100.0f;
Y = Y / 100.0f;
Z = Z / 100.0f;
}
r = (X * 3.2406f) - (Y * 1.5372f) - (Z * 0.4986f);
g = -(X * 0.9689f) + (Y * 1.8758f) + (Z * 0.0415f);
b = (X * 0.0557f) - (Y * 0.2040f) + (Z * 1.0570f);
// apply gamma 2.2 correction
r = (r <= 0.0031308f ? 12.92f * r : (1.055f) * pow(r, (1.0f / 2.4f)) - 0.055f);
g = (g <= 0.0031308f ? 12.92f * g : (1.055f) * pow(g, (1.0f / 2.4f)) - 0.055f);
b = (b <= 0.0031308f ? 12.92f * b : (1.055f) * pow(b, (1.0f / 2.4f)) - 0.055f);
// Round off
r = clamp(r, 0, 1);
g = clamp(g, 0, 1);
b = clamp(b, 0, 1);
// these rgb values are in the range of 0 to 1, convert to limit of HW specific LED
rgb.r = (uint8_t)(r * 255);
rgb.g = (uint8_t)(g * 255);
rgb.b = (uint8_t)(b * 255);
return rgb;
}
espXyColor_t espRgbToXYColor(uint8_t r, uint8_t g, uint8_t b) {
espRgbColor_t rgb = {r, g, b};
return espRgbColorToXYColor(rgb);
}
espXyColor_t espRgbColorToXYColor(espRgbColor_t rgb) {
// convert RGB to xy color space
// https://www.easyrgb.com/en/math.php
// https://en.wikipedia.org/wiki/SRGB
// refer https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space
espXyColor_t xy;
float r, g, b;
float X, Y, Z;
float x, y;
r = ((float)rgb.r) / 255.0f;
g = ((float)rgb.g) / 255.0f;
b = ((float)rgb.b) / 255.0f;
// convert RGB to XYZ - sRGB to CIE XYZ
r = (r <= 0.04045f ? r / 12.92f : pow((r + 0.055f) / 1.055f, 2.4f));
g = (g <= 0.04045f ? g / 12.92f : pow((g + 0.055f) / 1.055f, 2.4f));
b = (b <= 0.04045f ? b / 12.92f : pow((b + 0.055f) / 1.055f, 2.4f));
// https://gist.github.com/popcorn245/30afa0f98eea1c2fd34d
X = r * 0.649926f + g * 0.103455f + b * 0.197109f;
Y = r * 0.234327f + g * 0.743075f + b * 0.022598f;
Z = r * 0.0000000f + g * 0.053077f + b * 1.035763f;
// sR, sG and sB (standard RGB) input range = 0 ÷ 255
// X, Y and Z output refer to a D65/2° standard illuminant.
X = r * 0.4124564f + g * 0.3575761f + b * 0.1804375f;
Y = r * 0.2126729f + g * 0.7151522f + b * 0.0721750f;
Z = r * 0.0193339f + g * 0.1191920f + b * 0.9503041f;
// Calculate xy values
x = X / (X + Y + Z);
y = Y / (X + Y + Z);
// convert to 0-65535 range
xy.x = (uint16_t)(x * 65535);
xy.y = (uint16_t)(y * 65535);
return xy;
}
espRgbColor_t espCTToRgbColor(uint16_t ct) {
espCtColor_t ctColor = {ct};
return espCTColorToRgbColor(ctColor);
}
espRgbColor_t espCTColorToRgbColor(espCtColor_t ct) {
espRgbColor_t rgb = {0, 0, 0};
float r, g, b;
if (ct.ctMireds == 0) {
return rgb;
}
// Algorithm credits to Tanner Helland: https://tannerhelland.com/2012/09/18/convert-temperature-rgb-algorithm-code.html
// Convert Mireds to centiKelvins. k = 1,000,000/mired
float ctCentiKelvin = 10000 / ct.ctMireds;
// Red
if (ctCentiKelvin <= 66) {
r = 255;
} else {
r = 329.698727446f * pow(ctCentiKelvin - 60, -0.1332047592f);
}
// Green
if (ctCentiKelvin <= 66) {
g = 99.4708025861f * log(ctCentiKelvin) - 161.1195681661f;
} else {
g = 288.1221695283f * pow(ctCentiKelvin - 60, -0.0755148492f);
}
// Blue
if (ctCentiKelvin >= 66) {
b = 255;
} else {
if (ctCentiKelvin <= 19) {
b = 0;
} else {
b = 138.5177312231 * log(ctCentiKelvin - 10) - 305.0447927307;
}
}
rgb.r = (uint8_t)clamp(r, 0, 255);
rgb.g = (uint8_t)clamp(g, 0, 255);
rgb.b = (uint8_t)clamp(b, 0, 255);
return rgb;
}

71
cores/esp32/ColorFormat.h Normal file
View file

@ -0,0 +1,71 @@
/*
*
* Copyright (c) 2021 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
struct RgbColor_t {
uint8_t r;
uint8_t g;
uint8_t b;
};
struct HsvColor_t {
uint16_t h;
uint8_t s;
uint8_t v;
};
struct XyColor_t {
uint16_t x;
uint16_t y;
};
struct CtColor_t {
uint16_t ctMireds;
};
typedef struct RgbColor_t espRgbColor_t;
typedef struct HsvColor_t espHsvColor_t;
typedef struct XyColor_t espXyColor_t;
typedef struct CtColor_t espCtColor_t;
espRgbColor_t espXYToRgbColor(uint8_t Level, uint16_t current_X, uint16_t current_Y, bool addXYZScaling);
espRgbColor_t espXYColorToRgb(uint8_t Level, espXyColor_t xy);
espXyColor_t espRgbColorToXYColor(espRgbColor_t rgb);
espXyColor_t espRgbToXYColor(uint8_t r, uint8_t g, uint8_t b);
espRgbColor_t espHsvColorToRgbColor(espHsvColor_t hsv);
espRgbColor_t espHsvToRgbColor(uint16_t h, uint8_t s, uint8_t v);
espRgbColor_t espCTColorToRgbColor(espCtColor_t ct);
espRgbColor_t espCTToRgbColor(uint16_t ct);
espHsvColor_t espRgbColorToHsvColor(espRgbColor_t rgb);
espHsvColor_t espRgbToHsvColor(uint8_t r, uint8_t g, uint8_t b);
extern const espHsvColor_t HSV_BLACK, HSV_WHITE, HSV_RED, HSV_YELLOW, HSV_GREEN, HSV_CYAN, HSV_BLUE, HSV_MAGENTA;
extern const espCtColor_t COOL_WHITE_COLOR_TEMPERATURE, DAYLIGHT_WHITE_COLOR_TEMPERATURE, WHITE_COLOR_TEMPERATURE, SOFT_WHITE_COLOR_TEMPERATURE,
WARM_WHITE_COLOR_TEMPERATURE;
extern const espRgbColor_t RGB_BLACK, RGB_WHITE, RGB_RED, RGB_YELLOW, RGB_GREEN, RGB_CYAN, RGB_BLUE, RGB_MAGENTA;
#ifdef __cplusplus
}
#endif

View file

@ -21,6 +21,7 @@
#include "Esp.h"
#include "esp_sleep.h"
#include "spi_flash_mmap.h"
#include "esp_idf_version.h"
#include <memory>
#include <soc/soc.h>
#include <esp_partition.h>
@ -35,11 +36,11 @@ extern "C" {
#include "esp_chip_info.h"
#include "esp_mac.h"
#include "esp_flash.h"
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
#include "esp32/rom/spi_flash.h"
#include "soc/efuse_reg.h"
#define ESP_FLASH_IMAGE_BASE 0x1000 // Flash offset containing flash size and spi mode
#define ESP_FLASH_IMAGE_BASE 0x1000 // Flash offset containing flash size and spi mode
#elif CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/rom/spi_flash.h"
#include "soc/efuse_reg.h"
@ -47,23 +48,29 @@ extern "C" {
#elif CONFIG_IDF_TARGET_ESP32S3
#include "esp32s3/rom/spi_flash.h"
#include "soc/efuse_reg.h"
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32s3 is located at 0x0000
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32s3 is located at 0x0000
#elif CONFIG_IDF_TARGET_ESP32C2
#include "esp32c2/rom/spi_flash.h"
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c2 is located at 0x0000
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c2 is located at 0x0000
#elif CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/rom/spi_flash.h"
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c3 is located at 0x0000
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c3 is located at 0x0000
#elif CONFIG_IDF_TARGET_ESP32C6
#include "esp32c6/rom/spi_flash.h"
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c6 is located at 0x0000
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c6 is located at 0x0000
#elif CONFIG_IDF_TARGET_ESP32H2
#include "esp32h2/rom/spi_flash.h"
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32h2 is located at 0x0000
#else
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32h2 is located at 0x0000
#elif CONFIG_IDF_TARGET_ESP32P4
#include "esp32p4/rom/spi_flash.h"
#define ESP_FLASH_IMAGE_BASE 0x2000 // Esp32p4 is located at 0x2000
#elif CONFIG_IDF_TARGET_ESP32C5
#include "esp32c5/rom/spi_flash.h"
#define ESP_FLASH_IMAGE_BASE 0x2000 // Esp32c5 is located at 0x2000
#else
#error Target CONFIG_IDF_TARGET is not supported
#endif
#else // ESP32 Before IDF 4.0
#else // ESP32 Before IDF 4.0
#include "rom/spi_flash.h"
#define ESP_FLASH_IMAGE_BASE 0x1000
#endif
@ -71,10 +78,11 @@ extern "C" {
// REG_SPI_BASE is not defined for S3/C3 ??
#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3
#ifndef REG_SPI_BASE
#define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 )))
#endif // REG_SPI_BASE
#endif // TARGET
#ifdef REG_SPI_BASE
#undef REG_SPI_BASE
#endif // REG_SPI_BASE
#define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i) > 1) ? (((i) * 0x1000) + 0x20000) : (((~(i)) & 1) * 0x1000)))
#endif // TARGET
/**
* User-defined Literals
@ -83,323 +91,295 @@ extern "C" {
* uint32_t = test = 10_MHz; // --> 10000000
*/
unsigned long long operator"" _kHz(unsigned long long x)
{
return x * 1000;
unsigned long long operator"" _kHz(unsigned long long x) {
return x * 1000;
}
unsigned long long operator"" _MHz(unsigned long long x)
{
return x * 1000 * 1000;
unsigned long long operator"" _MHz(unsigned long long x) {
return x * 1000 * 1000;
}
unsigned long long operator"" _GHz(unsigned long long x)
{
return x * 1000 * 1000 * 1000;
unsigned long long operator"" _GHz(unsigned long long x) {
return x * 1000 * 1000 * 1000;
}
unsigned long long operator"" _kBit(unsigned long long x)
{
return x * 1024;
unsigned long long operator"" _kBit(unsigned long long x) {
return x * 1024;
}
unsigned long long operator"" _MBit(unsigned long long x)
{
return x * 1024 * 1024;
unsigned long long operator"" _MBit(unsigned long long x) {
return x * 1024 * 1024;
}
unsigned long long operator"" _GBit(unsigned long long x)
{
return x * 1024 * 1024 * 1024;
unsigned long long operator"" _GBit(unsigned long long x) {
return x * 1024 * 1024 * 1024;
}
unsigned long long operator"" _kB(unsigned long long x)
{
return x * 1024;
unsigned long long operator"" _kB(unsigned long long x) {
return x * 1024;
}
unsigned long long operator"" _MB(unsigned long long x)
{
return x * 1024 * 1024;
unsigned long long operator"" _MB(unsigned long long x) {
return x * 1024 * 1024;
}
unsigned long long operator"" _GB(unsigned long long x)
{
return x * 1024 * 1024 * 1024;
unsigned long long operator"" _GB(unsigned long long x) {
return x * 1024 * 1024 * 1024;
}
EspClass ESP;
void EspClass::deepSleep(uint64_t time_us)
{
esp_deep_sleep(time_us);
void EspClass::deepSleep(uint64_t time_us) {
esp_deep_sleep(time_us);
}
void EspClass::restart(void)
{
esp_restart();
void EspClass::restart(void) {
esp_restart();
}
uint32_t EspClass::getHeapSize(void)
{
return heap_caps_get_total_size(MALLOC_CAP_INTERNAL);
uint32_t EspClass::getHeapSize(void) {
return heap_caps_get_total_size(MALLOC_CAP_INTERNAL);
}
uint32_t EspClass::getFreeHeap(void)
{
return heap_caps_get_free_size(MALLOC_CAP_INTERNAL);
uint32_t EspClass::getFreeHeap(void) {
return heap_caps_get_free_size(MALLOC_CAP_INTERNAL);
}
uint32_t EspClass::getMinFreeHeap(void)
{
return heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL);
uint32_t EspClass::getMinFreeHeap(void) {
return heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL);
}
uint32_t EspClass::getMaxAllocHeap(void)
{
return heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL);
uint32_t EspClass::getMaxAllocHeap(void) {
return heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL);
}
uint32_t EspClass::getPsramSize(void)
{
if(psramFound()){
return heap_caps_get_total_size(MALLOC_CAP_SPIRAM);
}
return 0;
uint32_t EspClass::getPsramSize(void) {
if (psramFound()) {
return heap_caps_get_total_size(MALLOC_CAP_SPIRAM);
}
return 0;
}
uint32_t EspClass::getFreePsram(void)
{
if(psramFound()){
return heap_caps_get_free_size(MALLOC_CAP_SPIRAM);
}
return 0;
uint32_t EspClass::getFreePsram(void) {
if (psramFound()) {
return heap_caps_get_free_size(MALLOC_CAP_SPIRAM);
}
return 0;
}
uint32_t EspClass::getMinFreePsram(void)
{
if(psramFound()){
return heap_caps_get_minimum_free_size(MALLOC_CAP_SPIRAM);
}
return 0;
uint32_t EspClass::getMinFreePsram(void) {
if (psramFound()) {
return heap_caps_get_minimum_free_size(MALLOC_CAP_SPIRAM);
}
return 0;
}
uint32_t EspClass::getMaxAllocPsram(void)
{
if(psramFound()){
return heap_caps_get_largest_free_block(MALLOC_CAP_SPIRAM);
}
return 0;
uint32_t EspClass::getMaxAllocPsram(void) {
if (psramFound()) {
return heap_caps_get_largest_free_block(MALLOC_CAP_SPIRAM);
}
return 0;
}
static uint32_t sketchSize(sketchSize_t response) {
esp_image_metadata_t data;
const esp_partition_t *running = esp_ota_get_running_partition();
if (!running) return 0;
const esp_partition_pos_t running_pos = {
.offset = running->address,
.size = running->size,
};
data.start_addr = running_pos.offset;
esp_image_verify(ESP_IMAGE_VERIFY, &running_pos, &data);
if (response) {
return running_pos.size - data.image_len;
} else {
return data.image_len;
}
esp_image_metadata_t data;
const esp_partition_t *running = esp_ota_get_running_partition();
if (!running) {
return 0;
}
const esp_partition_pos_t running_pos = {
.offset = running->address,
.size = running->size,
};
data.start_addr = running_pos.offset;
esp_image_verify(ESP_IMAGE_VERIFY, &running_pos, &data);
if (response) {
return running_pos.size - data.image_len;
} else {
return data.image_len;
}
}
uint32_t EspClass::getSketchSize () {
return sketchSize(SKETCH_SIZE_TOTAL);
uint32_t EspClass::getSketchSize() {
return sketchSize(SKETCH_SIZE_TOTAL);
}
String EspClass::getSketchMD5()
{
static String result;
if (result.length()) {
return result;
}
uint32_t lengthLeft = getSketchSize();
const esp_partition_t *running = esp_ota_get_running_partition();
if (!running) {
log_e("Partition could not be found");
return String();
}
const size_t bufSize = SPI_FLASH_SEC_SIZE;
uint8_t *pb = (uint8_t *)malloc(bufSize);
if(!pb) {
log_e("Not enough memory to allocate buffer");
return String();
}
uint32_t offset = 0;
MD5Builder md5;
md5.begin();
while(lengthLeft > 0) {
size_t readBytes = (lengthLeft < bufSize) ? lengthLeft : bufSize;
if (!ESP.flashRead(running->address + offset, (uint32_t *)pb, (readBytes + 3) & ~3)) {
free(pb);
log_e("Could not read buffer from flash");
return String();
}
md5.add(pb, readBytes);
lengthLeft -= readBytes;
offset += readBytes;
#if CONFIG_FREERTOS_UNICORE
delay(1); // Fix solo WDT
#endif
}
free(pb);
md5.calculate();
result = md5.toString();
String EspClass::getSketchMD5() {
static String result;
if (result.length()) {
return result;
}
}
uint32_t lengthLeft = getSketchSize();
uint32_t EspClass::getFreeSketchSpace () {
const esp_partition_t* _partition = esp_ota_get_next_update_partition(NULL);
if(!_partition){
return 0;
const esp_partition_t *running = esp_ota_get_running_partition();
if (!running) {
log_e("Partition could not be found");
return String();
}
const size_t bufSize = SPI_FLASH_SEC_SIZE;
uint8_t *pb = (uint8_t *)malloc(bufSize);
if (!pb) {
log_e("Not enough memory to allocate buffer");
return String();
}
uint32_t offset = 0;
MD5Builder md5;
md5.begin();
while (lengthLeft > 0) {
size_t readBytes = (lengthLeft < bufSize) ? lengthLeft : bufSize;
if (!ESP.flashRead(running->address + offset, (uint32_t *)pb, (readBytes + 3) & ~3)) {
free(pb);
log_e("Could not read buffer from flash");
return String();
}
md5.add(pb, readBytes);
lengthLeft -= readBytes;
offset += readBytes;
return _partition->size;
#if CONFIG_FREERTOS_UNICORE
delay(1); // Fix solo WDT
#endif
}
free(pb);
md5.calculate();
result = md5.toString();
return result;
}
uint16_t EspClass::getChipRevision(void)
{
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
return chip_info.revision;
uint32_t EspClass::getFreeSketchSpace() {
const esp_partition_t *_partition = esp_ota_get_next_update_partition(NULL);
if (!_partition) {
return 0;
}
return _partition->size;
}
const char * EspClass::getChipModel(void)
{
uint16_t EspClass::getChipRevision(void) {
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
return chip_info.revision;
}
const char *EspClass::getChipModel(void) {
#if CONFIG_IDF_TARGET_ESP32
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_PACKAGE);
uint32_t pkg_ver = chip_ver & 0x7;
switch (pkg_ver) {
case EFUSE_RD_CHIP_VER_PKG_ESP32D0WDQ6 :
if (getChipRevision() == 3)
return "ESP32-D0WDQ6-V3";
else
return "ESP32-D0WDQ6";
case EFUSE_RD_CHIP_VER_PKG_ESP32D0WDQ5 :
if (getChipRevision() == 3)
return "ESP32-D0WD-V3";
else
return "ESP32-D0WD";
case EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 :
return "ESP32-D2WD";
case EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 :
return "ESP32-PICO-D2";
case EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4 :
return "ESP32-PICO-D4";
case EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302 :
return "ESP32-PICO-V3-02";
case EFUSE_RD_CHIP_VER_PKG_ESP32D0WDR2V3 :
return "ESP32-D0WDR2-V3";
default:
return "Unknown";
}
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_PACKAGE);
uint32_t pkg_ver = chip_ver & 0x7;
switch (pkg_ver) {
case EFUSE_RD_CHIP_VER_PKG_ESP32D0WDQ6:
if ((getChipRevision() / 100) == 3) {
return "ESP32-D0WDQ6-V3";
} else {
return "ESP32-D0WDQ6";
}
case EFUSE_RD_CHIP_VER_PKG_ESP32D0WDQ5:
if ((getChipRevision() / 100) == 3) {
return "ESP32-D0WD-V3";
} else {
return "ESP32-D0WD";
}
case EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5: return "ESP32-D2WD";
case EFUSE_RD_CHIP_VER_PKG_ESP32U4WDH: return "ESP32-U4WDH";
case EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4: return "ESP32-PICO-D4";
case EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302: return "ESP32-PICO-V3-02";
case EFUSE_RD_CHIP_VER_PKG_ESP32D0WDR2V3: return "ESP32-D0WDR2-V3";
default: return "Unknown";
}
#elif CONFIG_IDF_TARGET_ESP32S2
uint32_t pkg_ver = REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_3_REG, EFUSE_PKG_VERSION);
switch (pkg_ver) {
case 0:
return "ESP32-S2";
case 1:
return "ESP32-S2FH16";
case 2:
return "ESP32-S2FH32";
default:
return "ESP32-S2 (Unknown)";
}
uint32_t pkg_ver = REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_3_REG, EFUSE_PKG_VERSION);
switch (pkg_ver) {
case 0: return "ESP32-S2";
case 1: return "ESP32-S2FH16";
case 2: return "ESP32-S2FH32";
default: return "ESP32-S2 (Unknown)";
}
#else
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
switch(chip_info.model){
case CHIP_ESP32S3: return "ESP32-S3";
case CHIP_ESP32C3: return "ESP32-C3";
case CHIP_ESP32C2: return "ESP32-C2";
case CHIP_ESP32C6: return "ESP32-C6";
case CHIP_ESP32H2: return "ESP32-H2";
default: return "UNKNOWN";
}
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
switch (chip_info.model) {
case CHIP_ESP32S3: return "ESP32-S3";
case CHIP_ESP32C3: return "ESP32-C3";
case CHIP_ESP32C2: return "ESP32-C2";
case CHIP_ESP32C6: return "ESP32-C6";
case CHIP_ESP32H2: return "ESP32-H2";
case CHIP_ESP32P4: return "ESP32-P4";
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0)
case CHIP_ESP32C5: return "ESP32-C5";
case CHIP_ESP32C61: return "ESP32-C61";
case CHIP_ESP32H21: return "ESP32-H21";
#endif
default: return "UNKNOWN";
}
#endif
}
uint8_t EspClass::getChipCores(void)
{
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
return chip_info.cores;
uint8_t EspClass::getChipCores(void) {
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
return chip_info.cores;
}
const char * EspClass::getSdkVersion(void)
{
return esp_get_idf_version();
const char *EspClass::getSdkVersion(void) {
return esp_get_idf_version();
}
const char * EspClass::getCoreVersion(void)
{
return ESP_ARDUINO_VERSION_STR;
const char *EspClass::getCoreVersion(void) {
return ESP_ARDUINO_VERSION_STR;
}
uint32_t ESP_getFlashChipId(void)
{
uint32_t ESP_getFlashChipId(void) {
uint32_t id = g_rom_flashchip.device_id;
id = ((id & 0xff) << 16) | ((id >> 16) & 0xff) | (id & 0xff00);
return id;
}
uint32_t EspClass::getFlashChipSize(void)
{
uint32_t EspClass::getFlashChipSize(void) {
uint32_t id = (ESP_getFlashChipId() >> 16) & 0xFF;
return 2 << (id - 1);
}
uint32_t EspClass::getFlashChipSpeed(void)
{
esp_image_header_t fhdr;
if(esp_flash_read(esp_flash_default_chip, (void*)&fhdr, ESP_FLASH_IMAGE_BASE, sizeof(esp_image_header_t)) && fhdr.magic != ESP_IMAGE_HEADER_MAGIC) {
return 0;
}
return magicFlashChipSpeed(fhdr.spi_speed);
uint32_t EspClass::getFlashChipSpeed(void) {
esp_image_header_t fhdr;
if (esp_flash_read(esp_flash_default_chip, (void *)&fhdr, ESP_FLASH_IMAGE_BASE, sizeof(esp_image_header_t)) && fhdr.magic != ESP_IMAGE_HEADER_MAGIC) {
return 0;
}
return magicFlashChipSpeed(fhdr.spi_speed);
}
FlashMode_t EspClass::getFlashChipMode(void)
{
#if CONFIG_IDF_TARGET_ESP32S2
uint32_t spi_ctrl = REG_READ(PERIPHS_SPI_FLASH_CTRL);
#else
#if CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C6
uint32_t spi_ctrl = REG_READ(DR_REG_SPI0_BASE + 0x8);
#else
uint32_t spi_ctrl = REG_READ(SPI_CTRL_REG(0));
#endif
#endif
/* Not all of the following constants are already defined in older versions of spi_reg.h, so do it manually for now*/
if (spi_ctrl & BIT(24)) { //SPI_FREAD_QIO
return (FM_QIO);
} else if (spi_ctrl & BIT(20)) { //SPI_FREAD_QUAD
return (FM_QOUT);
} else if (spi_ctrl & BIT(23)) { //SPI_FREAD_DIO
return (FM_DIO);
} else if (spi_ctrl & BIT(14)) { // SPI_FREAD_DUAL
return (FM_DOUT);
} else if (spi_ctrl & BIT(13)) { //SPI_FASTRD_MODE
return (FM_FAST_READ);
} else {
return (FM_SLOW_READ);
}
return (FM_DOUT);
// FIXME for P4
#if !defined(CONFIG_IDF_TARGET_ESP32P4)
FlashMode_t EspClass::getFlashChipMode(void) {
#if CONFIG_IDF_TARGET_ESP32S2
uint32_t spi_ctrl = REG_READ(PERIPHS_SPI_FLASH_CTRL);
#else
#if CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C6
uint32_t spi_ctrl = REG_READ(DR_REG_SPI0_BASE + 0x8);
#else
uint32_t spi_ctrl = REG_READ(SPI_CTRL_REG(0));
#endif
#endif
/* Not all of the following constants are already defined in older versions of spi_reg.h, so do it manually for now*/
if (spi_ctrl & BIT(24)) { //SPI_FREAD_QIO
return (FM_QIO);
} else if (spi_ctrl & BIT(20)) { //SPI_FREAD_QUAD
return (FM_QOUT);
} else if (spi_ctrl & BIT(23)) { //SPI_FREAD_DIO
return (FM_DIO);
} else if (spi_ctrl & BIT(14)) { // SPI_FREAD_DUAL
return (FM_DOUT);
} else if (spi_ctrl & BIT(13)) { //SPI_FASTRD_MODE
return (FM_FAST_READ);
} else {
return (FM_SLOW_READ);
}
return (FM_DOUT);
}
#endif // if !defined(CONFIG_IDF_TARGET_ESP32P4)
uint32_t EspClass::magicFlashChipSize(uint8_t byte)
{
/*
uint32_t EspClass::magicFlashChipSize(uint8_t byte) {
/*
FLASH_SIZES = {
"1MB": 0x00,
"2MB": 0x10,
@ -411,24 +391,23 @@ uint32_t EspClass::magicFlashChipSize(uint8_t byte)
"128MB": 0x70,
}
*/
switch(byte & 0x0F) {
case 0x0: return (1_MB); // 8 MBit (1MB)
case 0x1: return (2_MB); // 16 MBit (2MB)
case 0x2: return (4_MB); // 32 MBit (4MB)
case 0x3: return (8_MB); // 64 MBit (8MB)
case 0x4: return (16_MB); // 128 MBit (16MB)
case 0x5: return (32_MB); // 256 MBit (32MB)
case 0x6: return (64_MB); // 512 MBit (64MB)
case 0x7: return (128_MB); // 1 GBit (128MB)
default: // fail?
return 0;
}
switch (byte & 0x0F) {
case 0x0: return (1_MB); // 8 MBit (1MB)
case 0x1: return (2_MB); // 16 MBit (2MB)
case 0x2: return (4_MB); // 32 MBit (4MB)
case 0x3: return (8_MB); // 64 MBit (8MB)
case 0x4: return (16_MB); // 128 MBit (16MB)
case 0x5: return (32_MB); // 256 MBit (32MB)
case 0x6: return (64_MB); // 512 MBit (64MB)
case 0x7: return (128_MB); // 1 GBit (128MB)
default: // fail?
return 0;
}
}
uint32_t EspClass::magicFlashChipSpeed(uint8_t byte)
{
uint32_t EspClass::magicFlashChipSpeed(uint8_t byte) {
#if CONFIG_IDF_TARGET_ESP32C2
/*
/*
FLASH_FREQUENCY = {
"60m": 0xF,
"30m": 0x0,
@ -436,34 +415,33 @@ uint32_t EspClass::magicFlashChipSpeed(uint8_t byte)
"15m": 0x2,
}
*/
switch(byte & 0x0F) {
case 0xF: return (60_MHz);
case 0x0: return (30_MHz);
case 0x1: return (20_MHz);
case 0x2: return (15_MHz);
default: // fail?
return 0;
}
switch (byte & 0x0F) {
case 0xF: return (60_MHz);
case 0x0: return (30_MHz);
case 0x1: return (20_MHz);
case 0x2: return (15_MHz);
default: // fail?
return 0;
}
#elif CONFIG_IDF_TARGET_ESP32C6
/*
/*
FLASH_FREQUENCY = {
"80m": 0x0, # workaround for wrong mspi HS div value in ROM
"40m": 0x0,
"20m": 0x2,
}
*/
switch(byte & 0x0F) {
case 0x0: return (80_MHz);
case 0x2: return (20_MHz);
default: // fail?
return 0;
}
switch (byte & 0x0F) {
case 0x0: return (80_MHz);
case 0x2: return (20_MHz);
default: // fail?
return 0;
}
#elif CONFIG_IDF_TARGET_ESP32H2
/*
/*
FLASH_FREQUENCY = {
"48m": 0xF,
"24m": 0x0,
@ -471,18 +449,17 @@ uint32_t EspClass::magicFlashChipSpeed(uint8_t byte)
"12m": 0x2,
}
*/
switch(byte & 0x0F) {
case 0xF: return (48_MHz);
case 0x0: return (24_MHz);
case 0x1: return (16_MHz);
case 0x2: return (12_MHz);
default: // fail?
return 0;
}
switch (byte & 0x0F) {
case 0xF: return (48_MHz);
case 0x0: return (24_MHz);
case 0x1: return (16_MHz);
case 0x2: return (12_MHz);
default: // fail?
return 0;
}
#else
/*
/*
FLASH_FREQUENCY = {
"80m": 0xF,
"40m": 0x0,
@ -490,61 +467,52 @@ uint32_t EspClass::magicFlashChipSpeed(uint8_t byte)
"20m": 0x2,
}
*/
switch(byte & 0x0F) {
case 0xF: return (80_MHz);
case 0x0: return (40_MHz);
case 0x1: return (26_MHz);
case 0x2: return (20_MHz);
default: // fail?
return 0;
}
switch (byte & 0x0F) {
case 0xF: return (80_MHz);
case 0x0: return (40_MHz);
case 0x1: return (26_MHz);
case 0x2: return (20_MHz);
default: // fail?
return 0;
}
#endif
}
FlashMode_t EspClass::magicFlashChipMode(uint8_t byte)
{
FlashMode_t mode = (FlashMode_t) byte;
if(mode > FM_SLOW_READ) {
mode = FM_UNKNOWN;
}
return mode;
FlashMode_t EspClass::magicFlashChipMode(uint8_t byte) {
FlashMode_t mode = (FlashMode_t)byte;
if (mode > FM_SLOW_READ) {
mode = FM_UNKNOWN;
}
return mode;
}
bool EspClass::flashEraseSector(uint32_t sector)
{
return esp_flash_erase_region(esp_flash_default_chip, sector * SPI_FLASH_SEC_SIZE, SPI_FLASH_SEC_SIZE) == ESP_OK;
bool EspClass::flashEraseSector(uint32_t sector) {
return esp_flash_erase_region(esp_flash_default_chip, sector * SPI_FLASH_SEC_SIZE, SPI_FLASH_SEC_SIZE) == ESP_OK;
}
// Warning: These functions do not work with encrypted flash
bool EspClass::flashWrite(uint32_t offset, uint32_t *data, size_t size)
{
return esp_flash_write(esp_flash_default_chip, (const void*) data, offset, size) == ESP_OK;
bool EspClass::flashWrite(uint32_t offset, uint32_t *data, size_t size) {
return esp_flash_write(esp_flash_default_chip, (const void *)data, offset, size) == ESP_OK;
}
bool EspClass::flashRead(uint32_t offset, uint32_t *data, size_t size)
{
return esp_flash_read(esp_flash_default_chip, (void*) data, offset, size) == ESP_OK;
bool EspClass::flashRead(uint32_t offset, uint32_t *data, size_t size) {
return esp_flash_read(esp_flash_default_chip, (void *)data, offset, size) == ESP_OK;
}
bool EspClass::partitionEraseRange(const esp_partition_t *partition, uint32_t offset, size_t size)
{
return esp_partition_erase_range(partition, offset, size) == ESP_OK;
bool EspClass::partitionEraseRange(const esp_partition_t *partition, uint32_t offset, size_t size) {
return esp_partition_erase_range(partition, offset, size) == ESP_OK;
}
bool EspClass::partitionWrite(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size)
{
return esp_partition_write(partition, offset, data, size) == ESP_OK;
bool EspClass::partitionWrite(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size) {
return esp_partition_write(partition, offset, data, size) == ESP_OK;
}
bool EspClass::partitionRead(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size)
{
return esp_partition_read(partition, offset, data, size) == ESP_OK;
bool EspClass::partitionRead(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size) {
return esp_partition_read(partition, offset, data, size) == ESP_OK;
}
uint64_t EspClass::getEfuseMac(void)
{
uint64_t _chipmacid = 0LL;
esp_efuse_mac_get_default((uint8_t*) (&_chipmacid));
return _chipmacid;
uint64_t EspClass::getEfuseMac(void) {
uint64_t _chipmacid = 0LL;
esp_efuse_mac_get_default((uint8_t *)(&_chipmacid));
return _chipmacid;
}

View file

@ -26,97 +26,95 @@
#include "esp_cpu.h"
/**
* AVR macros for WDT managment
* AVR macros for WDT management
*/
typedef enum {
WDTO_0MS = 0, //!< WDTO_0MS
WDTO_15MS = 15, //!< WDTO_15MS
WDTO_30MS = 30, //!< WDTO_30MS
WDTO_60MS = 60, //!< WDTO_60MS
WDTO_120MS = 120, //!< WDTO_120MS
WDTO_250MS = 250, //!< WDTO_250MS
WDTO_500MS = 500, //!< WDTO_500MS
WDTO_1S = 1000,//!< WDTO_1S
WDTO_2S = 2000,//!< WDTO_2S
WDTO_4S = 4000,//!< WDTO_4S
WDTO_8S = 8000 //!< WDTO_8S
WDTO_0MS = 0, //!< WDTO_0MS
WDTO_15MS = 15, //!< WDTO_15MS
WDTO_30MS = 30, //!< WDTO_30MS
WDTO_60MS = 60, //!< WDTO_60MS
WDTO_120MS = 120, //!< WDTO_120MS
WDTO_250MS = 250, //!< WDTO_250MS
WDTO_500MS = 500, //!< WDTO_500MS
WDTO_1S = 1000, //!< WDTO_1S
WDTO_2S = 2000, //!< WDTO_2S
WDTO_4S = 4000, //!< WDTO_4S
WDTO_8S = 8000 //!< WDTO_8S
} WDTO_t;
typedef enum {
FM_QIO = 0x00,
FM_QOUT = 0x01,
FM_DIO = 0x02,
FM_DOUT = 0x03,
FM_FAST_READ = 0x04,
FM_SLOW_READ = 0x05,
FM_UNKNOWN = 0xff
FM_QIO = 0x00,
FM_QOUT = 0x01,
FM_DIO = 0x02,
FM_DOUT = 0x03,
FM_FAST_READ = 0x04,
FM_SLOW_READ = 0x05,
FM_UNKNOWN = 0xff
} FlashMode_t;
typedef enum {
SKETCH_SIZE_TOTAL = 0,
SKETCH_SIZE_FREE = 1
SKETCH_SIZE_TOTAL = 0,
SKETCH_SIZE_FREE = 1
} sketchSize_t;
class EspClass
{
class EspClass {
public:
EspClass() {}
~EspClass() {}
void restart();
EspClass() {}
~EspClass() {}
void restart();
//Internal RAM
uint32_t getHeapSize(); //total heap size
uint32_t getFreeHeap(); //available heap
uint32_t getMinFreeHeap(); //lowest level of free heap since boot
uint32_t getMaxAllocHeap(); //largest block of heap that can be allocated at once
//Internal RAM
uint32_t getHeapSize(); //total heap size
uint32_t getFreeHeap(); //available heap
uint32_t getMinFreeHeap(); //lowest level of free heap since boot
uint32_t getMaxAllocHeap(); //largest block of heap that can be allocated at once
//SPI RAM
uint32_t getPsramSize();
uint32_t getFreePsram();
uint32_t getMinFreePsram();
uint32_t getMaxAllocPsram();
//SPI RAM
uint32_t getPsramSize();
uint32_t getFreePsram();
uint32_t getMinFreePsram();
uint32_t getMaxAllocPsram();
uint16_t getChipRevision();
const char * getChipModel();
uint8_t getChipCores();
uint32_t getCpuFreqMHz(){ return getCpuFrequencyMhz(); }
inline uint32_t getCycleCount() __attribute__((always_inline));
uint16_t getChipRevision();
const char *getChipModel();
uint8_t getChipCores();
uint32_t getCpuFreqMHz() {
return getCpuFrequencyMhz();
}
inline uint32_t getCycleCount() __attribute__((always_inline));
const char * getSdkVersion(); //version of ESP-IDF
const char * getCoreVersion();//version of this core
const char *getSdkVersion(); //version of ESP-IDF
const char *getCoreVersion(); //version of this core
void deepSleep(uint64_t time_us);
void deepSleep(uint64_t time_us);
uint32_t getFlashChipSize();
uint32_t getFlashChipSpeed();
FlashMode_t getFlashChipMode();
uint32_t getFlashChipSize();
uint32_t getFlashChipSpeed();
FlashMode_t getFlashChipMode();
uint32_t magicFlashChipSize(uint8_t byte);
uint32_t magicFlashChipSpeed(uint8_t byte);
FlashMode_t magicFlashChipMode(uint8_t byte);
uint32_t magicFlashChipSize(uint8_t byte);
uint32_t magicFlashChipSpeed(uint8_t byte);
FlashMode_t magicFlashChipMode(uint8_t byte);
uint32_t getSketchSize();
String getSketchMD5();
uint32_t getFreeSketchSpace();
uint32_t getSketchSize();
String getSketchMD5();
uint32_t getFreeSketchSpace();
bool flashEraseSector(uint32_t sector);
bool flashWrite(uint32_t offset, uint32_t *data, size_t size);
bool flashRead(uint32_t offset, uint32_t *data, size_t size);
bool flashEraseSector(uint32_t sector);
bool flashWrite(uint32_t offset, uint32_t *data, size_t size);
bool flashRead(uint32_t offset, uint32_t *data, size_t size);
bool partitionEraseRange(const esp_partition_t *partition, uint32_t offset, size_t size);
bool partitionWrite(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size);
bool partitionRead(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size);
uint64_t getEfuseMac();
bool partitionEraseRange(const esp_partition_t *partition, uint32_t offset, size_t size);
bool partitionWrite(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size);
bool partitionRead(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size);
uint64_t getEfuseMac();
};
uint32_t ARDUINO_ISR_ATTR EspClass::getCycleCount()
{
return (uint32_t)esp_cpu_get_cycle_count();
uint32_t ARDUINO_ISR_ATTR EspClass::getCycleCount() {
return (uint32_t)esp_cpu_get_cycle_count();
}
extern EspClass ESP;
#endif //ESP_H
#endif //ESP_H

View file

@ -19,22 +19,22 @@
#include "esp_partition.h"
#include "esp_ota_ops.h"
#include "esp_image_format.h"
#include "esp32-hal.h"
#include "pins_arduino.h"
#include "esp32-hal.h"
#include "firmware_msc_fat.h"
#include "spi_flash_mmap.h"
#ifndef USB_FW_MSC_VENDOR_ID
#define USB_FW_MSC_VENDOR_ID "ESP32" //max 8 chars
#define USB_FW_MSC_VENDOR_ID "ESP32" //max 8 chars
#endif
#ifndef USB_FW_MSC_PRODUCT_ID
#define USB_FW_MSC_PRODUCT_ID "Firmware MSC"//max 16 chars
#define USB_FW_MSC_PRODUCT_ID "Firmware MSC" //max 16 chars
#endif
#ifndef USB_FW_MSC_PRODUCT_REVISION
#define USB_FW_MSC_PRODUCT_REVISION "1.0" //max 4 chars
#define USB_FW_MSC_PRODUCT_REVISION "1.0" //max 4 chars
#endif
#ifndef USB_FW_MSC_VOLUME_NAME
#define USB_FW_MSC_VOLUME_NAME "ESP32-FWMSC" //max 11 chars
#define USB_FW_MSC_VOLUME_NAME "ESP32-FWMSC" //max 11 chars
#endif
#ifndef USB_FW_MSC_SERIAL_NUMBER
#define USB_FW_MSC_SERIAL_NUMBER 0x00000000
@ -45,19 +45,19 @@ esp_err_t arduino_usb_event_post(esp_event_base_t event_base, int32_t event_id,
esp_err_t arduino_usb_event_handler_register_with(esp_event_base_t event_base, int32_t event_id, esp_event_handler_t event_handler, void *event_handler_arg);
//General Variables
static uint8_t * msc_ram_disk = NULL;
static fat_boot_sector_t * msc_boot = NULL;
static uint8_t * msc_table = NULL;
static uint8_t *msc_ram_disk = NULL;
static fat_boot_sector_t *msc_boot = NULL;
static uint8_t *msc_table = NULL;
static uint16_t msc_table_sectors = 0;
static uint16_t msc_total_sectors = 0;
static bool mcs_is_fat16 = false;
//Firmware Read
static const esp_partition_t* msc_run_partition = NULL;
static const esp_partition_t *msc_run_partition = NULL;
static uint16_t fw_start_sector = 0;
static uint16_t fw_end_sector = 0;
static size_t fw_size = 0;
static fat_dir_entry_t * fw_entry = NULL;
static fat_dir_entry_t *fw_entry = NULL;
//Firmware Write
typedef enum {
@ -67,17 +67,17 @@ typedef enum {
MSC_UPDATE_END
} msc_update_state_t;
static const esp_partition_t* msc_ota_partition = NULL;
static const esp_partition_t *msc_ota_partition = NULL;
static msc_update_state_t msc_update_state = MSC_UPDATE_IDLE;
static uint16_t msc_update_start_sector = 0;
static uint32_t msc_update_bytes_written = 0;
static fat_dir_entry_t * msc_update_entry = NULL;
static fat_dir_entry_t *msc_update_entry = NULL;
static uint32_t get_firmware_size(const esp_partition_t* partition){
static uint32_t get_firmware_size(const esp_partition_t *partition) {
esp_image_metadata_t data;
const esp_partition_pos_t running_pos = {
.offset = partition->address,
.size = partition->size,
const esp_partition_pos_t running_pos = {
.offset = partition->address,
.size = partition->size,
};
data.start_addr = running_pos.offset;
esp_image_verify(ESP_IMAGE_VERIFY, &running_pos, &data);
@ -85,19 +85,19 @@ static uint32_t get_firmware_size(const esp_partition_t* partition){
}
//Get number of sectors required based on the size of the firmware and OTA partition
static size_t msc_update_get_required_disk_sectors(){
static size_t msc_update_get_required_disk_sectors() {
size_t data_sectors = 16;
size_t total_sectors = 0;
msc_run_partition = esp_ota_get_running_partition();
msc_ota_partition = esp_ota_get_next_update_partition(NULL);
if(msc_run_partition){
if (msc_run_partition) {
fw_size = get_firmware_size(msc_run_partition);
data_sectors += FAT_SIZE_TO_SECTORS(fw_size);
log_d("APP size: %u (%u sectors)", fw_size, FAT_SIZE_TO_SECTORS(fw_size));
} else {
log_w("APP partition not found. Reading disabled");
}
if(msc_ota_partition){
if (msc_ota_partition) {
data_sectors += FAT_SIZE_TO_SECTORS(msc_ota_partition->size);
log_d("OTA size: %u (%u sectors)", msc_ota_partition->size, FAT_SIZE_TO_SECTORS(msc_ota_partition->size));
} else {
@ -105,7 +105,7 @@ static size_t msc_update_get_required_disk_sectors(){
}
msc_table_sectors = fat_sectors_per_alloc_table(data_sectors, false);
total_sectors = data_sectors + msc_table_sectors + 2;
if(total_sectors > 0xFF4){
if (total_sectors > 0xFF4) {
log_d("USING FAT16");
mcs_is_fat16 = true;
total_sectors -= msc_table_sectors;
@ -123,11 +123,11 @@ static size_t msc_update_get_required_disk_sectors(){
}
//setup the ramdisk and add the firmware download file
static bool msc_update_setup_disk(const char * volume_label, uint32_t serial_number){
static bool msc_update_setup_disk(const char *volume_label, uint32_t serial_number) {
msc_total_sectors = msc_update_get_required_disk_sectors();
uint8_t ram_sectors = msc_table_sectors + 2;
msc_ram_disk = (uint8_t*)calloc(ram_sectors, DISK_SECTOR_SIZE);
if(!msc_ram_disk){
msc_ram_disk = (uint8_t *)calloc(ram_sectors, DISK_SECTOR_SIZE);
if (!msc_ram_disk) {
log_e("Failed to allocate RAM Disk: %u bytes", ram_sectors * DISK_SECTOR_SIZE);
return false;
}
@ -136,14 +136,14 @@ static bool msc_update_setup_disk(const char * volume_label, uint32_t serial_num
msc_boot = fat_add_boot_sector(msc_ram_disk, msc_total_sectors, msc_table_sectors, fat_file_system_type(mcs_is_fat16), volume_label, serial_number);
msc_table = fat_add_table(msc_ram_disk, msc_boot, mcs_is_fat16);
//fat_dir_entry_t * label = fat_add_label(msc_ram_disk, volume_label);
if(msc_run_partition){
if (msc_run_partition) {
fw_entry = fat_add_root_file(msc_ram_disk, 0, "FIRMWARE", "BIN", fw_size, 2, mcs_is_fat16);
fw_end_sector = FAT_SIZE_TO_SECTORS(fw_size) + fw_start_sector;
}
return true;
}
static void msc_update_delete_disk(){
static void msc_update_delete_disk() {
fw_entry = NULL;
fw_size = 0;
fw_end_sector = 0;
@ -163,39 +163,39 @@ static void msc_update_delete_disk(){
}
//filter out entries to only include BINs in the root folder
static fat_dir_entry_t * msc_update_get_root_bin_entry(uint8_t index){
fat_dir_entry_t * entry = (fat_dir_entry_t *)(msc_ram_disk + ((msc_boot->sectors_per_alloc_table+1) * DISK_SECTOR_SIZE) + (index * sizeof(fat_dir_entry_t)));
fat_lfn_entry_t * lfn = (fat_lfn_entry_t*)entry;
static fat_dir_entry_t *msc_update_get_root_bin_entry(uint8_t index) {
fat_dir_entry_t *entry = (fat_dir_entry_t *)(msc_ram_disk + ((msc_boot->sectors_per_alloc_table + 1) * DISK_SECTOR_SIZE) + (index * sizeof(fat_dir_entry_t)));
fat_lfn_entry_t *lfn = (fat_lfn_entry_t *)entry;
//empty entry
if(entry->file_magic == 0){
if (entry->file_magic == 0) {
return NULL;
}
//long file name
if(lfn->attr == 0x0F && lfn->type == 0x00 && lfn->first_cluster == 0x0000){
if (lfn->attr == 0x0F && lfn->type == 0x00 && lfn->first_cluster == 0x0000) {
return NULL;
}
//only files marked as archives
if(entry->file_attr != FAT_FILE_ATTR_ARCHIVE){
if (entry->file_attr != FAT_FILE_ATTR_ARCHIVE) {
return NULL;
}
//deleted
if(entry->file_magic == 0xE5 || entry->file_magic == 0x05){
if (entry->file_magic == 0xE5 || entry->file_magic == 0x05) {
return NULL;
}
//not bins
if(memcmp("BIN", entry->file_extension, 3)){
if (memcmp("BIN", entry->file_extension, 3)) {
return NULL;
}
return entry;
}
//get an empty bin (the host will add an entry for file about to be written with size of zero)
static fat_dir_entry_t * msc_update_find_new_bin(){
for(uint8_t i=16; i;){
static fat_dir_entry_t *msc_update_find_new_bin() {
for (uint8_t i = 16; i;) {
i--;
fat_dir_entry_t * entry = msc_update_get_root_bin_entry(i);
if(entry && entry->file_size == 0){
fat_dir_entry_t *entry = msc_update_get_root_bin_entry(i);
if (entry && entry->file_size == 0) {
return entry;
}
}
@ -203,11 +203,11 @@ static fat_dir_entry_t * msc_update_find_new_bin(){
}
//get a bin starting from particular sector
static fat_dir_entry_t * msc_update_find_bin(uint16_t sector){
for(uint8_t i=16; i; ){
static fat_dir_entry_t *msc_update_find_bin(uint16_t sector) {
for (uint8_t i = 16; i;) {
i--;
fat_dir_entry_t * entry = msc_update_get_root_bin_entry(i);
if(entry && entry->data_start_sector == (sector - msc_boot->sectors_per_alloc_table)){
fat_dir_entry_t *entry = msc_update_get_root_bin_entry(i);
if (entry && entry->data_start_sector == (sector - msc_boot->sectors_per_alloc_table)) {
return entry;
}
}
@ -215,12 +215,12 @@ static fat_dir_entry_t * msc_update_find_bin(uint16_t sector){
}
//write the new data and erase the flash blocks when necessary
static esp_err_t msc_update_write(const esp_partition_t *partition, uint32_t offset, void *data, size_t size){
static esp_err_t msc_update_write(const esp_partition_t *partition, uint32_t offset, void *data, size_t size) {
esp_err_t err = ESP_OK;
if((offset & (SPI_FLASH_SEC_SIZE-1)) == 0){
if ((offset & (SPI_FLASH_SEC_SIZE - 1)) == 0) {
err = esp_partition_erase_range(partition, offset, SPI_FLASH_SEC_SIZE);
log_v("ERASE[0x%08X]: %s", offset, (err != ESP_OK)?"FAIL":"OK");
if(err != ESP_OK){
log_v("ERASE[0x%08X]: %s", offset, (err != ESP_OK) ? "FAIL" : "OK");
if (err != ESP_OK) {
return err;
}
}
@ -228,7 +228,7 @@ static esp_err_t msc_update_write(const esp_partition_t *partition, uint32_t off
}
//called when error was encountered while updating
static void msc_update_error(){
static void msc_update_error() {
log_e("UPDATE_ERROR: %u", msc_update_bytes_written);
arduino_firmware_msc_event_data_t p;
p.error.size = msc_update_bytes_written;
@ -240,16 +240,16 @@ static void msc_update_error(){
}
//called when all firmware bytes have been received
static void msc_update_end(){
static void msc_update_end() {
log_d("UPDATE_END: %u", msc_update_entry->file_size);
msc_update_state = MSC_UPDATE_END;
size_t ota_size = get_firmware_size(msc_ota_partition);
if(ota_size != msc_update_entry->file_size){
if (ota_size != msc_update_entry->file_size) {
log_e("OTA SIZE MISMATCH %u != %u", ota_size, msc_update_entry->file_size);
msc_update_error();
return;
}
if(!ota_size || esp_ota_set_boot_partition(msc_ota_partition) != ESP_OK){
if (!ota_size || esp_ota_set_boot_partition(msc_ota_partition) != ESP_OK) {
log_e("ENABLING OTA PARTITION FAILED");
msc_update_error();
return;
@ -259,47 +259,47 @@ static void msc_update_end(){
arduino_usb_event_post(ARDUINO_FIRMWARE_MSC_EVENTS, ARDUINO_FIRMWARE_MSC_END_EVENT, &p, sizeof(arduino_firmware_msc_event_data_t), portMAX_DELAY);
}
static int32_t msc_write(uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_t bufsize){
static int32_t msc_write(uint32_t lba, uint32_t offset, uint8_t *buffer, uint32_t bufsize) {
//log_d("lba: %u, offset: %u, bufsize: %u", lba, offset, bufsize);
if(lba < fw_start_sector){
if (lba < fw_start_sector) {
//write to sectors that are in RAM
memcpy(msc_ram_disk + (lba * DISK_SECTOR_SIZE) + offset, buffer, bufsize);
if(msc_ota_partition && lba == (fw_start_sector - 1)){
if (msc_ota_partition && lba == (fw_start_sector - 1)) {
//monitor the root folder table
if(msc_update_state <= MSC_UPDATE_RUNNING){
fat_dir_entry_t * update_entry = msc_update_find_new_bin();
if(update_entry) {
if(msc_update_entry) {
if (msc_update_state <= MSC_UPDATE_RUNNING) {
fat_dir_entry_t *update_entry = msc_update_find_new_bin();
if (update_entry) {
if (msc_update_entry) {
log_v("REPLACING ENTRY");
} else {
log_v("ASSIGNING ENTRY");
}
if(msc_update_state <= MSC_UPDATE_STARTING){
if (msc_update_state <= MSC_UPDATE_STARTING) {
msc_update_state = MSC_UPDATE_STARTING;
msc_update_bytes_written = 0;
msc_update_start_sector = 0;
}
msc_update_entry = update_entry;
} else if(msc_update_state == MSC_UPDATE_RUNNING){
if(!msc_update_entry && msc_update_start_sector){
} else if (msc_update_state == MSC_UPDATE_RUNNING) {
if (!msc_update_entry && msc_update_start_sector) {
msc_update_entry = msc_update_find_bin(msc_update_start_sector);
}
if(msc_update_entry && msc_update_bytes_written >= msc_update_entry->file_size){
if (msc_update_entry && msc_update_bytes_written >= msc_update_entry->file_size) {
msc_update_end();
}
}
}
}
} else if(msc_ota_partition && lba >= msc_update_start_sector){
} else if (msc_ota_partition && lba >= msc_update_start_sector) {
//handle writes to the region where the new firmware will be uploaded
arduino_firmware_msc_event_data_t p;
if(msc_update_state <= MSC_UPDATE_STARTING && buffer[0] == 0xE9){
if (msc_update_state <= MSC_UPDATE_STARTING && buffer[0] == 0xE9) {
msc_update_state = MSC_UPDATE_RUNNING;
msc_update_start_sector = lba;
msc_update_bytes_written = 0;
log_d("UPDATE_START: %u (0x%02X)", lba, lba - msc_boot->sectors_per_alloc_table);
arduino_usb_event_post(ARDUINO_FIRMWARE_MSC_EVENTS, ARDUINO_FIRMWARE_MSC_START_EVENT, &p, sizeof(arduino_firmware_msc_event_data_t), portMAX_DELAY);
if(msc_update_write(msc_ota_partition, ((lba - msc_update_start_sector) * DISK_SECTOR_SIZE) + offset, buffer, bufsize) == ESP_OK){
if (msc_update_write(msc_ota_partition, ((lba - msc_update_start_sector) * DISK_SECTOR_SIZE) + offset, buffer, bufsize) == ESP_OK) {
log_v("UPDATE_WRITE: %u %u", ((lba - msc_update_start_sector) * DISK_SECTOR_SIZE) + offset, bufsize);
msc_update_bytes_written = ((lba - msc_update_start_sector) * DISK_SECTOR_SIZE) + offset + bufsize;
p.write.offset = ((lba - msc_update_start_sector) * DISK_SECTOR_SIZE) + offset;
@ -309,17 +309,18 @@ static int32_t msc_write(uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_
msc_update_error();
return 0;
}
} else if(msc_update_state == MSC_UPDATE_RUNNING){
if(msc_update_entry && msc_update_entry->file_size && msc_update_bytes_written < msc_update_entry->file_size && (msc_update_bytes_written + bufsize) >= msc_update_entry->file_size){
} else if (msc_update_state == MSC_UPDATE_RUNNING) {
if (msc_update_entry && msc_update_entry->file_size && msc_update_bytes_written < msc_update_entry->file_size
&& (msc_update_bytes_written + bufsize) >= msc_update_entry->file_size) {
bufsize = msc_update_entry->file_size - msc_update_bytes_written;
}
if(msc_update_write(msc_ota_partition, ((lba - msc_update_start_sector) * DISK_SECTOR_SIZE) + offset, buffer, bufsize) == ESP_OK){
if (msc_update_write(msc_ota_partition, ((lba - msc_update_start_sector) * DISK_SECTOR_SIZE) + offset, buffer, bufsize) == ESP_OK) {
log_v("UPDATE_WRITE: %u %u", ((lba - msc_update_start_sector) * DISK_SECTOR_SIZE) + offset, bufsize);
msc_update_bytes_written = ((lba - msc_update_start_sector) * DISK_SECTOR_SIZE) + offset + bufsize;
p.write.offset = ((lba - msc_update_start_sector) * DISK_SECTOR_SIZE) + offset;
p.write.size = bufsize;
arduino_usb_event_post(ARDUINO_FIRMWARE_MSC_EVENTS, ARDUINO_FIRMWARE_MSC_WRITE_EVENT, &p, sizeof(arduino_firmware_msc_event_data_t), portMAX_DELAY);
if(msc_update_entry && msc_update_entry->file_size && msc_update_bytes_written >= msc_update_entry->file_size){
if (msc_update_entry && msc_update_entry->file_size && msc_update_bytes_written >= msc_update_entry->file_size) {
msc_update_end();
}
} else {
@ -331,13 +332,13 @@ static int32_t msc_write(uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_
return bufsize;
}
static int32_t msc_read(uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize){
static int32_t msc_read(uint32_t lba, uint32_t offset, void *buffer, uint32_t bufsize) {
//log_d("lba: %u, offset: %u, bufsize: %u", lba, offset, bufsize);
if(lba < fw_start_sector){
if (lba < fw_start_sector) {
memcpy(buffer, msc_ram_disk + (lba * DISK_SECTOR_SIZE) + offset, bufsize);
} else if(msc_run_partition && lba < fw_end_sector){
} else if (msc_run_partition && lba < fw_end_sector) {
//read the currently running firmware
if(esp_partition_read(msc_run_partition, ((lba - fw_start_sector) * DISK_SECTOR_SIZE) + offset, buffer, bufsize) != ESP_OK){
if (esp_partition_read(msc_run_partition, ((lba - fw_start_sector) * DISK_SECTOR_SIZE) + offset, buffer, bufsize) != ESP_OK) {
return 0;
}
} else {
@ -346,7 +347,7 @@ static int32_t msc_read(uint32_t lba, uint32_t offset, void* buffer, uint32_t bu
return bufsize;
}
static bool msc_start_stop(uint8_t power_condition, bool start, bool load_eject){
static bool msc_start_stop(uint8_t power_condition, bool start, bool load_eject) {
//log_d("power: %u, start: %u, eject: %u", power_condition, start, load_eject);
arduino_firmware_msc_event_data_t p;
p.power.power_condition = power_condition;
@ -357,9 +358,9 @@ static bool msc_start_stop(uint8_t power_condition, bool start, bool load_eject)
}
static volatile TaskHandle_t msc_task_handle = NULL;
static void msc_task(void *pvParameters){
static void msc_task(void *pvParameters) {
for (;;) {
if(msc_update_state == MSC_UPDATE_END){
if (msc_update_state == MSC_UPDATE_END) {
delay(100);
esp_restart();
}
@ -369,24 +370,24 @@ static void msc_task(void *pvParameters){
vTaskDelete(NULL);
}
FirmwareMSC::FirmwareMSC():msc(){}
FirmwareMSC::FirmwareMSC() : msc() {}
FirmwareMSC::~FirmwareMSC(){
FirmwareMSC::~FirmwareMSC() {
end();
}
bool FirmwareMSC::begin(){
if(msc_ram_disk){
bool FirmwareMSC::begin() {
if (msc_ram_disk) {
return true;
}
if(!msc_update_setup_disk(USB_FW_MSC_VOLUME_NAME, USB_FW_MSC_SERIAL_NUMBER)){
if (!msc_update_setup_disk(USB_FW_MSC_VOLUME_NAME, USB_FW_MSC_SERIAL_NUMBER)) {
return false;
}
if(!msc_task_handle){
xTaskCreateUniversal(msc_task, "msc_disk", 1024, NULL, 2, (TaskHandle_t*)&msc_task_handle, 0);
if(!msc_task_handle){
if (!msc_task_handle) {
xTaskCreateUniversal(msc_task, "msc_disk", 1024, NULL, 2, (TaskHandle_t *)&msc_task_handle, 0);
if (!msc_task_handle) {
msc_update_delete_disk();
return false;
}
@ -403,20 +404,20 @@ bool FirmwareMSC::begin(){
return true;
}
void FirmwareMSC::end(){
void FirmwareMSC::end() {
msc.end();
if(msc_task_handle){
if (msc_task_handle) {
vTaskDelete(msc_task_handle);
msc_task_handle = NULL;
}
msc_update_delete_disk();
}
void FirmwareMSC::onEvent(esp_event_handler_t callback){
onEvent(ARDUINO_FIRMWARE_MSC_ANY_EVENT, callback);
void FirmwareMSC::onEvent(esp_event_handler_t callback) {
onEvent(ARDUINO_FIRMWARE_MSC_ANY_EVENT, callback);
}
void FirmwareMSC::onEvent(arduino_firmware_msc_event_t event, esp_event_handler_t callback){
arduino_usb_event_handler_register_with(ARDUINO_FIRMWARE_MSC_EVENTS, event, callback, this);
void FirmwareMSC::onEvent(arduino_firmware_msc_event_t event, esp_event_handler_t callback) {
arduino_usb_event_handler_register_with(ARDUINO_FIRMWARE_MSC_EVENTS, event, callback, this);
}
#if ARDUINO_USB_MSC_ON_BOOT

View file

@ -23,31 +23,31 @@
ESP_EVENT_DECLARE_BASE(ARDUINO_FIRMWARE_MSC_EVENTS);
typedef enum {
ARDUINO_FIRMWARE_MSC_ANY_EVENT = ESP_EVENT_ANY_ID,
ARDUINO_FIRMWARE_MSC_START_EVENT = 0,
ARDUINO_FIRMWARE_MSC_WRITE_EVENT,
ARDUINO_FIRMWARE_MSC_END_EVENT,
ARDUINO_FIRMWARE_MSC_ERROR_EVENT,
ARDUINO_FIRMWARE_MSC_POWER_EVENT,
ARDUINO_FIRMWARE_MSC_MAX_EVENT,
ARDUINO_FIRMWARE_MSC_ANY_EVENT = ESP_EVENT_ANY_ID,
ARDUINO_FIRMWARE_MSC_START_EVENT = 0,
ARDUINO_FIRMWARE_MSC_WRITE_EVENT,
ARDUINO_FIRMWARE_MSC_END_EVENT,
ARDUINO_FIRMWARE_MSC_ERROR_EVENT,
ARDUINO_FIRMWARE_MSC_POWER_EVENT,
ARDUINO_FIRMWARE_MSC_MAX_EVENT,
} arduino_firmware_msc_event_t;
typedef union {
struct {
size_t offset;
size_t size;
} write;
struct {
uint8_t power_condition;
bool start;
bool load_eject;
} power;
struct {
size_t size;
} end;
struct {
size_t size;
} error;
struct {
size_t offset;
size_t size;
} write;
struct {
uint8_t power_condition;
bool start;
bool load_eject;
} power;
struct {
size_t size;
} end;
struct {
size_t size;
} error;
} arduino_firmware_msc_event_data_t;
class FirmwareMSC {

View file

@ -9,36 +9,26 @@
#include "Arduino.h"
typedef void (*voidFuncPtr)(void);
typedef void (*voidFuncPtrArg)(void*);
typedef void (*voidFuncPtrArg)(void *);
extern "C"
{
extern void __attachInterruptFunctionalArg(uint8_t pin, voidFuncPtrArg userFunc, void * arg, int intr_type, bool functional);
extern "C" {
extern void __attachInterruptFunctionalArg(uint8_t pin, voidFuncPtrArg userFunc, void *arg, int intr_type, bool functional);
}
void ARDUINO_ISR_ATTR interruptFunctional(void* arg)
{
InterruptArgStructure* localArg = (InterruptArgStructure*)arg;
if (localArg->interruptFunction)
{
localArg->interruptFunction();
}
void ARDUINO_ISR_ATTR interruptFunctional(void *arg) {
InterruptArgStructure *localArg = (InterruptArgStructure *)arg;
if (localArg->interruptFunction) {
localArg->interruptFunction();
}
}
void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode)
{
// use the local interrupt routine which takes the ArgStructure as argument
__attachInterruptFunctionalArg (pin, (voidFuncPtrArg)interruptFunctional, new InterruptArgStructure{intRoutine}, mode, true);
void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode) {
// use the local interrupt routine which takes the ArgStructure as argument
__attachInterruptFunctionalArg(pin, (voidFuncPtrArg)interruptFunctional, new InterruptArgStructure{intRoutine}, mode, true);
}
extern "C"
{
void cleanupFunctional(void* arg)
{
delete (InterruptArgStructure*)arg;
}
extern "C" {
void cleanupFunctional(void *arg) {
delete (InterruptArgStructure *)arg;
}
}

View file

@ -12,11 +12,11 @@
#include <stdint.h>
struct InterruptArgStructure {
std::function<void(void)> interruptFunction;
std::function<void(void)> interruptFunction;
};
// The extra set of parentheses here prevents macros defined
// in io_pin_remap.h from applying to this declaration.
void (attachInterrupt)(uint8_t pin, std::function<void(void)> intRoutine, int mode);
void(attachInterrupt)(uint8_t pin, std::function<void(void)> intRoutine, int mode);
#endif /* CORE_CORE_FUNCTIONALINTERRUPT_H_ */

View file

@ -20,52 +20,57 @@
#include <Arduino.h>
#include <HEXBuilder.h>
static uint8_t hex_char_to_byte(uint8_t c)
{
return (c >= 'a' && c <= 'f') ? (c - ((uint8_t)'a' - 0xa)) :
(c >= 'A' && c <= 'F') ? (c - ((uint8_t)'A' - 0xA)) :
(c >= '0' && c<= '9') ? (c - (uint8_t)'0') : 0x10; // unknown char is 16
static uint8_t hex_char_to_byte(uint8_t c) {
return (c >= 'a' && c <= 'f') ? (c - ((uint8_t)'a' - 0xa))
: (c >= 'A' && c <= 'F') ? (c - ((uint8_t)'A' - 0xA))
: (c >= '0' && c <= '9') ? (c - (uint8_t)'0')
: 0x10; // unknown char is 16
}
size_t HEXBuilder::hex2bytes(unsigned char * out, size_t maxlen, String &in) {
return hex2bytes(out, maxlen, in.c_str());
size_t HEXBuilder::hex2bytes(unsigned char *out, size_t maxlen, String &in) {
return hex2bytes(out, maxlen, in.c_str());
}
size_t HEXBuilder::hex2bytes(unsigned char * out, size_t maxlen, const char * in) {
size_t len = 0;
for(;*in;in++) {
uint8_t c = hex_char_to_byte(*in);
// Silently skip anything unknown.
if (c > 15)
continue;
if (len & 1) {
if (len/2 < maxlen)
out[len/2] |= c;
} else {
if (len/2 < maxlen)
out[len/2] = c<<4;
}
len++;
size_t HEXBuilder::hex2bytes(unsigned char *out, size_t maxlen, const char *in) {
size_t len = 0;
for (; *in; in++) {
uint8_t c = hex_char_to_byte(*in);
// Silently skip anything unknown.
if (c > 15) {
continue;
}
return (len + 1)/2;
}
size_t HEXBuilder::bytes2hex(char * out, size_t maxlen, const unsigned char * in, size_t len) {
for(size_t i = 0; i < len; i++) {
if (i*2 + 1 < maxlen) {
sprintf(out + (i * 2), "%02x", in[i]);
}
if (len & 1) {
if (len / 2 < maxlen) {
out[len / 2] |= c;
}
} else {
if (len / 2 < maxlen) {
out[len / 2] = c << 4;
}
}
return len * 2 + 1;
len++;
}
return (len + 1) / 2;
}
String HEXBuilder::bytes2hex(const unsigned char * in, size_t len) {
size_t maxlen = len * 2 + 1;
char * out = (char *) malloc(maxlen);
if (!out) return String();
bytes2hex(out, maxlen, in, len);
String ret = String(out);
free(out);
return ret;
size_t HEXBuilder::bytes2hex(char *out, size_t maxlen, const unsigned char *in, size_t len) {
for (size_t i = 0; i < len; i++) {
if (i * 2 + 1 < maxlen) {
sprintf(out + (i * 2), "%02x", in[i]);
}
}
return len * 2 + 1;
}
String HEXBuilder::bytes2hex(const unsigned char *in, size_t len) {
size_t maxlen = len * 2 + 1;
char *out = (char *)malloc(maxlen);
if (!out) {
return String();
}
bytes2hex(out, maxlen, in, len);
String ret = String(out);
free(out);
return ret;
}

View file

@ -25,10 +25,10 @@
class HEXBuilder {
public:
static size_t hex2bytes(unsigned char * out, size_t maxlen, String & in);
static size_t hex2bytes(unsigned char * out, size_t maxlen, const char * in);
static size_t hex2bytes(unsigned char *out, size_t maxlen, String &in);
static size_t hex2bytes(unsigned char *out, size_t maxlen, const char *in);
static String bytes2hex(const unsigned char * in, size_t len);
static size_t bytes2hex(char * out, size_t maxlen, const unsigned char * in, size_t len);
static String bytes2hex(const unsigned char *in, size_t len);
static size_t bytes2hex(char *out, size_t maxlen, const unsigned char *in, size_t len);
};
#endif

View file

@ -1,4 +1,4 @@
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
// Copyright 2015-2024 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -24,6 +24,7 @@
#include "esp_intr_alloc.h"
#include "soc/periph_defs.h"
#include "soc/io_mux_reg.h"
#include "soc/usb_serial_jtag_struct.h"
#pragma GCC diagnostic ignored "-Wvolatile"
#include "hal/usb_serial_jtag_ll.h"
#pragma GCC diagnostic warning "-Wvolatile"
@ -35,408 +36,577 @@ static RingbufHandle_t tx_ring_buf = NULL;
static QueueHandle_t rx_queue = NULL;
static uint8_t rx_data_buf[64] = {0};
static intr_handle_t intr_handle = NULL;
static volatile bool initial_empty = false;
static SemaphoreHandle_t tx_lock = NULL;
static volatile bool connected = false;
// workaround for when USB CDC is not connected
static uint32_t tx_timeout_ms = 0;
static bool tx_timeout_change_request = false;
// SOF in ISR causes problems for uploading firmware
//static volatile unsigned long lastSOF_ms;
//static volatile uint8_t SOF_TIMEOUT;
// timeout has no effect when USB CDC is unplugged
static uint32_t tx_timeout_ms = 100;
static esp_event_loop_handle_t arduino_hw_cdc_event_loop_handle = NULL;
static esp_err_t arduino_hw_cdc_event_post(esp_event_base_t event_base, int32_t event_id, void *event_data, size_t event_data_size, BaseType_t *task_unblocked){
if(arduino_hw_cdc_event_loop_handle == NULL){
return ESP_FAIL;
}
return esp_event_isr_post_to(arduino_hw_cdc_event_loop_handle, event_base, event_id, event_data, event_data_size, task_unblocked);
static esp_err_t
arduino_hw_cdc_event_post(esp_event_base_t event_base, int32_t event_id, void *event_data, size_t event_data_size, BaseType_t *task_unblocked) {
if (arduino_hw_cdc_event_loop_handle == NULL) {
return ESP_FAIL;
}
return esp_event_isr_post_to(arduino_hw_cdc_event_loop_handle, event_base, event_id, event_data, event_data_size, task_unblocked);
}
static esp_err_t arduino_hw_cdc_event_handler_register_with(esp_event_base_t event_base, int32_t event_id, esp_event_handler_t event_handler, void *event_handler_arg){
if (!arduino_hw_cdc_event_loop_handle) {
esp_event_loop_args_t event_task_args = {
.queue_size = 5,
.task_name = "arduino_hw_cdc_events",
.task_priority = 5,
.task_stack_size = 2048,
.task_core_id = tskNO_AFFINITY
};
if (esp_event_loop_create(&event_task_args, &arduino_hw_cdc_event_loop_handle) != ESP_OK) {
log_e("esp_event_loop_create failed");
}
static esp_err_t
arduino_hw_cdc_event_handler_register_with(esp_event_base_t event_base, int32_t event_id, esp_event_handler_t event_handler, void *event_handler_arg) {
if (!arduino_hw_cdc_event_loop_handle) {
esp_event_loop_args_t event_task_args = {
.queue_size = 5, .task_name = "arduino_hw_cdc_events", .task_priority = 5, .task_stack_size = 2048, .task_core_id = tskNO_AFFINITY
};
if (esp_event_loop_create(&event_task_args, &arduino_hw_cdc_event_loop_handle) != ESP_OK) {
log_e("esp_event_loop_create failed");
}
if(arduino_hw_cdc_event_loop_handle == NULL){
return ESP_FAIL;
}
return esp_event_handler_register_with(arduino_hw_cdc_event_loop_handle, event_base, event_id, event_handler, event_handler_arg);
}
if (arduino_hw_cdc_event_loop_handle == NULL) {
return ESP_FAIL;
}
return esp_event_handler_register_with(arduino_hw_cdc_event_loop_handle, event_base, event_id, event_handler, event_handler_arg);
}
static void hw_cdc_isr_handler(void *arg) {
portBASE_TYPE xTaskWoken = 0;
uint32_t usbjtag_intr_status = 0;
arduino_hw_cdc_event_data_t event = {0};
usbjtag_intr_status = usb_serial_jtag_ll_get_intsts_mask();
portBASE_TYPE xTaskWoken = 0;
uint32_t usbjtag_intr_status = 0;
arduino_hw_cdc_event_data_t event = {0};
usbjtag_intr_status = usb_serial_jtag_ll_get_intsts_mask();
if (usbjtag_intr_status & USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY) {
// Interrupt tells us the host picked up the data we sent.
if (usb_serial_jtag_ll_txfifo_writable() == 1) {
// We disable the interrupt here so that the interrupt won't be triggered if there is no data to send.
usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
if(!initial_empty){
initial_empty = true;
// First time USB is plugged and the application has not explicitly set TX Timeout, set it to default 100ms.
// Otherwise, USB is still unplugged and the timeout will be kept as Zero in order to avoid any delay in the
// application whenever it uses write() and the TX Queue gets full.
if (!tx_timeout_change_request) {
tx_timeout_ms = 100;
}
//send event?
//ets_printf("CONNECTED\n");
arduino_hw_cdc_event_post(ARDUINO_HW_CDC_EVENTS, ARDUINO_HW_CDC_CONNECTED_EVENT, &event, sizeof(arduino_hw_cdc_event_data_t), &xTaskWoken);
}
size_t queued_size;
uint8_t *queued_buff = (uint8_t *)xRingbufferReceiveUpToFromISR(tx_ring_buf, &queued_size, 64);
// If the hardware fifo is avaliable, write in it. Otherwise, do nothing.
if (queued_buff != NULL) { //Although tx_queued_bytes may be larger than 0. We may have interrupt before xRingbufferSend() was called.
//Copy the queued buffer into the TX FIFO
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
usb_serial_jtag_ll_write_txfifo(queued_buff, queued_size);
usb_serial_jtag_ll_txfifo_flush();
vRingbufferReturnItemFromISR(tx_ring_buf, queued_buff, &xTaskWoken);
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
//send event?
//ets_printf("TX:%u\n", queued_size);
event.tx.len = queued_size;
arduino_hw_cdc_event_post(ARDUINO_HW_CDC_EVENTS, ARDUINO_HW_CDC_TX_EVENT, &event, sizeof(arduino_hw_cdc_event_data_t), &xTaskWoken);
}
} else {
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
}
if (usbjtag_intr_status & USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY) {
// Interrupt tells us the host picked up the data we sent.
if (!HWCDC::isPlugged()) {
connected = false;
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
// USB is unplugged, nothing to be done here
return;
} else {
connected = true;
}
if (usbjtag_intr_status & USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT) {
// read rx buffer(max length is 64), and send avaliable data to ringbuffer.
// Ensure the rx buffer size is larger than RX_MAX_SIZE.
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT);
uint32_t rx_fifo_len = usb_serial_jtag_ll_read_rxfifo(rx_data_buf, 64);
uint32_t i=0;
for(i=0; i<rx_fifo_len; i++){
if(rx_queue == NULL || !xQueueSendFromISR(rx_queue, rx_data_buf+i, &xTaskWoken)){
break;
}
if (tx_ring_buf != NULL && usb_serial_jtag_ll_txfifo_writable() == 1) {
// We disable the interrupt here so that the interrupt won't be triggered if there is no data to send.
usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
size_t queued_size = 0;
uint8_t *queued_buff = (uint8_t *)xRingbufferReceiveUpToFromISR(tx_ring_buf, &queued_size, 64);
// If the hardware fifo is available, write in it. Otherwise, do nothing.
if (queued_buff != NULL) { //Although tx_queued_bytes may be larger than 0. We may have interrupt before xRingbufferSend() was called.
//Copy the queued buffer into the TX FIFO
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
usb_serial_jtag_ll_write_txfifo(queued_buff, queued_size);
usb_serial_jtag_ll_txfifo_flush();
vRingbufferReturnItemFromISR(tx_ring_buf, queued_buff, &xTaskWoken);
if (connected) {
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
}
//send event?
//ets_printf("RX:%u/%u\n", i, rx_fifo_len);
event.rx.len = i;
arduino_hw_cdc_event_post(ARDUINO_HW_CDC_EVENTS, ARDUINO_HW_CDC_RX_EVENT, &event, sizeof(arduino_hw_cdc_event_data_t), &xTaskWoken);
//ets_printf("TX:%u\n", queued_size);
event.tx.len = queued_size;
arduino_hw_cdc_event_post(ARDUINO_HW_CDC_EVENTS, ARDUINO_HW_CDC_TX_EVENT, &event, sizeof(arduino_hw_cdc_event_data_t), &xTaskWoken);
}
} else {
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
}
}
if (usbjtag_intr_status & USB_SERIAL_JTAG_INTR_BUS_RESET) {
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_BUS_RESET);
initial_empty = false;
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
//ets_printf("BUS_RESET\n");
arduino_hw_cdc_event_post(ARDUINO_HW_CDC_EVENTS, ARDUINO_HW_CDC_BUS_RESET_EVENT, &event, sizeof(arduino_hw_cdc_event_data_t), &xTaskWoken);
if (usbjtag_intr_status & USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT) {
// read rx buffer(max length is 64), and send available data to ringbuffer.
// Ensure the rx buffer size is larger than RX_MAX_SIZE.
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT);
uint32_t rx_fifo_len = usb_serial_jtag_ll_read_rxfifo(rx_data_buf, 64);
uint32_t i = 0;
for (i = 0; i < rx_fifo_len; i++) {
if (rx_queue == NULL || !xQueueSendFromISR(rx_queue, rx_data_buf + i, &xTaskWoken)) {
break;
}
}
event.rx.len = i;
arduino_hw_cdc_event_post(ARDUINO_HW_CDC_EVENTS, ARDUINO_HW_CDC_RX_EVENT, &event, sizeof(arduino_hw_cdc_event_data_t), &xTaskWoken);
connected = true;
}
if (xTaskWoken == pdTRUE) {
portYIELD_FROM_ISR();
if (usbjtag_intr_status & USB_SERIAL_JTAG_INTR_BUS_RESET) {
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_BUS_RESET);
arduino_hw_cdc_event_post(ARDUINO_HW_CDC_EVENTS, ARDUINO_HW_CDC_BUS_RESET_EVENT, &event, sizeof(arduino_hw_cdc_event_data_t), &xTaskWoken);
connected = false;
}
// SOF ISR is causing esptool to be unable to upload firmware to the board
// if (usbjtag_intr_status & USB_SERIAL_JTAG_INTR_SOF) {
// usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SOF);
// lastSOF_ms = millis();
// }
if (xTaskWoken == pdTRUE) {
portYIELD_FROM_ISR();
}
}
// Moved to header file as inline function. Kept just as future reference.
//inline bool HWCDC::isPlugged(void) {
// SOF ISR is causing esptool to be unable to upload firmware to the board
// Timer test for SOF seems to work when uploading firmware
// return usb_serial_jtag_is_connected();//(lastSOF_ms + SOF_TIMEOUT) >= millis();
//}
bool HWCDC::isCDC_Connected() {
static bool running = false;
// USB may be unplugged
if (!isPlugged()) {
connected = false;
running = false;
// SOF in ISR causes problems for uploading firmware
//SOF_TIMEOUT = 5; // SOF timeout when unplugged
return false;
}
//else {
// SOF_TIMEOUT = 50; // SOF timeout when plugged
//}
if (connected) {
running = false;
return true;
}
if (running == false && !connected) { // enables it only once!
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
}
// this will feed CDC TX FIFO to trigger IN_EMPTY
usb_serial_jtag_ll_txfifo_flush();
running = true;
return false;
}
static void flushTXBuffer(const uint8_t *buffer, size_t size) {
if (!tx_ring_buf) {
return;
}
UBaseType_t uxItemsWaiting = 0;
vRingbufferGetInfo(tx_ring_buf, NULL, NULL, NULL, NULL, &uxItemsWaiting);
size_t freeSpace = xRingbufferGetCurFreeSize(tx_ring_buf);
size_t ringbufferLength = freeSpace + uxItemsWaiting;
if (buffer == NULL) {
// just flush the whole ring buffer and exit - used by HWCDC::flush()
size_t queued_size = 0;
uint8_t *queued_buff = (uint8_t *)xRingbufferReceiveUpTo(tx_ring_buf, &queued_size, 0, ringbufferLength);
if (queued_size && queued_buff != NULL) {
vRingbufferReturnItem(tx_ring_buf, (void *)queued_buff);
}
return;
}
if (size == 0) {
return; // nothing to do
}
if (freeSpace >= size) {
// there is enough space, just add the data to the ring buffer
if (xRingbufferSend(tx_ring_buf, (void *)buffer, size, 0) != pdTRUE) {
return;
}
} else {
// how many byte should be flushed to make space for the new data
size_t to_flush = size - freeSpace;
if (to_flush > ringbufferLength) {
to_flush = ringbufferLength;
}
size_t queued_size = 0;
uint8_t *queued_buff = (uint8_t *)xRingbufferReceiveUpTo(tx_ring_buf, &queued_size, 0, to_flush);
if (queued_size && queued_buff != NULL) {
vRingbufferReturnItem(tx_ring_buf, (void *)queued_buff);
}
// now add the new data that fits into the ring buffer
uint8_t *bptr = (uint8_t *)buffer;
if (size >= ringbufferLength) {
size = ringbufferLength;
bptr = (uint8_t *)buffer + (size - ringbufferLength);
}
if (xRingbufferSend(tx_ring_buf, (void *)bptr, size, 0) != pdTRUE) {
return;
}
}
// flushes CDC FIFO
usb_serial_jtag_ll_txfifo_flush();
}
static void ARDUINO_ISR_ATTR cdc0_write_char(char c) {
if(xPortInIsrContext()){
xRingbufferSendFromISR(tx_ring_buf, (void*) (&c), 1, NULL);
} else {
xRingbufferSend(tx_ring_buf, (void*) (&c), 1, tx_timeout_ms / portTICK_PERIOD_MS);
}
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
if (tx_ring_buf == NULL) {
return;
}
if (!HWCDC::isConnected()) {
// just pop/push RingBuffer and apply FIFO policy
flushTXBuffer((const uint8_t *)&c, 1);
return;
}
if (xPortInIsrContext()) {
xRingbufferSendFromISR(tx_ring_buf, (void *)(&c), 1, NULL);
} else {
xRingbufferSend(tx_ring_buf, (void *)(&c), 1, tx_timeout_ms / portTICK_PERIOD_MS);
}
usb_serial_jtag_ll_txfifo_flush();
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
}
HWCDC::HWCDC() {
perimanSetBusDeinit(ESP32_BUS_TYPE_USB_DM, HWCDC::deinit);
perimanSetBusDeinit(ESP32_BUS_TYPE_USB_DP, HWCDC::deinit);
// SOF in ISR causes problems for uploading firmware
// lastSOF_ms = 0;
// SOF_TIMEOUT = 5;
}
HWCDC::~HWCDC(){
HWCDC::~HWCDC() {
end();
}
// It should return <true> just when USB is plugged and CDC is connected.
HWCDC::operator bool() const {
return HWCDC::isCDC_Connected();
}
void HWCDC::onEvent(esp_event_handler_t callback) {
onEvent(ARDUINO_HW_CDC_ANY_EVENT, callback);
}
void HWCDC::onEvent(arduino_hw_cdc_event_t event, esp_event_handler_t callback) {
arduino_hw_cdc_event_handler_register_with(ARDUINO_HW_CDC_EVENTS, event, callback, this);
}
bool HWCDC::deinit(void *busptr) {
// avoid any recursion issue with Peripheral Manager perimanSetPinBus() call
static bool running = false;
if (running) {
return true;
}
running = true;
// Setting USB D+ D- pins
bool retCode = true;
retCode &= perimanClearPinBus(USB_INT_PHY0_DM_GPIO_NUM);
retCode &= perimanClearPinBus(USB_INT_PHY0_DP_GPIO_NUM);
if (retCode) {
// Force the host to re-enumerate (BUS_RESET)
pinMode(USB_INT_PHY0_DM_GPIO_NUM, OUTPUT_OPEN_DRAIN);
pinMode(USB_INT_PHY0_DP_GPIO_NUM, OUTPUT_OPEN_DRAIN);
digitalWrite(USB_INT_PHY0_DM_GPIO_NUM, LOW);
digitalWrite(USB_INT_PHY0_DP_GPIO_NUM, LOW);
}
// release the flag
running = false;
return retCode;
}
void HWCDC::begin(unsigned long baud) {
if (tx_lock == NULL) {
tx_lock = xSemaphoreCreateMutex();
}
//RX Buffer default has 256 bytes if not preset
if (rx_queue == NULL) {
if (!setRxBufferSize(256)) {
log_e("HW CDC RX Buffer error");
}
}
//TX Buffer default has 256 bytes if not preset
if (tx_ring_buf == NULL) {
if (!setTxBufferSize(256)) {
log_e("HW CDC TX Buffer error");
}
}
// the HW Serial pins needs to be first deinited in order to allow `if(Serial)` to work :-(
// But this is also causing terminal to hang, so they are disabled
// deinit(NULL);
// delay(10); // USB Host has to enumerate it again
// Peripheral Manager setting for USB D+ D- pins
uint8_t pin = USB_INT_PHY0_DM_GPIO_NUM;
if (!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DM, (void *)this, -1, -1)) {
goto err;
}
pin = USB_INT_PHY0_DP_GPIO_NUM;
if (!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DP, (void *)this, -1, -1)) {
goto err;
}
// Configure PHY
// USB_Serial_JTAG use internal PHY
USB_SERIAL_JTAG.conf0.phy_sel = 0;
// Disable software control USB D+ D- pullup pulldown (Device FS: dp_pullup = 1)
USB_SERIAL_JTAG.conf0.pad_pull_override = 0;
// Enable USB D+ pullup
USB_SERIAL_JTAG.conf0.dp_pullup = 1;
// Enable USB pad function
USB_SERIAL_JTAG.conf0.usb_pad_enable = 1;
usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_LL_INTR_MASK);
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY | USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT | USB_SERIAL_JTAG_INTR_BUS_RESET);
// SOF ISR is causing esptool to be unable to upload firmware to the board
// usb_serial_jtag_ll_ena_intr_mask(
// USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY | USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT | USB_SERIAL_JTAG_INTR_BUS_RESET | USB_SERIAL_JTAG_INTR_SOF
// );
if (!intr_handle && esp_intr_alloc(ETS_USB_SERIAL_JTAG_INTR_SOURCE, 0, hw_cdc_isr_handler, NULL, &intr_handle) != ESP_OK) {
isr_log_e("HW USB CDC failed to init interrupts");
end();
return;
}
return;
err:
log_e("Serial JTAG Pin %u can't be set into Peripheral Manager.", pin);
end();
}
HWCDC::operator bool() const
{
return initial_empty;
void HWCDC::end() {
//Disable/clear/free tx/rx interrupt.
usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_LL_INTR_MASK);
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_LL_INTR_MASK);
esp_intr_free(intr_handle);
intr_handle = NULL;
if (tx_lock != NULL) {
vSemaphoreDelete(tx_lock);
tx_lock = NULL;
}
setRxBufferSize(0);
setTxBufferSize(0);
if (arduino_hw_cdc_event_loop_handle) {
esp_event_loop_delete(arduino_hw_cdc_event_loop_handle);
arduino_hw_cdc_event_loop_handle = NULL;
}
HWCDC::deinit(this);
setDebugOutput(false);
connected = false;
}
void HWCDC::onEvent(esp_event_handler_t callback){
onEvent(ARDUINO_HW_CDC_ANY_EVENT, callback);
}
void HWCDC::onEvent(arduino_hw_cdc_event_t event, esp_event_handler_t callback){
arduino_hw_cdc_event_handler_register_with(ARDUINO_HW_CDC_EVENTS, event, callback, this);
}
bool HWCDC::deinit(void * busptr)
{
// avoid any recursion issue with Peripheral Manager perimanSetPinBus() call
static bool running = false;
if (running) return true;
running = true;
// Setting USB D+ D- pins
bool retCode = true;
retCode &= perimanClearPinBus(USB_DM_GPIO_NUM);
retCode &= perimanClearPinBus(USB_DP_GPIO_NUM);
if (retCode) {
// Force the host to re-enumerate (BUS_RESET)
pinMode(USB_DM_GPIO_NUM, OUTPUT_OPEN_DRAIN);
pinMode(USB_DP_GPIO_NUM, OUTPUT_OPEN_DRAIN);
digitalWrite(USB_DM_GPIO_NUM, LOW);
digitalWrite(USB_DP_GPIO_NUM, LOW);
}
// release the flag
running = false;
return retCode;
}
void HWCDC::begin(unsigned long baud)
{
if(tx_lock == NULL) {
tx_lock = xSemaphoreCreateMutex();
}
//RX Buffer default has 256 bytes if not preset
if(rx_queue == NULL) {
if (!setRxBufferSize(256)) {
log_e("HW CDC RX Buffer error");
}
}
//TX Buffer default has 256 bytes if not preset
if (tx_ring_buf == NULL) {
if (!setTxBufferSize(256)) {
log_e("HW CDC TX Buffer error");
}
}
usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_LL_INTR_MASK);
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_LL_INTR_MASK);
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY | USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT | USB_SERIAL_JTAG_INTR_BUS_RESET);
if(!intr_handle && esp_intr_alloc(ETS_USB_SERIAL_JTAG_INTR_SOURCE, 0, hw_cdc_isr_handler, NULL, &intr_handle) != ESP_OK){
isr_log_e("HW USB CDC failed to init interrupts");
end();
return;
}
if (perimanSetBusDeinit(ESP32_BUS_TYPE_USB_DM, HWCDC::deinit) && perimanSetBusDeinit(ESP32_BUS_TYPE_USB_DP, HWCDC::deinit)) {
// Setting USB D+ D- pins
perimanSetPinBus(USB_DM_GPIO_NUM, ESP32_BUS_TYPE_USB_DM, (void *) this, -1, -1);
perimanSetPinBus(USB_DP_GPIO_NUM, ESP32_BUS_TYPE_USB_DP, (void *) this, -1, -1);
} else {
log_e("Serial JTAG Pins can't be set into Peripheral Manager.");
}
usb_serial_jtag_ll_txfifo_flush();
}
void HWCDC::end()
{
//Disable tx/rx interrupt.
usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_LL_INTR_MASK);
esp_intr_free(intr_handle);
intr_handle = NULL;
if(tx_lock != NULL) {
vSemaphoreDelete(tx_lock);
tx_lock = NULL;
}
setRxBufferSize(0);
setTxBufferSize(0);
if (arduino_hw_cdc_event_loop_handle) {
esp_event_loop_delete(arduino_hw_cdc_event_loop_handle);
arduino_hw_cdc_event_loop_handle = NULL;
}
HWCDC::deinit(this);
}
void HWCDC::setTxTimeoutMs(uint32_t timeout){
tx_timeout_ms = timeout;
// it registers that the user has explicitly requested to use a value as TX timeout
// used for the workaround with unplugged USB and TX Queue Full that causes a delay on every write()
tx_timeout_change_request = true;
void HWCDC::setTxTimeoutMs(uint32_t timeout) {
tx_timeout_ms = timeout;
}
/*
* WRITING
*/
size_t HWCDC::setTxBufferSize(size_t tx_queue_len){
if(tx_ring_buf){
vRingbufferDelete(tx_ring_buf);
tx_ring_buf = NULL;
}
if(!tx_queue_len){
return 0;
}
tx_ring_buf = xRingbufferCreate(tx_queue_len, RINGBUF_TYPE_BYTEBUF);
if(!tx_ring_buf){
return 0;
}
return tx_queue_len;
size_t HWCDC::setTxBufferSize(size_t tx_queue_len) {
if (tx_ring_buf) {
vRingbufferDelete(tx_ring_buf);
tx_ring_buf = NULL;
}
if (!tx_queue_len) {
return 0;
}
tx_ring_buf = xRingbufferCreate(tx_queue_len, RINGBUF_TYPE_BYTEBUF);
if (!tx_ring_buf) {
return 0;
}
return tx_queue_len;
}
int HWCDC::availableForWrite(void)
{
if(tx_ring_buf == NULL || tx_lock == NULL){
return 0;
}
if(xSemaphoreTake(tx_lock, tx_timeout_ms / portTICK_PERIOD_MS) != pdPASS){
return 0;
}
size_t a = xRingbufferGetCurFreeSize(tx_ring_buf);
xSemaphoreGive(tx_lock);
return a;
int HWCDC::availableForWrite(void) {
if (tx_ring_buf == NULL || tx_lock == NULL) {
return 0;
}
if (xSemaphoreTake(tx_lock, tx_timeout_ms / portTICK_PERIOD_MS) != pdPASS) {
return 0;
}
size_t a = xRingbufferGetCurFreeSize(tx_ring_buf);
xSemaphoreGive(tx_lock);
return a;
}
size_t HWCDC::write(const uint8_t *buffer, size_t size)
{
if(buffer == NULL || size == 0 || tx_ring_buf == NULL || tx_lock == NULL){
return 0;
}
if(xSemaphoreTake(tx_lock, tx_timeout_ms / portTICK_PERIOD_MS) != pdPASS){
return 0;
}
size_t max_size = xRingbufferGetMaxItemSize(tx_ring_buf);
size_t HWCDC::write(const uint8_t *buffer, size_t size) {
if (buffer == NULL || size == 0 || tx_ring_buf == NULL || tx_lock == NULL) {
return 0;
}
if (xSemaphoreTake(tx_lock, tx_timeout_ms / portTICK_PERIOD_MS) != pdPASS) {
return 0;
}
if (!isCDC_Connected()) {
// just pop/push RingBuffer and apply FIFO policy
flushTXBuffer(buffer, size);
} else {
size_t space = xRingbufferGetCurFreeSize(tx_ring_buf);
size_t to_send = size, so_far = 0;
if(space > size){
space = size;
if (space > size) {
space = size;
}
// Non-Blocking method, Sending data to ringbuffer, and handle the data in ISR.
if(xRingbufferSend(tx_ring_buf, (void*) (buffer), space, 0) != pdTRUE){
size = 0;
if (space > 0 && xRingbufferSend(tx_ring_buf, (void *)(buffer), space, 0) != pdTRUE) {
size = 0;
} else {
to_send -= space;
so_far += space;
// Now trigger the ISR to read data from the ring buffer.
to_send -= space;
so_far += space;
// Now trigger the ISR to read data from the ring buffer.
usb_serial_jtag_ll_txfifo_flush();
if (connected) {
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
while(to_send){
if(max_size > to_send){
max_size = to_send;
}
// Blocking method, Sending data to ringbuffer, and handle the data in ISR.
if(xRingbufferSend(tx_ring_buf, (void*) (buffer+so_far), max_size, tx_timeout_ms / portTICK_PERIOD_MS) != pdTRUE){
size = so_far;
break;
}
so_far += max_size;
to_send -= max_size;
// Now trigger the ISR to read data from the ring buffer.
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
}
// tracks CDC transmission progress to avoid hanging if CDC is unplugged while still sending data
size_t last_toSend = to_send;
uint32_t tries = tx_timeout_ms; // waits 1ms per sending data attempt, in case CDC is unplugged
while (connected && to_send) {
space = xRingbufferGetCurFreeSize(tx_ring_buf);
if (space > to_send) {
space = to_send;
}
// Blocking method, Sending data to ringbuffer, and handle the data in ISR.
if (xRingbufferSend(tx_ring_buf, (void *)(buffer + so_far), space, tx_timeout_ms / portTICK_PERIOD_MS) != pdTRUE) {
size = so_far;
log_w("write failed due to ring buffer full - timeout");
break;
}
so_far += space;
to_send -= space;
// Now trigger the ISR to read data from the ring buffer.
usb_serial_jtag_ll_txfifo_flush();
if (connected) {
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
}
if (last_toSend == to_send) {
// no progress in sending data... USB CDC is probably unplugged
tries--;
delay(1);
} else {
last_toSend = to_send;
tries = tx_timeout_ms; // reset the timeout
}
if (tries == 0) { // CDC isn't connected anymore...
size = so_far;
log_w("write failed due to waiting USB Host - timeout");
connected = false;
}
}
}
xSemaphoreGive(tx_lock);
return size;
// CDC was disconnected while sending data ==> flush the TX buffer keeping the last data
if (to_send && !usb_serial_jtag_ll_txfifo_writable()) {
connected = false;
flushTXBuffer(buffer + so_far, to_send);
}
}
xSemaphoreGive(tx_lock);
return size;
}
size_t HWCDC::write(uint8_t c)
{
return write(&c, 1);
size_t HWCDC::write(uint8_t c) {
return write(&c, 1);
}
void HWCDC::flush(void)
{
if(tx_ring_buf == NULL || tx_lock == NULL){
return;
}
if(xSemaphoreTake(tx_lock, tx_timeout_ms / portTICK_PERIOD_MS) != pdPASS){
return;
}
void HWCDC::flush(void) {
if (tx_ring_buf == NULL || tx_lock == NULL) {
return;
}
if (xSemaphoreTake(tx_lock, tx_timeout_ms / portTICK_PERIOD_MS) != pdPASS) {
return;
}
if (!isCDC_Connected()) {
flushTXBuffer(NULL, 0);
} else {
UBaseType_t uxItemsWaiting = 0;
vRingbufferGetInfo(tx_ring_buf, NULL, NULL, NULL, NULL, &uxItemsWaiting);
if(uxItemsWaiting){
// Now trigger the ISR to read data from the ring buffer.
if (uxItemsWaiting) {
// Now trigger the ISR to read data from the ring buffer.
usb_serial_jtag_ll_txfifo_flush();
if (connected) {
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
}
}
while(uxItemsWaiting){
delay(5);
vRingbufferGetInfo(tx_ring_buf, NULL, NULL, NULL, NULL, &uxItemsWaiting);
uint32_t tries = tx_timeout_ms; // waits 1ms per ISR sending data attempt, in case CDC is unplugged
while (connected && tries && uxItemsWaiting) {
delay(1);
UBaseType_t lastUxItemsWaiting = uxItemsWaiting;
vRingbufferGetInfo(tx_ring_buf, NULL, NULL, NULL, NULL, &uxItemsWaiting);
if (lastUxItemsWaiting == uxItemsWaiting) {
tries--;
}
if (connected) {
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
}
}
xSemaphoreGive(tx_lock);
if (tries == 0) { // CDC isn't connected anymore...
connected = false;
flushTXBuffer(NULL, 0); // flushes all TX Buffer
}
}
xSemaphoreGive(tx_lock);
}
/*
* READING
*/
size_t HWCDC::setRxBufferSize(size_t rx_queue_len){
if(rx_queue){
vQueueDelete(rx_queue);
rx_queue = NULL;
}
if(!rx_queue_len){
return 0;
}
rx_queue = xQueueCreate(rx_queue_len, sizeof(uint8_t));
if(!rx_queue){
return 0;
}
return rx_queue_len;
size_t HWCDC::setRxBufferSize(size_t rx_queue_len) {
if (rx_queue) {
vQueueDelete(rx_queue);
rx_queue = NULL;
}
if (!rx_queue_len) {
return 0;
}
rx_queue = xQueueCreate(rx_queue_len, sizeof(uint8_t));
if (!rx_queue) {
return 0;
}
return rx_queue_len;
}
int HWCDC::available(void)
{
if(rx_queue == NULL){
return -1;
}
return uxQueueMessagesWaiting(rx_queue);
}
int HWCDC::peek(void)
{
if(rx_queue == NULL){
return -1;
}
uint8_t c;
if(xQueuePeek(rx_queue, &c, 0)) {
return c;
}
int HWCDC::available(void) {
if (rx_queue == NULL) {
return -1;
}
return uxQueueMessagesWaiting(rx_queue);
}
int HWCDC::read(void)
{
if(rx_queue == NULL){
return -1;
}
uint8_t c = 0;
if(xQueueReceive(rx_queue, &c, 0)) {
return c;
}
int HWCDC::peek(void) {
if (rx_queue == NULL) {
return -1;
}
uint8_t c;
if (xQueuePeek(rx_queue, &c, 0)) {
return c;
}
return -1;
}
size_t HWCDC::read(uint8_t *buffer, size_t size)
{
if(rx_queue == NULL){
return -1;
}
uint8_t c = 0;
size_t count = 0;
while(count < size && xQueueReceive(rx_queue, &c, 0)){
buffer[count++] = c;
}
return count;
int HWCDC::read(void) {
if (rx_queue == NULL) {
return -1;
}
uint8_t c = 0;
if (xQueueReceive(rx_queue, &c, 0)) {
return c;
}
return -1;
}
size_t HWCDC::read(uint8_t *buffer, size_t size) {
if (rx_queue == NULL) {
return -1;
}
uint8_t c = 0;
size_t count = 0;
while (count < size && xQueueReceive(rx_queue, &c, 0)) {
buffer[count++] = c;
}
return count;
}
/*
* DEBUG
*/
void HWCDC::setDebugOutput(bool en)
{
if(en) {
uartSetDebug(NULL);
ets_install_putc1((void (*)(char)) &cdc0_write_char);
} else {
ets_install_putc1(NULL);
}
void HWCDC::setDebugOutput(bool en) {
if (en) {
uartSetDebug(NULL);
ets_install_putc2((void (*)(char)) & cdc0_write_char);
} else {
ets_install_putc2(NULL);
}
ets_install_putc1(NULL); // closes UART log output
}
#if ARDUINO_USB_MODE // Hardware JTAG CDC selected
#if ARDUINO_USB_MODE && ARDUINO_USB_CDC_ON_BOOT // Hardware JTAG CDC selected
// USBSerial is always available to be used
HWCDC HWCDCSerial;
#endif

View file

@ -1,4 +1,4 @@
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
// Copyright 2015-2024 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -21,88 +21,93 @@
#include <inttypes.h>
#include "esp_event.h"
#include "Stream.h"
#include "driver/usb_serial_jtag.h"
ESP_EVENT_DECLARE_BASE(ARDUINO_HW_CDC_EVENTS);
typedef enum {
ARDUINO_HW_CDC_ANY_EVENT = ESP_EVENT_ANY_ID,
ARDUINO_HW_CDC_CONNECTED_EVENT = 0,
ARDUINO_HW_CDC_BUS_RESET_EVENT,
ARDUINO_HW_CDC_RX_EVENT,
ARDUINO_HW_CDC_TX_EVENT,
ARDUINO_HW_CDC_MAX_EVENT,
ARDUINO_HW_CDC_ANY_EVENT = ESP_EVENT_ANY_ID,
ARDUINO_HW_CDC_CONNECTED_EVENT = 0,
ARDUINO_HW_CDC_BUS_RESET_EVENT,
ARDUINO_HW_CDC_RX_EVENT,
ARDUINO_HW_CDC_TX_EVENT,
ARDUINO_HW_CDC_MAX_EVENT,
} arduino_hw_cdc_event_t;
typedef union {
struct {
size_t len;
} rx;
struct {
size_t len;
} tx;
struct {
size_t len;
} rx;
struct {
size_t len;
} tx;
} arduino_hw_cdc_event_data_t;
class HWCDC: public Stream
{
class HWCDC : public Stream {
private:
static bool deinit(void * busptr);
static bool deinit(void *busptr);
static bool isCDC_Connected();
public:
HWCDC();
~HWCDC();
HWCDC();
~HWCDC();
void onEvent(esp_event_handler_t callback);
void onEvent(arduino_hw_cdc_event_t event, esp_event_handler_t callback);
void onEvent(esp_event_handler_t callback);
void onEvent(arduino_hw_cdc_event_t event, esp_event_handler_t callback);
size_t setRxBufferSize(size_t);
size_t setTxBufferSize(size_t);
void setTxTimeoutMs(uint32_t timeout);
void begin(unsigned long baud=0);
void end();
int available(void);
int availableForWrite(void);
int peek(void);
int read(void);
size_t read(uint8_t *buffer, size_t size);
size_t write(uint8_t);
size_t write(const uint8_t *buffer, size_t size);
void flush(void);
inline size_t read(char * buffer, size_t size)
{
return read((uint8_t*) buffer, size);
}
inline size_t write(const char * buffer, size_t size)
{
return write((uint8_t*) buffer, size);
}
inline size_t write(const char * s)
{
return write((uint8_t*) s, strlen(s));
}
inline size_t write(unsigned long n)
{
return write((uint8_t) n);
}
inline size_t write(long n)
{
return write((uint8_t) n);
}
inline size_t write(unsigned int n)
{
return write((uint8_t) n);
}
inline size_t write(int n)
{
return write((uint8_t) n);
}
operator bool() const;
void setDebugOutput(bool);
uint32_t baudRate(){return 115200;}
size_t setRxBufferSize(size_t);
size_t setTxBufferSize(size_t);
void setTxTimeoutMs(uint32_t timeout);
void begin(unsigned long baud = 0);
void end();
int available(void);
int availableForWrite(void);
int peek(void);
int read(void);
size_t read(uint8_t *buffer, size_t size);
size_t write(uint8_t);
size_t write(const uint8_t *buffer, size_t size);
void flush(void);
inline static bool isPlugged(void) {
// SOF ISR is causing esptool to be unable to upload firmware to the board
// Using IDF 5.1 helper function because it is based on Timer check instead of ISR
return usb_serial_jtag_is_connected();
}
inline static bool isConnected(void) {
return isCDC_Connected();
}
inline size_t read(char *buffer, size_t size) {
return read((uint8_t *)buffer, size);
}
inline size_t write(const char *buffer, size_t size) {
return write((uint8_t *)buffer, size);
}
inline size_t write(const char *s) {
return write((uint8_t *)s, strlen(s));
}
inline size_t write(unsigned long n) {
return write((uint8_t)n);
}
inline size_t write(long n) {
return write((uint8_t)n);
}
inline size_t write(unsigned int n) {
return write((uint8_t)n);
}
inline size_t write(int n) {
return write((uint8_t)n);
}
operator bool() const;
void setDebugOutput(bool);
uint32_t baudRate() {
return 115200;
}
};
#if ARDUINO_USB_MODE // Hardware JTAG CDC selected
#if ARDUINO_USB_MODE && ARDUINO_USB_CDC_ON_BOOT // Hardware JTAG CDC selected
#ifndef HWCDC_SERIAL_IS_DEFINED
#define HWCDC_SERIAL_IS_DEFINED 1
#endif

View file

@ -20,23 +20,24 @@
#include <inttypes.h>
#include "Stream.h"
#include <functional>
class HardwareI2C : public Stream
{
public:
virtual bool begin() = 0;
virtual bool begin(uint8_t address) = 0;
virtual bool end() = 0;
class HardwareI2C : public Stream {
public:
virtual bool begin() = 0;
virtual bool begin(uint8_t address) = 0;
virtual bool end() = 0;
virtual bool setClock(uint32_t freq) = 0;
virtual void beginTransmission(uint8_t address) = 0;
virtual uint8_t endTransmission(bool stopBit) = 0;
virtual uint8_t endTransmission(void) = 0;
virtual bool setClock(uint32_t freq) = 0;
virtual size_t requestFrom(uint8_t address, size_t len, bool stopBit) = 0;
virtual size_t requestFrom(uint8_t address, size_t len) = 0;
virtual void beginTransmission(uint8_t address) = 0;
virtual uint8_t endTransmission(bool stopBit) = 0;
virtual uint8_t endTransmission(void) = 0;
virtual void onReceive(void(*)(int)) = 0;
virtual void onRequest(void(*)(void)) = 0;
virtual size_t requestFrom(uint8_t address, size_t len, bool stopBit) = 0;
virtual size_t requestFrom(uint8_t address, size_t len) = 0;
// Update base class to use std::function
virtual void onReceive(const std::function<void(int)> &) = 0;
virtual void onRequest(const std::function<void()> &) = 0;
};

File diff suppressed because it is too large Load diff

View file

@ -58,55 +58,89 @@
#include "freertos/semphr.h"
enum SerialConfig {
SERIAL_5N1 = 0x8000010,
SERIAL_6N1 = 0x8000014,
SERIAL_7N1 = 0x8000018,
SERIAL_8N1 = 0x800001c,
SERIAL_5N2 = 0x8000030,
SERIAL_6N2 = 0x8000034,
SERIAL_7N2 = 0x8000038,
SERIAL_8N2 = 0x800003c,
SERIAL_5E1 = 0x8000012,
SERIAL_6E1 = 0x8000016,
SERIAL_7E1 = 0x800001a,
SERIAL_8E1 = 0x800001e,
SERIAL_5E2 = 0x8000032,
SERIAL_6E2 = 0x8000036,
SERIAL_7E2 = 0x800003a,
SERIAL_8E2 = 0x800003e,
SERIAL_5O1 = 0x8000013,
SERIAL_6O1 = 0x8000017,
SERIAL_7O1 = 0x800001b,
SERIAL_8O1 = 0x800001f,
SERIAL_5O2 = 0x8000033,
SERIAL_6O2 = 0x8000037,
SERIAL_7O2 = 0x800003b,
SERIAL_8O2 = 0x800003f
SERIAL_5N1 = 0x8000010,
SERIAL_6N1 = 0x8000014,
SERIAL_7N1 = 0x8000018,
SERIAL_8N1 = 0x800001c,
SERIAL_5N2 = 0x8000030,
SERIAL_6N2 = 0x8000034,
SERIAL_7N2 = 0x8000038,
SERIAL_8N2 = 0x800003c,
SERIAL_5E1 = 0x8000012,
SERIAL_6E1 = 0x8000016,
SERIAL_7E1 = 0x800001a,
SERIAL_8E1 = 0x800001e,
SERIAL_5E2 = 0x8000032,
SERIAL_6E2 = 0x8000036,
SERIAL_7E2 = 0x800003a,
SERIAL_8E2 = 0x800003e,
SERIAL_5O1 = 0x8000013,
SERIAL_6O1 = 0x8000017,
SERIAL_7O1 = 0x800001b,
SERIAL_8O1 = 0x800001f,
SERIAL_5O2 = 0x8000033,
SERIAL_6O2 = 0x8000037,
SERIAL_7O2 = 0x800003b,
SERIAL_8O2 = 0x800003f
};
typedef uart_mode_t SerialMode;
typedef uart_hw_flowcontrol_t SerialHwFlowCtrl;
typedef enum {
UART_NO_ERROR,
UART_BREAK_ERROR,
UART_BUFFER_FULL_ERROR,
UART_FIFO_OVF_ERROR,
UART_FRAME_ERROR,
UART_PARITY_ERROR
UART_NO_ERROR,
UART_BREAK_ERROR,
UART_BUFFER_FULL_ERROR,
UART_FIFO_OVF_ERROR,
UART_FRAME_ERROR,
UART_PARITY_ERROR
} hardwareSerial_error_t;
typedef enum {
UART_CLK_SRC_DEFAULT = UART_SCLK_DEFAULT,
#if SOC_UART_SUPPORT_APB_CLK
UART_CLK_SRC_APB = UART_SCLK_APB,
#endif
#if SOC_UART_SUPPORT_PLL_F40M_CLK
UART_CLK_SRC_PLL = UART_SCLK_PLL_F40M,
#elif SOC_UART_SUPPORT_PLL_F80M_CLK
UART_CLK_SRC_PLL = UART_SCLK_PLL_F80M,
#elif CONFIG_IDF_TARGET_ESP32H2
UART_CLK_SRC_PLL = UART_SCLK_PLL_F48M,
#endif
#if SOC_UART_SUPPORT_XTAL_CLK
UART_CLK_SRC_XTAL = UART_SCLK_XTAL,
#endif
#if SOC_UART_SUPPORT_RTC_CLK
UART_CLK_SRC_RTC = UART_SCLK_RTC,
#endif
#if SOC_UART_SUPPORT_REF_TICK
UART_CLK_SRC_REF_TICK = UART_SCLK_REF_TICK,
#endif
} SerialClkSrc;
#ifndef ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE
#define ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE 2048
#ifndef CONFIG_ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE
#define ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE 2048
#else
#define ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE CONFIG_ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE
#endif
#endif
#ifndef ARDUINO_SERIAL_EVENT_TASK_PRIORITY
#define ARDUINO_SERIAL_EVENT_TASK_PRIORITY (configMAX_PRIORITIES-1)
#ifndef CONFIG_ARDUINO_SERIAL_EVENT_TASK_PRIORITY
#define ARDUINO_SERIAL_EVENT_TASK_PRIORITY (configMAX_PRIORITIES - 1)
#else
#define ARDUINO_SERIAL_EVENT_TASK_PRIORITY CONFIG_ARDUINO_SERIAL_EVENT_TASK_PRIORITY
#endif
#endif
#ifndef ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE
#define ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE -1
#ifndef CONFIG_ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE
#define ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE -1
#else
#define ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE CONFIG_ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE
#endif
#endif
// UART0 pins are defined by default by the bootloader.
@ -114,234 +148,265 @@ typedef enum {
// have changed and you know what you are doing.
#ifndef SOC_RX0
#if CONFIG_IDF_TARGET_ESP32
#define SOC_RX0 (gpio_num_t)3
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
#define SOC_RX0 (gpio_num_t)44
#elif CONFIG_IDF_TARGET_ESP32C2
#define SOC_RX0 (gpio_num_t)19
#elif CONFIG_IDF_TARGET_ESP32C3
#define SOC_RX0 (gpio_num_t)20
#elif CONFIG_IDF_TARGET_ESP32C6
#define SOC_RX0 (gpio_num_t)17
#elif CONFIG_IDF_TARGET_ESP32H2
#define SOC_RX0 (gpio_num_t)23
#endif
#if CONFIG_IDF_TARGET_ESP32
#define SOC_RX0 (gpio_num_t)3
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
#define SOC_RX0 (gpio_num_t)44
#elif CONFIG_IDF_TARGET_ESP32C2
#define SOC_RX0 (gpio_num_t)19
#elif CONFIG_IDF_TARGET_ESP32C3
#define SOC_RX0 (gpio_num_t)20
#elif CONFIG_IDF_TARGET_ESP32C6
#define SOC_RX0 (gpio_num_t)17
#elif CONFIG_IDF_TARGET_ESP32H2
#define SOC_RX0 (gpio_num_t)23
#elif CONFIG_IDF_TARGET_ESP32P4
#define SOC_RX0 (gpio_num_t)38
#elif CONFIG_IDF_TARGET_ESP32C5
#define SOC_RX0 (gpio_num_t)12
#endif
#endif
#ifndef SOC_TX0
#if CONFIG_IDF_TARGET_ESP32
#define SOC_TX0 (gpio_num_t)1
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
#define SOC_TX0 (gpio_num_t)43
#elif CONFIG_IDF_TARGET_ESP32C2
#define SOC_TX0 (gpio_num_t)20
#elif CONFIG_IDF_TARGET_ESP32C3
#define SOC_TX0 (gpio_num_t)21
#elif CONFIG_IDF_TARGET_ESP32C6
#define SOC_TX0 (gpio_num_t)16
#elif CONFIG_IDF_TARGET_ESP32H2
#define SOC_TX0 (gpio_num_t)24
#endif
#if CONFIG_IDF_TARGET_ESP32
#define SOC_TX0 (gpio_num_t)1
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
#define SOC_TX0 (gpio_num_t)43
#elif CONFIG_IDF_TARGET_ESP32C2
#define SOC_TX0 (gpio_num_t)20
#elif CONFIG_IDF_TARGET_ESP32C3
#define SOC_TX0 (gpio_num_t)21
#elif CONFIG_IDF_TARGET_ESP32C6
#define SOC_TX0 (gpio_num_t)16
#elif CONFIG_IDF_TARGET_ESP32H2
#define SOC_TX0 (gpio_num_t)24
#elif CONFIG_IDF_TARGET_ESP32P4
#define SOC_TX0 (gpio_num_t)37
#elif CONFIG_IDF_TARGET_ESP32C5
#define SOC_TX0 (gpio_num_t)11
#endif
#endif
// Default pins for UART1 are arbitrary, and defined here for convenience.
#if SOC_UART_NUM > 1
#ifndef RX1
#if CONFIG_IDF_TARGET_ESP32
#define RX1 (gpio_num_t)26
#elif CONFIG_IDF_TARGET_ESP32S2
#define RX1 (gpio_num_t)4
#elif CONFIG_IDF_TARGET_ESP32C2
#define RX1 (gpio_num_t)10
#elif CONFIG_IDF_TARGET_ESP32C3
#define RX1 (gpio_num_t)18
#elif CONFIG_IDF_TARGET_ESP32S3
#define RX1 (gpio_num_t)15
#elif CONFIG_IDF_TARGET_ESP32C6
#define RX1 (gpio_num_t)4
#elif CONFIG_IDF_TARGET_ESP32H2
#define RX1 (gpio_num_t)0
#endif
#endif
#if SOC_UART_HP_NUM > 1
#ifndef RX1
#if CONFIG_IDF_TARGET_ESP32
#define RX1 (gpio_num_t)26
#elif CONFIG_IDF_TARGET_ESP32S2
#define RX1 (gpio_num_t)4
#elif CONFIG_IDF_TARGET_ESP32C2
#define RX1 (gpio_num_t)10
#elif CONFIG_IDF_TARGET_ESP32C3
#define RX1 (gpio_num_t)18
#elif CONFIG_IDF_TARGET_ESP32S3
#define RX1 (gpio_num_t)15
#elif CONFIG_IDF_TARGET_ESP32C6
#define RX1 (gpio_num_t)4
#elif CONFIG_IDF_TARGET_ESP32H2
#define RX1 (gpio_num_t)0
#elif CONFIG_IDF_TARGET_ESP32P4
#define RX1 (gpio_num_t)11
#elif CONFIG_IDF_TARGET_ESP32C5
#define RX1 (gpio_num_t)4
#endif
#endif
#ifndef TX1
#if CONFIG_IDF_TARGET_ESP32
#define TX1 (gpio_num_t)27
#elif CONFIG_IDF_TARGET_ESP32S2
#define TX1 (gpio_num_t)5
#elif CONFIG_IDF_TARGET_ESP32C2
#define TX1 (gpio_num_t)18
#elif CONFIG_IDF_TARGET_ESP32C3
#define TX1 (gpio_num_t)19
#elif CONFIG_IDF_TARGET_ESP32S3
#define TX1 (gpio_num_t)16
#elif CONFIG_IDF_TARGET_ESP32C6
#define TX1 (gpio_num_t)5
#elif CONFIG_IDF_TARGET_ESP32H2
#define TX1 (gpio_num_t)1
#endif
#endif
#endif /* SOC_UART_NUM > 1 */
#ifndef TX1
#if CONFIG_IDF_TARGET_ESP32
#define TX1 (gpio_num_t)27
#elif CONFIG_IDF_TARGET_ESP32S2
#define TX1 (gpio_num_t)5
#elif CONFIG_IDF_TARGET_ESP32C2
#define TX1 (gpio_num_t)18
#elif CONFIG_IDF_TARGET_ESP32C3
#define TX1 (gpio_num_t)19
#elif CONFIG_IDF_TARGET_ESP32S3
#define TX1 (gpio_num_t)16
#elif CONFIG_IDF_TARGET_ESP32C6
#define TX1 (gpio_num_t)5
#elif CONFIG_IDF_TARGET_ESP32H2
#define TX1 (gpio_num_t)1
#elif CONFIG_IDF_TARGET_ESP32P4
#define TX1 (gpio_num_t)10
#elif CONFIG_IDF_TARGET_ESP32C5
#define TX1 (gpio_num_t)5
#endif
#endif
#endif /* SOC_UART_HP_NUM > 1 */
// Default pins for UART2 are arbitrary, and defined here for convenience.
#if SOC_UART_NUM > 2
#ifndef RX2
#if CONFIG_IDF_TARGET_ESP32
#define RX2 (gpio_num_t)4
#elif CONFIG_IDF_TARGET_ESP32S3
#define RX2 (gpio_num_t)19
#endif
#endif
#if SOC_UART_HP_NUM > 2
#ifndef RX2
#if CONFIG_IDF_TARGET_ESP32
#define RX2 (gpio_num_t)4
#elif CONFIG_IDF_TARGET_ESP32S3
#define RX2 (gpio_num_t)19
#endif
#endif
#ifndef TX2
#if CONFIG_IDF_TARGET_ESP32
#define TX2 (gpio_num_t)25
#elif CONFIG_IDF_TARGET_ESP32S3
#define TX2 (gpio_num_t)20
#endif
#endif
#endif /* SOC_UART_NUM > 2 */
#ifndef TX2
#if CONFIG_IDF_TARGET_ESP32
#define TX2 (gpio_num_t)25
#elif CONFIG_IDF_TARGET_ESP32S3
#define TX2 (gpio_num_t)20
#endif
#endif
#endif /* SOC_UART_HP_NUM > 2 */
#if SOC_UART_LP_NUM >= 1
#ifndef LP_RX0
#define LP_RX0 (gpio_num_t) LP_U0RXD_GPIO_NUM
#endif
#ifndef LP_TX0
#define LP_TX0 (gpio_num_t) LP_U0TXD_GPIO_NUM
#endif
#endif /* SOC_UART_LP_NUM >= 1 */
typedef std::function<void(void)> OnReceiveCb;
typedef std::function<void(hardwareSerial_error_t)> OnReceiveErrorCb;
class HardwareSerial: public Stream
{
class HardwareSerial : public Stream {
public:
HardwareSerial(uint8_t uart_nr);
~HardwareSerial();
HardwareSerial(uint8_t uart_nr);
~HardwareSerial();
// setRxTimeout sets the timeout after which onReceive callback will be called (after receiving data, it waits for this time of UART rx inactivity to call the callback fnc)
// param symbols_timeout defines a timeout threshold in uart symbol periods. Setting 0 symbol timeout disables the callback call by timeout.
// Maximum timeout setting is calculacted automatically by IDF. If set above the maximum, it is ignored and an error is printed on Serial0 (check console).
// Examples: Maximum for 11 bits symbol is 92 (SERIAL_8N2, SERIAL_8E1, SERIAL_8O1, etc), Maximum for 10 bits symbol is 101 (SERIAL_8N1).
// For example symbols_timeout=1 defines a timeout equal to transmission time of one symbol (~11 bit) on current baudrate.
// For a baudrate of 9600, SERIAL_8N1 (10 bit symbol) and symbols_timeout = 3, the timeout would be 3 / (9600 / 10) = 3.125 ms
bool setRxTimeout(uint8_t symbols_timeout);
// setRxTimeout sets the timeout after which onReceive callback will be called (after receiving data, it waits for this time of UART rx inactivity to call the callback fnc)
// param symbols_timeout defines a timeout threshold in uart symbol periods. Setting 0 symbol timeout disables the callback call by timeout.
// Maximum timeout setting is calculacted automatically by IDF. If set above the maximum, it is ignored and an error is printed on Serial0 (check console).
// Examples: Maximum for 11 bits symbol is 92 (SERIAL_8N2, SERIAL_8E1, SERIAL_8O1, etc), Maximum for 10 bits symbol is 101 (SERIAL_8N1).
// For example symbols_timeout=1 defines a timeout equal to transmission time of one symbol (~11 bit) on current baudrate.
// For a baudrate of 9600, SERIAL_8N1 (10 bit symbol) and symbols_timeout = 3, the timeout would be 3 / (9600 / 10) = 3.125 ms
bool setRxTimeout(uint8_t symbols_timeout);
// setRxFIFOFull(uint8_t fifoBytes) will set the number of bytes that will trigger UART_INTR_RXFIFO_FULL interrupt and fill up RxRingBuffer
// This affects some functions such as Serial::available() and Serial.read() because, in a UART flow of receiving data, Serial internal
// RxRingBuffer will be filled only after these number of bytes arrive or a RX Timeout happens.
// This parameter can be set to 1 in order to receive byte by byte, but it will also consume more CPU time as the ISR will be activates often.
bool setRxFIFOFull(uint8_t fifoBytes);
// setRxFIFOFull(uint8_t fifoBytes) will set the number of bytes that will trigger UART_INTR_RXFIFO_FULL interrupt and fill up RxRingBuffer
// This affects some functions such as Serial::available() and Serial.read() because, in a UART flow of receiving data, Serial internal
// RxRingBuffer will be filled only after these number of bytes arrive or a RX Timeout happens.
// This parameter can be set to 1 in order to receive byte by byte, but it will also consume more CPU time as the ISR will be activates often.
bool setRxFIFOFull(uint8_t fifoBytes);
// onReceive will setup a callback that will be called whenever an UART interruption occurs (UART_INTR_RXFIFO_FULL or UART_INTR_RXFIFO_TOUT)
// UART_INTR_RXFIFO_FULL interrupt triggers at UART_FULL_THRESH_DEFAULT bytes received (defined as 120 bytes by default in IDF)
// UART_INTR_RXFIFO_TOUT interrupt triggers at UART_TOUT_THRESH_DEFAULT symbols passed without any reception (defined as 10 symbos by default in IDF)
// onlyOnTimeout parameter will define how onReceive will behave:
// Default: true -- The callback will only be called when RX Timeout happens.
// Whole stream of bytes will be ready for being read on the callback function at once.
// This option may lead to Rx Overflow depending on the Rx Buffer Size and number of bytes received in the streaming
// false -- The callback will be called when FIFO reaches 120 bytes and also on RX Timeout.
// The stream of incommig bytes will be "split" into blocks of 120 bytes on each callback.
// This option avoid any sort of Rx Overflow, but leaves the UART packet reassembling work to the Application.
void onReceive(OnReceiveCb function, bool onlyOnTimeout = false);
// onReceive will setup a callback that will be called whenever an UART interruption occurs (UART_INTR_RXFIFO_FULL or UART_INTR_RXFIFO_TOUT)
// UART_INTR_RXFIFO_FULL interrupt triggers at UART_FULL_THRESH_DEFAULT bytes received (defined as 120 bytes by default in IDF)
// UART_INTR_RXFIFO_TOUT interrupt triggers at UART_TOUT_THRESH_DEFAULT symbols passed without any reception (defined as 10 symbols by default in IDF)
// onlyOnTimeout parameter will define how onReceive will behave:
// Default: true -- The callback will only be called when RX Timeout happens.
// Whole stream of bytes will be ready for being read on the callback function at once.
// This option may lead to Rx Overflow depending on the Rx Buffer Size and number of bytes received in the streaming
// false -- The callback will be called when FIFO reaches 120 bytes and also on RX Timeout.
// The stream of incommig bytes will be "split" into blocks of 120 bytes on each callback.
// This option avoid any sort of Rx Overflow, but leaves the UART packet reassembling work to the Application.
void onReceive(OnReceiveCb function, bool onlyOnTimeout = false);
// onReceive will be called on error events (see hardwareSerial_error_t)
void onReceiveError(OnReceiveErrorCb function);
// onReceive will be called on error events (see hardwareSerial_error_t)
void onReceiveError(OnReceiveErrorCb function);
// eventQueueReset clears all events in the queue (the events that trigger onReceive and onReceiveError) - maybe usefull in some use cases
void eventQueueReset();
// When pins are changed, it will detach the previous ones
// if pin is negative, it won't be set/changed and will be kept as is
// timeout_ms is used in baudrate detection (ESP32, ESP32S2 only)
// invert will invert RX/TX polarity
// rxfifo_full_thrhd if the UART Flow Control Threshold in the UART FIFO (max 127)
void begin(unsigned long baud, uint32_t config=SERIAL_8N1, int8_t rxPin=-1, int8_t txPin=-1, bool invert=false, unsigned long timeout_ms = 20000UL, uint8_t rxfifo_full_thrhd = 112);
void end(void);
void updateBaudRate(unsigned long baud);
int available(void);
int availableForWrite(void);
int peek(void);
int read(void);
size_t read(uint8_t *buffer, size_t size);
inline size_t read(char * buffer, size_t size)
{
return read((uint8_t*) buffer, size);
}
// Overrides Stream::readBytes() to be faster using IDF
size_t readBytes(uint8_t *buffer, size_t length);
size_t readBytes(char *buffer, size_t length)
{
return readBytes((uint8_t *) buffer, length);
}
void flush(void);
void flush( bool txOnly);
size_t write(uint8_t);
size_t write(const uint8_t *buffer, size_t size);
inline size_t write(const char * buffer, size_t size)
{
return write((uint8_t*) buffer, size);
}
inline size_t write(const char * s)
{
return write((uint8_t*) s, strlen(s));
}
inline size_t write(unsigned long n)
{
return write((uint8_t) n);
}
inline size_t write(long n)
{
return write((uint8_t) n);
}
inline size_t write(unsigned int n)
{
return write((uint8_t) n);
}
inline size_t write(int n)
{
return write((uint8_t) n);
}
uint32_t baudRate();
operator bool() const;
// eventQueueReset clears all events in the queue (the events that trigger onReceive and onReceiveError) - maybe useful in some use cases
void eventQueueReset();
void setDebugOutput(bool);
void setRxInvert(bool);
// When pins are changed, it will detach the previous ones
// if pin is negative, it won't be set/changed and will be kept as is
// timeout_ms is used in baudrate detection (ESP32, ESP32S2 only)
// invert will invert RX/TX polarity
// rxfifo_full_thrhd if the UART Flow Control Threshold in the UART FIFO (max 127)
void begin(
unsigned long baud, uint32_t config = SERIAL_8N1, int8_t rxPin = -1, int8_t txPin = -1, bool invert = false, unsigned long timeout_ms = 20000UL,
uint8_t rxfifo_full_thrhd = 120
);
void end(void);
void updateBaudRate(unsigned long baud);
int available(void);
int availableForWrite(void);
int peek(void);
int read(void);
size_t read(uint8_t *buffer, size_t size);
inline size_t read(char *buffer, size_t size) {
return read((uint8_t *)buffer, size);
}
// Overrides Stream::readBytes() to be faster using IDF
size_t readBytes(uint8_t *buffer, size_t length);
size_t readBytes(char *buffer, size_t length) {
return readBytes((uint8_t *)buffer, length);
}
void flush(void);
void flush(bool txOnly);
size_t write(uint8_t);
size_t write(const uint8_t *buffer, size_t size);
inline size_t write(const char *buffer, size_t size) {
return write((uint8_t *)buffer, size);
}
inline size_t write(const char *s) {
return write((uint8_t *)s, strlen(s));
}
inline size_t write(unsigned long n) {
return write((uint8_t)n);
}
inline size_t write(long n) {
return write((uint8_t)n);
}
inline size_t write(unsigned int n) {
return write((uint8_t)n);
}
inline size_t write(int n) {
return write((uint8_t)n);
}
uint32_t baudRate();
operator bool() const;
// Negative Pin Number will keep it unmodified, thus this function can set individual pins
// setPins() can be called after or before begin()
// When pins are changed, it will detach the previous ones
bool setPins(int8_t rxPin, int8_t txPin, int8_t ctsPin = -1, int8_t rtsPin = -1);
// Enables or disables Hardware Flow Control using RTS and/or CTS pins (must use setAllPins() before)
// UART_HW_FLOWCTRL_DISABLE = 0x0 disable hardware flow control
// UART_HW_FLOWCTRL_RTS = 0x1 enable RX hardware flow control (rts)
// UART_HW_FLOWCTRL_CTS = 0x2 enable TX hardware flow control (cts)
// UART_HW_FLOWCTRL_CTS_RTS = 0x3 enable hardware flow control
bool setHwFlowCtrlMode(SerialHwFlowCtrl mode = UART_HW_FLOWCTRL_CTS_RTS, uint8_t threshold = 64); // 64 is half FIFO Length
// Used to set RS485 modes such as UART_MODE_RS485_HALF_DUPLEX for Auto RTS function on ESP32
// UART_MODE_UART = 0x00 mode: regular UART mode
// UART_MODE_RS485_HALF_DUPLEX = 0x01 mode: half duplex RS485 UART mode control by RTS pin
// UART_MODE_IRDA = 0x02 mode: IRDA UART mode
// UART_MODE_RS485_COLLISION_DETECT = 0x03 mode: RS485 collision detection UART mode (used for test purposes)
// UART_MODE_RS485_APP_CTRL = 0x04 mode: application control RS485 UART mode (used for test purposes)
bool setMode(SerialMode mode);
size_t setRxBufferSize(size_t new_size);
size_t setTxBufferSize(size_t new_size);
void setDebugOutput(bool);
void setRxInvert(bool);
// Negative Pin Number will keep it unmodified, thus this function can set individual pins
// setPins() can be called after or before begin()
// When pins are changed, it will detach the previous ones
bool setPins(int8_t rxPin, int8_t txPin, int8_t ctsPin = -1, int8_t rtsPin = -1);
// Enables or disables Hardware Flow Control using RTS and/or CTS pins (must use setAllPins() before)
// UART_HW_FLOWCTRL_DISABLE = 0x0 disable hardware flow control
// UART_HW_FLOWCTRL_RTS = 0x1 enable RX hardware flow control (rts)
// UART_HW_FLOWCTRL_CTS = 0x2 enable TX hardware flow control (cts)
// UART_HW_FLOWCTRL_CTS_RTS = 0x3 enable hardware flow control
bool setHwFlowCtrlMode(SerialHwFlowCtrl mode = UART_HW_FLOWCTRL_CTS_RTS, uint8_t threshold = 64); // 64 is half FIFO Length
// Used to set RS485 modes such as UART_MODE_RS485_HALF_DUPLEX for Auto RTS function on ESP32
// UART_MODE_UART = 0x00 mode: regular UART mode
// UART_MODE_RS485_HALF_DUPLEX = 0x01 mode: half duplex RS485 UART mode control by RTS pin
// UART_MODE_IRDA = 0x02 mode: IRDA UART mode
// UART_MODE_RS485_COLLISION_DETECT = 0x03 mode: RS485 collision detection UART mode (used for test purposes)
// UART_MODE_RS485_APP_CTRL = 0x04 mode: application control RS485 UART mode (used for test purposes)
bool setMode(SerialMode mode);
// Used to set the UART clock source mode. It must be set before calling begin(), otherwise it won't have any effect.
// Not all clock source are available to every SoC. The compatible option are listed here:
// UART_CLK_SRC_DEFAULT :: any SoC - it will set whatever IDF defines as the default UART Clock Source
// UART_CLK_SRC_APB :: ESP32, ESP32-S2, ESP32-C3 and ESP32-S3
// UART_CLK_SRC_PLL :: ESP32-C2, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2 and ESP32-P4
// UART_CLK_SRC_XTAL :: ESP32-C2, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2, ESP32-S3 and ESP32-P4
// UART_CLK_SRC_RTC :: ESP32-C2, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2, ESP32-S3 and ESP32-P4
// UART_CLK_SRC_REF_TICK :: ESP32 and ESP32-S2
// Note: CLK_SRC_PLL Freq depends on the SoC - ESP32-C2 has 40MHz, ESP32-H2 has 48MHz and ESP32-C5, C6, C61 and P4 has 80MHz
// Note: ESP32-C6, C61, ESP32-P4 and ESP32-C5 have LP UART that will use only RTC_FAST or XTAL/2 as Clock Source
bool setClockSource(SerialClkSrc clkSrc);
size_t setRxBufferSize(size_t new_size);
size_t setTxBufferSize(size_t new_size);
protected:
uint8_t _uart_nr;
uart_t* _uart;
size_t _rxBufferSize;
size_t _txBufferSize;
OnReceiveCb _onReceiveCB;
OnReceiveErrorCb _onReceiveErrorCB;
// _onReceive and _rxTimeout have be consistent when timeout is disabled
bool _onReceiveTimeout;
uint8_t _rxTimeout, _rxFIFOFull;
TaskHandle_t _eventTask;
uint8_t _uart_nr;
uart_t *_uart;
size_t _rxBufferSize;
size_t _txBufferSize;
OnReceiveCb _onReceiveCB;
OnReceiveErrorCb _onReceiveErrorCB;
// _onReceive and _rxTimeout have be consistent when timeout is disabled
bool _onReceiveTimeout;
uint8_t _rxTimeout, _rxFIFOFull;
TaskHandle_t _eventTask;
#if !CONFIG_DISABLE_HAL_LOCKS
SemaphoreHandle_t _lock;
SemaphoreHandle_t _lock;
#endif
void _createEventTask(void *args);
void _destroyEventTask(void);
static void _uartEventTask(void *args);
void _createEventTask(void *args);
void _destroyEventTask(void);
static void _uartEventTask(void *args);
};
extern void serialEventRun(void) __attribute__((weak));
@ -350,17 +415,17 @@ extern void serialEventRun(void) __attribute__((weak));
#ifndef ARDUINO_USB_CDC_ON_BOOT
#define ARDUINO_USB_CDC_ON_BOOT 0
#endif
#if ARDUINO_USB_CDC_ON_BOOT //Serial used from Native_USB_CDC | HW_CDC_JTAG
#if ARDUINO_USB_MODE // Hardware CDC mode
#if ARDUINO_USB_CDC_ON_BOOT //Serial used from Native_USB_CDC | HW_CDC_JTAG
#if ARDUINO_USB_MODE // Hardware CDC mode
// Arduino Serial is the HW JTAG CDC device
#define Serial HWCDCSerial
#else // !ARDUINO_USB_MODE -- Native USB Mode
#else // !ARDUINO_USB_MODE -- Native USB Mode
// Arduino Serial is the Native USB CDC device
#define Serial USBSerial
#endif // ARDUINO_USB_MODE
#else // !ARDUINO_USB_CDC_ON_BOOT -- Serial is used from UART0
// if not using CDC on Boot, Arduino Serial is the UART0 device
#define Serial Serial0
#define Serial Serial0
#endif // ARDUINO_USB_CDC_ON_BOOT
// There is always Seria0 for UART0
extern HardwareSerial Serial0;
@ -370,6 +435,15 @@ extern HardwareSerial Serial1;
#if SOC_UART_NUM > 2
extern HardwareSerial Serial2;
#endif
#endif //!defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
#if SOC_UART_NUM > 3
extern HardwareSerial Serial3;
#endif
#if SOC_UART_NUM > 4
extern HardwareSerial Serial4;
#endif
#if SOC_UART_NUM > 5
extern HardwareSerial Serial5;
#endif
#endif //!defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
#endif // HardwareSerial_h
#endif // HardwareSerial_h

View file

@ -20,33 +20,29 @@
#include "HEXBuilder.h"
class HashBuilder : public HEXBuilder
{
class HashBuilder : public HEXBuilder {
public:
virtual ~HashBuilder() {}
virtual void begin() = 0;
virtual ~HashBuilder() {}
virtual void begin() = 0;
virtual void add(const uint8_t* data, size_t len) = 0;
virtual void add(const char* data)
{
add((const uint8_t*)data, strlen(data));
}
virtual void add(String data)
{
add(data.c_str());
}
virtual void add(const uint8_t *data, size_t len) = 0;
virtual void add(const char *data) {
add((const uint8_t *)data, strlen(data));
}
virtual void add(String data) {
add(data.c_str());
}
virtual void addHexString(const char* data) = 0;
virtual void addHexString(String data)
{
addHexString(data.c_str());
}
virtual void addHexString(const char *data) = 0;
virtual void addHexString(String data) {
addHexString(data.c_str());
}
virtual bool addStream(Stream& stream, const size_t maxLen) = 0;
virtual void calculate() = 0;
virtual void getBytes(uint8_t* output) = 0;
virtual void getChars(char* output) = 0;
virtual String toString() = 0;
virtual bool addStream(Stream &stream, const size_t maxLen) = 0;
virtual void calculate() = 0;
virtual void getBytes(uint8_t *output) = 0;
virtual void getChars(char *output) = 0;
virtual String toString() = 0;
};
#endif

View file

@ -22,409 +22,432 @@
#include "lwip/netif.h"
#include "StreamString.h"
#ifndef CONFIG_LWIP_IPV6
#define IP6_NO_ZONE 0
#endif
IPAddress::IPAddress() : IPAddress(IPv4) {}
IPAddress::IPAddress(IPType ip_type)
{
_type = ip_type;
_zone = IP6_NO_ZONE;
memset(_address.bytes, 0, sizeof(_address.bytes));
IPAddress::IPAddress(IPType ip_type) {
_type = ip_type;
_zone = IP6_NO_ZONE;
memset(_address.bytes, 0, sizeof(_address.bytes));
}
IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
{
_type = IPv4;
_zone = IP6_NO_ZONE;
memset(_address.bytes, 0, sizeof(_address.bytes));
_address.bytes[IPADDRESS_V4_BYTES_INDEX] = first_octet;
_address.bytes[IPADDRESS_V4_BYTES_INDEX + 1] = second_octet;
_address.bytes[IPADDRESS_V4_BYTES_INDEX + 2] = third_octet;
_address.bytes[IPADDRESS_V4_BYTES_INDEX + 3] = fourth_octet;
IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet) {
_type = IPv4;
_zone = IP6_NO_ZONE;
memset(_address.bytes, 0, sizeof(_address.bytes));
_address.bytes[IPADDRESS_V4_BYTES_INDEX] = first_octet;
_address.bytes[IPADDRESS_V4_BYTES_INDEX + 1] = second_octet;
_address.bytes[IPADDRESS_V4_BYTES_INDEX + 2] = third_octet;
_address.bytes[IPADDRESS_V4_BYTES_INDEX + 3] = fourth_octet;
}
IPAddress::IPAddress(uint8_t o1, uint8_t o2, uint8_t o3, uint8_t o4, uint8_t o5, uint8_t o6, uint8_t o7, uint8_t o8, uint8_t o9, uint8_t o10, uint8_t o11, uint8_t o12, uint8_t o13, uint8_t o14, uint8_t o15, uint8_t o16, uint8_t z) {
_type = IPv6;
_address.bytes[0] = o1;
_address.bytes[1] = o2;
_address.bytes[2] = o3;
_address.bytes[3] = o4;
_address.bytes[4] = o5;
_address.bytes[5] = o6;
_address.bytes[6] = o7;
_address.bytes[7] = o8;
_address.bytes[8] = o9;
_address.bytes[9] = o10;
_address.bytes[10] = o11;
_address.bytes[11] = o12;
_address.bytes[12] = o13;
_address.bytes[13] = o14;
_address.bytes[14] = o15;
_address.bytes[15] = o16;
_zone = z;
IPAddress::IPAddress(
uint8_t o1, uint8_t o2, uint8_t o3, uint8_t o4, uint8_t o5, uint8_t o6, uint8_t o7, uint8_t o8, uint8_t o9, uint8_t o10, uint8_t o11, uint8_t o12,
uint8_t o13, uint8_t o14, uint8_t o15, uint8_t o16, uint8_t z
) {
_type = IPv6;
_address.bytes[0] = o1;
_address.bytes[1] = o2;
_address.bytes[2] = o3;
_address.bytes[3] = o4;
_address.bytes[4] = o5;
_address.bytes[5] = o6;
_address.bytes[6] = o7;
_address.bytes[7] = o8;
_address.bytes[8] = o9;
_address.bytes[9] = o10;
_address.bytes[10] = o11;
_address.bytes[11] = o12;
_address.bytes[12] = o13;
_address.bytes[13] = o14;
_address.bytes[14] = o15;
_address.bytes[15] = o16;
_zone = z;
}
IPAddress::IPAddress(uint32_t address)
{
// IPv4 only
_type = IPv4;
_zone = IP6_NO_ZONE;
memset(_address.bytes, 0, sizeof(_address.bytes));
_address.dword[IPADDRESS_V4_DWORD_INDEX] = address;
IPAddress::IPAddress(uint32_t address) {
// IPv4 only
_type = IPv4;
_zone = IP6_NO_ZONE;
memset(_address.bytes, 0, sizeof(_address.bytes));
_address.dword[IPADDRESS_V4_DWORD_INDEX] = address;
// NOTE on conversion/comparison and uint32_t:
// These conversions are host platform dependent.
// There is a defined integer representation of IPv4 addresses,
// based on network byte order (will be the value on big endian systems),
// e.g. http://2398766798 is the same as http://142.250.70.206,
// However on little endian systems the octets 0x83, 0xFA, 0x46, 0xCE,
// in that order, will form the integer (uint32_t) 3460758158 .
// NOTE on conversion/comparison and uint32_t:
// These conversions are host platform dependent.
// There is a defined integer representation of IPv4 addresses,
// based on network byte order (will be the value on big endian systems),
// e.g. http://2398766798 is the same as http://142.250.70.206,
// However on little endian systems the octets 0x83, 0xFA, 0x46, 0xCE,
// in that order, will form the integer (uint32_t) 3460758158 .
}
IPAddress::IPAddress(const uint8_t *address) : IPAddress(IPv4, address) {}
IPAddress::IPAddress(IPType ip_type, const uint8_t *address, uint8_t z)
{
_type = ip_type;
if (ip_type == IPv4) {
memset(_address.bytes, 0, sizeof(_address.bytes));
memcpy(&_address.bytes[IPADDRESS_V4_BYTES_INDEX], address, sizeof(uint32_t));
_zone = 0;
} else {
memcpy(_address.bytes, address, sizeof(_address.bytes));
_zone = z;
}
IPAddress::IPAddress(IPType ip_type, const uint8_t *address, uint8_t z) {
_type = ip_type;
if (ip_type == IPv4) {
memset(_address.bytes, 0, sizeof(_address.bytes));
memcpy(&_address.bytes[IPADDRESS_V4_BYTES_INDEX], address, sizeof(uint32_t));
_zone = 0;
} else {
memcpy(_address.bytes, address, sizeof(_address.bytes));
_zone = z;
}
}
IPAddress::IPAddress(const char *address)
{
fromString(address);
IPAddress::IPAddress(const char *address) {
fromString(address);
}
IPAddress::IPAddress(const IPAddress& address)
{
*this = address;
IPAddress::IPAddress(const IPAddress &address) {
*this = address;
}
String IPAddress::toString(bool includeZone) const
{
StreamString s;
printTo(s, includeZone);
return String(s);
String IPAddress::toString(bool includeZone) const {
StreamString s;
printTo(s, includeZone);
return String(s);
}
bool IPAddress::fromString(const char *address) {
if (!fromString4(address)) {
return fromString6(address);
}
return true;
if (!fromString4(address)) {
return fromString6(address);
}
return true;
}
bool IPAddress::fromString4(const char *address)
{
// TODO: add support for "a", "a.b", "a.b.c" formats
bool IPAddress::fromString4(const char *address) {
// TODO: add support for "a", "a.b", "a.b.c" formats
int16_t acc = -1; // Accumulator
uint8_t dots = 0;
int16_t acc = -1; // Accumulator
uint8_t dots = 0;
memset(_address.bytes, 0, sizeof(_address.bytes));
while (*address)
{
char c = *address++;
if (c >= '0' && c <= '9')
{
acc = (acc < 0) ? (c - '0') : acc * 10 + (c - '0');
if (acc > 255) {
// Value out of [0..255] range
return false;
}
}
else if (c == '.')
{
if (dots == 3) {
// Too many dots (there must be 3 dots)
return false;
}
if (acc < 0) {
/* No value between dots, e.g. '1..' */
return false;
}
_address.bytes[IPADDRESS_V4_BYTES_INDEX + dots++] = acc;
acc = -1;
}
else
{
// Invalid char
return false;
}
}
if (dots != 3) {
// Too few dots (there must be 3 dots)
memset(_address.bytes, 0, sizeof(_address.bytes));
while (*address) {
char c = *address++;
if (c >= '0' && c <= '9') {
acc = (acc < 0) ? (c - '0') : acc * 10 + (c - '0');
if (acc > 255) {
// Value out of [0..255] range
return false;
}
if (acc < 0) {
}
} else if (c == '.') {
if (dots == 3) {
// Too many dots (there must be 3 dots)
return false;
}
if (acc < 0) {
/* No value between dots, e.g. '1..' */
return false;
}
_address.bytes[IPADDRESS_V4_BYTES_INDEX + dots++] = acc;
acc = -1;
} else {
// Invalid char
return false;
}
_address.bytes[IPADDRESS_V4_BYTES_INDEX + 3] = acc;
_type = IPv4;
return true;
}
if (dots != 3) {
// Too few dots (there must be 3 dots)
return false;
}
if (acc < 0) {
/* No value between dots, e.g. '1..' */
return false;
}
_address.bytes[IPADDRESS_V4_BYTES_INDEX + 3] = acc;
_type = IPv4;
return true;
}
bool IPAddress::fromString6(const char *address) {
uint32_t acc = 0; // Accumulator
int colons = 0, double_colons = -1;
uint32_t acc = 0; // Accumulator
int colons = 0, double_colons = -1;
while (*address)
{
char c = tolower(*address++);
if (isalnum(c) && c <= 'f') {
if (c >= 'a')
c -= 'a' - '0' - 10;
acc = acc * 16 + (c - '0');
if (acc > 0xffff)
// Value out of range
return false;
}
else if (c == ':') {
if (*address == ':') {
if (double_colons >= 0) {
// :: allowed once
return false;
}
if (*address != '\0' && *(address + 1) == ':') {
// ::: not allowed
return false;
}
// remember location
double_colons = colons + !!acc;
address++;
} else if (*address == '\0') {
// can't end with a single colon
return false;
}
if (colons == 7)
// too many separators
return false;
_address.bytes[colons * 2] = acc >> 8;
_address.bytes[colons * 2 + 1] = acc & 0xff;
colons++;
acc = 0;
}
else if (c == '%') {
_zone = netif_name_to_index(address);
while(*address != '\0'){
address++;
}
}
else
// Invalid char
return false;
}
if (double_colons == -1 && colons != 7) {
// Too few separators
while (*address) {
char c = tolower(*address++);
if (isalnum(c) && c <= 'f') {
if (c >= 'a') {
c -= 'a' - '0' - 10;
}
acc = acc * 16 + (c - '0');
if (acc > 0xffff) {
// Value out of range
return false;
}
if (double_colons > -1 && colons > 6) {
// Too many segments (double colon must be at least one zero field)
}
} else if (c == ':') {
if (*address == ':') {
if (double_colons >= 0) {
// :: allowed once
return false;
}
if (*address != '\0' && *(address + 1) == ':') {
// ::: not allowed
return false;
}
// remember location
double_colons = colons + !!acc;
address++;
} else if (*address == '\0') {
// can't end with a single colon
return false;
}
if (colons == 7) {
// too many separators
return false;
}
_address.bytes[colons * 2] = acc >> 8;
_address.bytes[colons * 2 + 1] = acc & 0xff;
colons++;
acc = 0;
} else if (c == '%') {
// netif_index_to_name crashes on latest esp-idf
// _zone = netif_name_to_index(address);
// in the interim, we parse the suffix as a zone number
while ((*address != '\0') && (!isdigit(*address))) { // skip all non-digit after '%'
address++;
}
_zone = atol(address) + 1; // increase by one by convention, so we can have zone '0'
while (*address != '\0') {
address++;
}
} else {
// Invalid char
return false;
}
_address.bytes[colons * 2] = acc >> 8;
_address.bytes[colons * 2 + 1] = acc & 0xff;
colons++;
}
if (double_colons != -1) {
for (int i = colons * 2 - double_colons * 2 - 1; i >= 0; i--)
_address.bytes[16 - colons * 2 + double_colons * 2 + i] = _address.bytes[double_colons * 2 + i];
for (int i = double_colons * 2; i < 16 - colons * 2 + double_colons * 2; i++)
_address.bytes[i] = 0;
if (double_colons == -1 && colons != 7) {
// Too few separators
return false;
}
if (double_colons > -1 && colons > 6) {
// Too many segments (double colon must be at least one zero field)
return false;
}
_address.bytes[colons * 2] = acc >> 8;
_address.bytes[colons * 2 + 1] = acc & 0xff;
colons++;
if (double_colons != -1) {
for (int i = colons * 2 - double_colons * 2 - 1; i >= 0; i--) {
_address.bytes[16 - colons * 2 + double_colons * 2 + i] = _address.bytes[double_colons * 2 + i];
}
for (int i = double_colons * 2; i < 16 - colons * 2 + double_colons * 2; i++) {
_address.bytes[i] = 0;
}
}
_type = IPv6;
return true;
_type = IPv6;
return true;
}
IPAddress& IPAddress::operator=(const uint8_t *address)
{
// IPv4 only conversion from byte pointer
_type = IPv4;
memset(_address.bytes, 0, sizeof(_address.bytes));
memcpy(&_address.bytes[IPADDRESS_V4_BYTES_INDEX], address, sizeof(uint32_t));
return *this;
IPAddress &IPAddress::operator=(const uint8_t *address) {
// IPv4 only conversion from byte pointer
_type = IPv4;
memset(_address.bytes, 0, sizeof(_address.bytes));
memcpy(&_address.bytes[IPADDRESS_V4_BYTES_INDEX], address, sizeof(uint32_t));
return *this;
}
IPAddress& IPAddress::operator=(const char *address)
{
fromString(address);
return *this;
IPAddress &IPAddress::operator=(const char *address) {
fromString(address);
return *this;
}
IPAddress& IPAddress::operator=(uint32_t address)
{
// IPv4 conversion
// See note on conversion/comparison and uint32_t
_type = IPv4;
memset(_address.bytes, 0, sizeof(_address.bytes));
_address.dword[IPADDRESS_V4_DWORD_INDEX] = address;
return *this;
IPAddress &IPAddress::operator=(uint32_t address) {
// IPv4 conversion
// See note on conversion/comparison and uint32_t
_type = IPv4;
memset(_address.bytes, 0, sizeof(_address.bytes));
_address.dword[IPADDRESS_V4_DWORD_INDEX] = address;
return *this;
}
IPAddress& IPAddress::operator=(const IPAddress& address){
_type = address.type();
_zone = address.zone();
memcpy(_address.bytes, address._address.bytes, sizeof(_address.bytes));
return *this;
IPAddress &IPAddress::operator=(const IPAddress &address) {
_type = address.type();
_zone = address.zone();
memcpy(_address.bytes, address._address.bytes, sizeof(_address.bytes));
return *this;
}
bool IPAddress::operator==(const IPAddress& addr) const {
return (addr._type == _type)
&& (memcmp(addr._address.bytes, _address.bytes, sizeof(_address.bytes)) == 0);
bool IPAddress::operator==(const IPAddress &addr) const {
return (addr._type == _type) && (_type == IPType::IPv4 ? addr._address.dword[IPADDRESS_V4_DWORD_INDEX] == _address.dword[IPADDRESS_V4_DWORD_INDEX] : memcmp(addr._address.bytes, _address.bytes, sizeof(_address.bytes)) == 0);
}
bool IPAddress::operator==(const uint8_t* addr) const
{
// IPv4 only comparison to byte pointer
// Can't support IPv6 as we know our type, but not the length of the pointer
return _type == IPv4 && memcmp(addr, &_address.bytes[IPADDRESS_V4_BYTES_INDEX], sizeof(uint32_t)) == 0;
bool IPAddress::operator==(const uint8_t *addr) const {
// IPv4 only comparison to byte pointer
// Can't support IPv6 as we know our type, but not the length of the pointer
return _type == IPv4 && memcmp(addr, &_address.bytes[IPADDRESS_V4_BYTES_INDEX], sizeof(uint32_t)) == 0;
}
uint8_t IPAddress::operator[](int index) const {
if (_type == IPv4) {
return _address.bytes[IPADDRESS_V4_BYTES_INDEX + index];
}
return _address.bytes[index];
if (_type == IPv4) {
return _address.bytes[IPADDRESS_V4_BYTES_INDEX + index];
}
return _address.bytes[index];
}
uint8_t& IPAddress::operator[](int index) {
if (_type == IPv4) {
return _address.bytes[IPADDRESS_V4_BYTES_INDEX + index];
}
return _address.bytes[index];
uint8_t &IPAddress::operator[](int index) {
if (_type == IPv4) {
return _address.bytes[IPADDRESS_V4_BYTES_INDEX + index];
}
return _address.bytes[index];
}
size_t IPAddress::printTo(Print& p) const
{
return printTo(p, false);
size_t IPAddress::printTo(Print &p) const {
return printTo(p, false);
}
size_t IPAddress::printTo(Print& p, bool includeZone) const
{
size_t n = 0;
size_t IPAddress::printTo(Print &p, bool includeZone) const {
size_t n = 0;
if (_type == IPv6) {
// IPv6 IETF canonical format: compress left-most longest run of two or more zero fields, lower case
int8_t longest_start = -1;
int8_t longest_length = 1;
int8_t current_start = -1;
int8_t current_length = 0;
for (int8_t f = 0; f < 8; f++) {
if (_address.bytes[f * 2] == 0 && _address.bytes[f * 2 + 1] == 0) {
if (current_start == -1) {
current_start = f;
current_length = 1;
} else {
current_length++;
}
if (current_length > longest_length) {
longest_start = current_start;
longest_length = current_length;
}
} else {
current_start = -1;
}
if (_type == IPv6) {
// IPv6 IETF canonical format: compress left-most longest run of two or more zero fields, lower case
int8_t longest_start = -1;
int8_t longest_length = 1;
int8_t current_start = -1;
int8_t current_length = 0;
for (int8_t f = 0; f < 8; f++) {
if (_address.bytes[f * 2] == 0 && _address.bytes[f * 2 + 1] == 0) {
if (current_start == -1) {
current_start = f;
current_length = 1;
} else {
current_length++;
}
for (int f = 0; f < 8; f++) {
if (f < longest_start || f >= longest_start + longest_length) {
uint8_t c1 = _address.bytes[f * 2] >> 4;
uint8_t c2 = _address.bytes[f * 2] & 0xf;
uint8_t c3 = _address.bytes[f * 2 + 1] >> 4;
uint8_t c4 = _address.bytes[f * 2 + 1] & 0xf;
if (c1 > 0) {
n += p.print((char)(c1 < 10 ? '0' + c1 : 'a' + c1 - 10));
}
if (c1 > 0 || c2 > 0) {
n += p.print((char)(c2 < 10 ? '0' + c2 : 'a' + c2 - 10));
}
if (c1 > 0 || c2 > 0 || c3 > 0) {
n += p.print((char)(c3 < 10 ? '0' + c3 : 'a' + c3 - 10));
}
n += p.print((char)(c4 < 10 ? '0' + c4 : 'a' + c4 - 10));
if (f < 7) {
n += p.print(':');
}
} else if (f == longest_start) {
if (longest_start == 0) {
n += p.print(':');
}
n += p.print(':');
}
if (current_length > longest_length) {
longest_start = current_start;
longest_length = current_length;
}
// add a zone if zone-id is non-zero
if(_zone > 0 && includeZone){
n += p.print('%');
char if_name[NETIF_NAMESIZE];
netif_index_to_name(_zone, if_name);
n += p.print(if_name);
}
return n;
} else {
current_start = -1;
}
}
// IPv4
for (int i =0; i < 3; i++)
{
n += p.print(_address.bytes[IPADDRESS_V4_BYTES_INDEX + i], DEC);
n += p.print('.');
for (int f = 0; f < 8; f++) {
if (f < longest_start || f >= longest_start + longest_length) {
uint8_t c1 = _address.bytes[f * 2] >> 4;
uint8_t c2 = _address.bytes[f * 2] & 0xf;
uint8_t c3 = _address.bytes[f * 2 + 1] >> 4;
uint8_t c4 = _address.bytes[f * 2 + 1] & 0xf;
if (c1 > 0) {
n += p.print((char)(c1 < 10 ? '0' + c1 : 'a' + c1 - 10));
}
if (c1 > 0 || c2 > 0) {
n += p.print((char)(c2 < 10 ? '0' + c2 : 'a' + c2 - 10));
}
if (c1 > 0 || c2 > 0 || c3 > 0) {
n += p.print((char)(c3 < 10 ? '0' + c3 : 'a' + c3 - 10));
}
n += p.print((char)(c4 < 10 ? '0' + c4 : 'a' + c4 - 10));
if (f < 7) {
n += p.print(':');
}
} else if (f == longest_start) {
if (longest_start == 0) {
n += p.print(':');
}
n += p.print(':');
}
}
// add a zone if zone-id is non-zero (causes exception on recent IDF builds)
// if (_zone > 0 && includeZone) {
// n += p.print('%');
// char if_name[NETIF_NAMESIZE];
// netif_index_to_name(_zone, if_name);
// n += p.print(if_name);
// }
// In the interim, we just output the index number
if (_zone > 0 && includeZone) {
n += p.print('%');
// look for the interface name
for (netif *intf = netif_list; intf != nullptr; intf = intf->next) {
if (_zone - 1 == intf->num) {
n += p.print(intf->name[0]);
n += p.print(intf->name[1]);
break;
}
}
n += p.print(_zone - 1);
}
n += p.print(_address.bytes[IPADDRESS_V4_BYTES_INDEX + 3], DEC);
return n;
}
// IPv4
for (int i = 0; i < 3; i++) {
n += p.print(_address.bytes[IPADDRESS_V4_BYTES_INDEX + i], DEC);
n += p.print('.');
}
n += p.print(_address.bytes[IPADDRESS_V4_BYTES_INDEX + 3], DEC);
return n;
}
IPAddress::IPAddress(const ip_addr_t *addr){
from_ip_addr_t(addr);
IPAddress::IPAddress(const ip_addr_t *addr) {
from_ip_addr_t(addr);
}
void IPAddress::to_ip_addr_t(ip_addr_t* addr) const {
if(_type == IPv6){
addr->type = IPADDR_TYPE_V6;
addr->u_addr.ip6.addr[0] = _address.dword[0];
addr->u_addr.ip6.addr[1] = _address.dword[1];
addr->u_addr.ip6.addr[2] = _address.dword[2];
addr->u_addr.ip6.addr[3] = _address.dword[3];
void IPAddress::to_ip_addr_t(ip_addr_t *addr) const {
#if CONFIG_LWIP_IPV6
if (_type == IPv6) {
addr->type = IPADDR_TYPE_V6;
addr->u_addr.ip6.addr[0] = _address.dword[0];
addr->u_addr.ip6.addr[1] = _address.dword[1];
addr->u_addr.ip6.addr[2] = _address.dword[2];
addr->u_addr.ip6.addr[3] = _address.dword[3];
#if LWIP_IPV6_SCOPES
addr->u_addr.ip6.zone = _zone;
addr->u_addr.ip6.zone = _zone;
#endif /* LWIP_IPV6_SCOPES */
} else {
addr->type = IPADDR_TYPE_V4;
addr->u_addr.ip4.addr = _address.dword[IPADDRESS_V4_DWORD_INDEX];
}
} else {
addr->type = IPADDR_TYPE_V4;
addr->u_addr.ip4.addr = _address.dword[IPADDRESS_V4_DWORD_INDEX];
}
#else
addr->addr = _address.dword[IPADDRESS_V4_DWORD_INDEX];
#endif
}
IPAddress& IPAddress::from_ip_addr_t(const ip_addr_t* addr){
if(addr->type == IPADDR_TYPE_V6){
_type = IPv6;
_address.dword[0] = addr->u_addr.ip6.addr[0];
_address.dword[1] = addr->u_addr.ip6.addr[1];
_address.dword[2] = addr->u_addr.ip6.addr[2];
_address.dword[3] = addr->u_addr.ip6.addr[3];
IPAddress &IPAddress::from_ip_addr_t(const ip_addr_t *addr) {
#if CONFIG_LWIP_IPV6
if (addr->type == IPADDR_TYPE_V6) {
_type = IPv6;
_address.dword[0] = addr->u_addr.ip6.addr[0];
_address.dword[1] = addr->u_addr.ip6.addr[1];
_address.dword[2] = addr->u_addr.ip6.addr[2];
_address.dword[3] = addr->u_addr.ip6.addr[3];
#if LWIP_IPV6_SCOPES
_zone = addr->u_addr.ip6.zone;
_zone = addr->u_addr.ip6.zone;
#endif /* LWIP_IPV6_SCOPES */
} else {
_type = IPv4;
_address.dword[IPADDRESS_V4_DWORD_INDEX] = addr->u_addr.ip4.addr;
}
return *this;
} else {
#endif
_type = IPv4;
memset(_address.bytes, 0, sizeof(_address.bytes));
#if CONFIG_LWIP_IPV6
_address.dword[IPADDRESS_V4_DWORD_INDEX] = addr->u_addr.ip4.addr;
#else
_address.dword[IPADDRESS_V4_DWORD_INDEX] = addr->addr;
#endif
#if CONFIG_LWIP_IPV6
}
#endif
return *this;
}
#if CONFIG_LWIP_IPV6
esp_ip6_addr_type_t IPAddress::addr_type() const {
if(_type != IPv6){
return ESP_IP6_ADDR_IS_UNKNOWN;
}
ip_addr_t addr;
to_ip_addr_t(&addr);
return esp_netif_ip6_get_addr_type((esp_ip6_addr_t*)(&(addr.u_addr.ip6)));
if (_type != IPv6) {
return ESP_IP6_ADDR_IS_UNKNOWN;
}
ip_addr_t addr;
to_ip_addr_t(&addr);
return esp_netif_ip6_get_addr_type((esp_ip6_addr_t *)(&(addr.u_addr.ip6)));
}
#endif
#if CONFIG_LWIP_IPV6
const IPAddress IN6ADDR_ANY(IPv6);
const IPAddress INADDR_NONE(0,0,0,0);
#endif
const IPAddress INADDR_NONE(0, 0, 0, 0);

View file

@ -24,6 +24,7 @@
#include "WString.h"
#include "lwip/ip_addr.h"
#include "esp_netif_ip_addr.h"
#include "sdkconfig.h"
#define IPADDRESS_V4_BYTES_INDEX 12
#define IPADDRESS_V4_DWORD_INDEX 3
@ -31,88 +32,108 @@
// A class to make it easier to handle and pass around IP addresses
enum IPType {
IPv4,
IPv6
IPv4,
IPv6
};
class IPAddress : public Printable {
private:
union {
uint8_t bytes[16];
uint32_t dword[4];
} _address;
IPType _type;
uint8_t _zone;
union {
uint8_t bytes[16];
uint32_t dword[4];
} _address;
IPType _type;
uint8_t _zone;
// Access the raw byte array containing the address. Because this returns a pointer
// to the internal structure rather than a copy of the address this function should only
// be used when you know that the usage of the returned uint8_t* will be transient and not
// stored.
uint8_t* raw_address() { return _type == IPv4 ? &_address.bytes[IPADDRESS_V4_BYTES_INDEX] : _address.bytes; }
// Access the raw byte array containing the address. Because this returns a pointer
// to the internal structure rather than a copy of the address this function should only
// be used when you know that the usage of the returned uint8_t* will be transient and not
// stored.
uint8_t *raw_address() {
return _type == IPv4 ? &_address.bytes[IPADDRESS_V4_BYTES_INDEX] : _address.bytes;
}
public:
// Constructors
// Constructors
// Default IPv4
IPAddress();
IPAddress(IPType ip_type);
IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet);
IPAddress(uint8_t o1, uint8_t o2, uint8_t o3, uint8_t o4, uint8_t o5, uint8_t o6, uint8_t o7, uint8_t o8, uint8_t o9, uint8_t o10, uint8_t o11, uint8_t o12, uint8_t o13, uint8_t o14, uint8_t o15, uint8_t o16, uint8_t z=0);
// IPv4; see implementation note
IPAddress(uint32_t address);
// Default IPv4
IPAddress(const uint8_t *address);
IPAddress(IPType ip_type, const uint8_t *address, uint8_t z=0);
// If IPv4 fails tries IPv6 see fromString function
IPAddress(const char *address);
IPAddress(const IPAddress& address);
// Default IPv4
IPAddress();
IPAddress(IPType ip_type);
IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet);
IPAddress(
uint8_t o1, uint8_t o2, uint8_t o3, uint8_t o4, uint8_t o5, uint8_t o6, uint8_t o7, uint8_t o8, uint8_t o9, uint8_t o10, uint8_t o11, uint8_t o12,
uint8_t o13, uint8_t o14, uint8_t o15, uint8_t o16, uint8_t z = 0
);
// IPv4; see implementation note
IPAddress(uint32_t address);
// Default IPv4
IPAddress(const uint8_t *address);
IPAddress(IPType ip_type, const uint8_t *address, uint8_t z = 0);
// If IPv4 fails tries IPv6 see fromString function
IPAddress(const char *address);
IPAddress(const IPAddress &address);
bool fromString(const char *address);
bool fromString(const String &address) { return fromString(address.c_str()); }
bool fromString(const char *address);
bool fromString(const String &address) {
return fromString(address.c_str());
}
// Overloaded cast operator to allow IPAddress objects to be used where a uint32_t is expected
// NOTE: IPv4 only; see implementation note
operator uint32_t() const { return _type == IPv4 ? _address.dword[IPADDRESS_V4_DWORD_INDEX] : 0; };
// Overloaded cast operator to allow IPAddress objects to be used where a uint32_t is expected
// NOTE: IPv4 only; see implementation note
operator uint32_t() const {
return _type == IPv4 ? _address.dword[IPADDRESS_V4_DWORD_INDEX] : 0;
};
bool operator==(const IPAddress& addr) const;
bool operator!=(const IPAddress& addr) const { return !(*this == addr); };
bool operator==(const IPAddress &addr) const;
bool operator!=(const IPAddress &addr) const {
return !(*this == addr);
};
// NOTE: IPv4 only; we don't know the length of the pointer
bool operator==(const uint8_t* addr) const;
// NOTE: IPv4 only; we don't know the length of the pointer
bool operator==(const uint8_t *addr) const;
// Overloaded index operator to allow getting and setting individual octets of the address
uint8_t operator[](int index) const;
uint8_t& operator[](int index);
// Overloaded index operator to allow getting and setting individual octets of the address
uint8_t operator[](int index) const;
uint8_t &operator[](int index);
// Overloaded copy operators to allow initialisation of IPAddress objects from other types
// NOTE: IPv4 only
IPAddress& operator=(const uint8_t *address);
// NOTE: IPv4 only; see implementation note
IPAddress& operator=(uint32_t address);
// If IPv4 fails tries IPv6 see fromString function
IPAddress& operator=(const char *address);
IPAddress& operator=(const IPAddress& address);
// Overloaded copy operators to allow initialization of IPAddress objects from other types
// NOTE: IPv4 only
IPAddress &operator=(const uint8_t *address);
// NOTE: IPv4 only; see implementation note
IPAddress &operator=(uint32_t address);
// If IPv4 fails tries IPv6 see fromString function
IPAddress &operator=(const char *address);
IPAddress &operator=(const IPAddress &address);
virtual size_t printTo(Print& p) const;
String toString(bool includeZone = false) const;
virtual size_t printTo(Print &p) const;
String toString(bool includeZone = false) const;
IPType type() const { return _type; }
IPType type() const {
return _type;
}
// Espresif LwIP conversions
IPAddress(const ip_addr_t *addr);
void to_ip_addr_t(ip_addr_t* addr) const;
IPAddress& from_ip_addr_t(const ip_addr_t* addr);
esp_ip6_addr_type_t addr_type() const;
uint8_t zone() const { return (type() == IPv6)?_zone:0; }
size_t printTo(Print& p, bool includeZone) const;
// Espresif LwIP conversions
IPAddress(const ip_addr_t *addr);
void to_ip_addr_t(ip_addr_t *addr) const;
IPAddress &from_ip_addr_t(const ip_addr_t *addr);
#if CONFIG_LWIP_IPV6
esp_ip6_addr_type_t addr_type() const;
#endif
uint8_t zone() const {
return (type() == IPv6) ? _zone : 0;
}
size_t printTo(Print &p, bool includeZone) const;
friend class UDP;
friend class Client;
friend class Server;
friend class UDP;
friend class Client;
friend class Server;
friend class EthernetClass;
friend class DhcpClass;
friend class DNSClient;
protected:
bool fromString4(const char *address);
bool fromString6(const char *address);
bool fromString4(const char *address);
bool fromString6(const char *address);
};
extern const IPAddress IN6ADDR_ANY;

View file

@ -1,7 +1,7 @@
/*
/*
Copyright (c) 2015 Hristo Gochkov. All rights reserved.
This file is part of the esp8266 core for Arduino environment.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
@ -21,87 +21,79 @@
#include <HEXBuilder.h>
#include <MD5Builder.h>
void MD5Builder::begin(void)
{
memset(_buf, 0x00, ESP_ROM_MD5_DIGEST_LEN);
esp_rom_md5_init(&_ctx);
void MD5Builder::begin(void) {
memset(_buf, 0x00, ESP_ROM_MD5_DIGEST_LEN);
esp_rom_md5_init(&_ctx);
}
void MD5Builder::add(const uint8_t * data, size_t len)
{
esp_rom_md5_update(&_ctx, data, len);
void MD5Builder::add(const uint8_t *data, size_t len) {
esp_rom_md5_update(&_ctx, data, len);
}
void MD5Builder::addHexString(const char * data)
{
size_t len = strlen(data);
uint8_t * tmp = (uint8_t*)malloc(len/2);
if(tmp == NULL) {
return;
void MD5Builder::addHexString(const char *data) {
size_t len = strlen(data);
uint8_t *tmp = (uint8_t *)malloc(len / 2);
if (tmp == NULL) {
return;
}
hex2bytes(tmp, len / 2, data);
add(tmp, len / 2);
free(tmp);
}
bool MD5Builder::addStream(Stream &stream, const size_t maxLen) {
const int buf_size = 512;
int maxLengthLeft = maxLen;
uint8_t *buf = (uint8_t *)malloc(buf_size);
if (!buf) {
return false;
}
int bytesAvailable = stream.available();
while ((bytesAvailable > 0) && (maxLengthLeft > 0)) {
// determine number of bytes to read
int readBytes = bytesAvailable;
if (readBytes > maxLengthLeft) {
readBytes = maxLengthLeft; // read only until max_len
}
hex2bytes(tmp, len/2, data);
add(tmp, len/2);
free(tmp);
}
bool MD5Builder::addStream(Stream & stream, const size_t maxLen)
{
const int buf_size = 512;
int maxLengthLeft = maxLen;
uint8_t * buf = (uint8_t*) malloc(buf_size);
if(!buf) {
return false;
if (readBytes > buf_size) {
readBytes = buf_size; // not read more the buffer can handle
}
int bytesAvailable = stream.available();
while((bytesAvailable > 0) && (maxLengthLeft > 0)) {
// determine number of bytes to read
int readBytes = bytesAvailable;
if(readBytes > maxLengthLeft) {
readBytes = maxLengthLeft ; // read only until max_len
}
if(readBytes > buf_size) {
readBytes = buf_size; // not read more the buffer can handle
}
// read data and check if we got something
int numBytesRead = stream.readBytes(buf, readBytes);
if(numBytesRead< 1) {
free(buf);
return false;
}
// Update MD5 with buffer payload
esp_rom_md5_update(&_ctx, buf, numBytesRead);
// update available number of bytes
maxLengthLeft -= numBytesRead;
bytesAvailable = stream.available();
// read data and check if we got something
int numBytesRead = stream.readBytes(buf, readBytes);
if (numBytesRead < 1) {
free(buf);
return false;
}
free(buf);
return true;
// Update MD5 with buffer payload
esp_rom_md5_update(&_ctx, buf, numBytesRead);
// update available number of bytes
maxLengthLeft -= numBytesRead;
bytesAvailable = stream.available();
}
free(buf);
return true;
}
void MD5Builder::calculate(void)
{
esp_rom_md5_final(_buf, &_ctx);
void MD5Builder::calculate(void) {
esp_rom_md5_final(_buf, &_ctx);
}
void MD5Builder::getBytes(uint8_t * output)
{
memcpy(output, _buf, ESP_ROM_MD5_DIGEST_LEN);
void MD5Builder::getBytes(uint8_t *output) {
memcpy(output, _buf, ESP_ROM_MD5_DIGEST_LEN);
}
void MD5Builder::getChars(char * output)
{
bytes2hex(output, ESP_ROM_MD5_DIGEST_LEN*2+1, _buf, ESP_ROM_MD5_DIGEST_LEN);
void MD5Builder::getChars(char *output) {
bytes2hex(output, ESP_ROM_MD5_DIGEST_LEN * 2 + 1, _buf, ESP_ROM_MD5_DIGEST_LEN);
}
String MD5Builder::toString(void)
{
char out[(ESP_ROM_MD5_DIGEST_LEN * 2) + 1];
getChars(out);
return String(out);
String MD5Builder::toString(void) {
char out[(ESP_ROM_MD5_DIGEST_LEN * 2) + 1];
getChars(out);
return String(out);
}

View file

@ -29,25 +29,25 @@
#include "HashBuilder.h"
class MD5Builder : public HashBuilder
{
class MD5Builder : public HashBuilder {
private:
md5_context_t _ctx;
uint8_t _buf[ESP_ROM_MD5_DIGEST_LEN];
md5_context_t _ctx;
uint8_t _buf[ESP_ROM_MD5_DIGEST_LEN];
public:
void begin(void) override;
void begin(void) override;
using HashBuilder::add;
void add(const uint8_t * data, size_t len) override;
using HashBuilder::add;
void add(const uint8_t *data, size_t len) override;
using HashBuilder::addHexString;
void addHexString(const char * data) override;
using HashBuilder::addHexString;
void addHexString(const char *data) override;
bool addStream(Stream & stream, const size_t maxLen) override;
void calculate(void) override;
void getBytes(uint8_t * output) override;
void getChars(char * output) override;
String toString(void) override;
bool addStream(Stream &stream, const size_t maxLen) override;
void calculate(void) override;
void getBytes(uint8_t *output) override;
void getChars(char *output) override;
String toString(void) override;
};
#endif

228
cores/esp32/MacAddress.cpp Normal file
View file

@ -0,0 +1,228 @@
#include <MacAddress.h>
#include <stdio.h>
#include <Print.h>
//Default constructor, blank mac address.
MacAddress::MacAddress() : MacAddress(MAC6) {}
MacAddress::MacAddress(MACType mac_type) {
_type = mac_type;
memset(_mac.bytes, 0, sizeof(_mac.bytes));
}
MacAddress::MacAddress(MACType mac_type, uint64_t mac) {
_type = mac_type;
_mac.val = mac;
}
MacAddress::MacAddress(MACType mac_type, const uint8_t *macbytearray) {
_type = mac_type;
memset(_mac.bytes, 0, sizeof(_mac.bytes));
if (_type == MAC6) {
memcpy(_mac.bytes, macbytearray, 6);
} else {
memcpy(_mac.bytes, macbytearray, 8);
}
}
MacAddress::MacAddress(const char *macstr) {
fromString(macstr);
}
MacAddress::MacAddress(const String &macstr) {
fromString(macstr.c_str());
}
MacAddress::MacAddress(uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4, uint8_t b5, uint8_t b6) {
_type = MAC6;
memset(_mac.bytes, 0, sizeof(_mac.bytes));
_mac.bytes[0] = b1;
_mac.bytes[1] = b2;
_mac.bytes[2] = b3;
_mac.bytes[3] = b4;
_mac.bytes[4] = b5;
_mac.bytes[5] = b6;
}
MacAddress::MacAddress(uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4, uint8_t b5, uint8_t b6, uint8_t b7, uint8_t b8) {
_type = MAC8;
_mac.bytes[0] = b1;
_mac.bytes[1] = b2;
_mac.bytes[2] = b3;
_mac.bytes[3] = b4;
_mac.bytes[4] = b5;
_mac.bytes[5] = b6;
_mac.bytes[6] = b7;
_mac.bytes[7] = b8;
}
//Parse user entered string into MAC address
bool MacAddress::fromString(const char *buf) {
if (strlen(buf) == 17) {
return fromString6(buf);
} else if (strlen(buf) == 23) {
return fromString8(buf);
}
return false;
}
//Parse user entered string into MAC address
bool MacAddress::fromString6(const char *buf) {
char cs[18]; // 17 + 1 for null terminator
char *token;
char *next; //Unused but required
int i;
strncpy(cs, buf, sizeof(cs) - 1); //strtok modifies the buffer: copy to working buffer.
for (i = 0; i < 6; i++) {
token = strtok((i == 0) ? cs : NULL, ":"); //Find first or next token
if (!token) { //No more tokens found
return false;
}
_mac.bytes[i] = strtol(token, &next, 16);
}
_type = MAC6;
return true;
}
bool MacAddress::fromString8(const char *buf) {
char cs[24]; // 23 + 1 for null terminator
char *token;
char *next; //Unused but required
int i;
strncpy(cs, buf, sizeof(cs) - 1); //strtok modifies the buffer: copy to working buffer.
for (i = 0; i < 8; i++) {
token = strtok((i == 0) ? cs : NULL, ":"); //Find first or next token
if (!token) { //No more tokens found
return false;
}
_mac.bytes[i] = strtol(token, &next, 16);
}
_type = MAC8;
return true;
}
//Copy MAC into byte array
void MacAddress::toBytes(uint8_t *buf) {
if (_type == MAC6) {
memcpy(buf, _mac.bytes, 6);
} else {
memcpy(buf, _mac.bytes, sizeof(_mac.bytes));
}
}
//Print MAC address into a C string.
//MAC: Buffer must be at least 18 chars
int MacAddress::toString(char *buf) {
if (_type == MAC6) {
return sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", _mac.bytes[0], _mac.bytes[1], _mac.bytes[2], _mac.bytes[3], _mac.bytes[4], _mac.bytes[5]);
} else {
return sprintf(
buf, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", _mac.bytes[0], _mac.bytes[1], _mac.bytes[2], _mac.bytes[3], _mac.bytes[4], _mac.bytes[5], _mac.bytes[6],
_mac.bytes[7]
);
}
}
String MacAddress::toString() const {
uint8_t bytes = (_type == MAC6) ? 18 : 24;
char buf[bytes];
if (_type == MAC6) {
snprintf(buf, sizeof(buf), "%02X:%02X:%02X:%02X:%02X:%02X", _mac.bytes[0], _mac.bytes[1], _mac.bytes[2], _mac.bytes[3], _mac.bytes[4], _mac.bytes[5]);
} else {
snprintf(
buf, sizeof(buf), "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", _mac.bytes[0], _mac.bytes[1], _mac.bytes[2], _mac.bytes[3], _mac.bytes[4], _mac.bytes[5],
_mac.bytes[6], _mac.bytes[7]
);
}
return String(buf);
}
uint64_t MacAddress::Value() {
return _mac.val;
}
//Allow getting individual octets of the address. e.g. uint8_t b0 = ma[0];
uint8_t MacAddress::operator[](int index) const {
index = EnforceIndexBounds(index);
return _mac.bytes[index];
}
//Allow setting individual octets of the address. e.g. ma[2] = 255;
uint8_t &MacAddress::operator[](int index) {
index = EnforceIndexBounds(index);
return _mac.bytes[index];
}
//Overloaded copy operator: init MacAddress object from byte array
MacAddress &MacAddress::operator=(const uint8_t *macbytearray) {
// 6-bytes MacAddress only
_type = MAC6;
memset(_mac.bytes, 0, sizeof(_mac.bytes));
memcpy(_mac.bytes, macbytearray, 6);
return *this;
}
//Overloaded copy operator: init MacAddress object from uint64_t
MacAddress &MacAddress::operator=(uint64_t macval) {
// 6-bytes MacAddress only
_type = MAC6;
_mac.val = macval;
return *this;
}
//Compare class to byte array
bool MacAddress::operator==(const uint8_t *macbytearray) const {
return !memcmp(_mac.bytes, macbytearray, 6);
}
//Allow comparing value of two classes
bool MacAddress::operator==(const MacAddress &mac2) const {
return _mac.val == mac2._mac.val;
}
//Type converter object to uint64_t [same as .Value()]
MacAddress::operator uint64_t() const {
return _mac.val;
}
//Type converter object to read only pointer to mac bytes. e.g. const uint8_t *ip_8 = ma;
MacAddress::operator const uint8_t *() const {
return _mac.bytes;
}
//Type converter object to read only pointer to mac value. e.g. const uint32_t *ip_64 = ma;
MacAddress::operator const uint64_t *() const {
return &_mac.val;
}
size_t MacAddress::printTo(Print &p) const {
uint8_t bytes = (_type == MAC6) ? 6 : 8;
size_t n = 0;
for (int i = 0; i < bytes; i++) {
if (i) {
n += p.print(':');
}
n += p.printf("%02X", _mac.bytes[i]);
}
return n;
}
//Bounds checking
int MacAddress::EnforceIndexBounds(int i) const {
if (i < 0) {
return 0;
}
if (_type == MAC6) {
if (i >= 6) {
return 5;
}
} else {
if (i >= 8) {
return 7;
}
}
return i;
}

104
cores/esp32/MacAddress.h Normal file
View file

@ -0,0 +1,104 @@
//-----------------------------------------------------------------------------
// MacAddress.h - class to make it easier to handle BSSID and MAC addresses.
//
// Copyright 2022 David McCurley
// Modified by Espressif Systems 2024
//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//-----------------------------------------------------------------------------
#ifndef MacAddress_h
#define MacAddress_h
#include <stdint.h>
#include <WString.h>
#include <Printable.h>
enum MACType {
MAC6,
MAC8
};
// A class to make it easier to handle and pass around MAC addresses, supporting both 6-byte and 8-byte MAC addresses.
class MacAddress : public Printable {
private:
union {
uint8_t bytes[8];
uint64_t val;
} _mac;
MACType _type;
public:
//Default MAC6
MacAddress();
MacAddress(MACType mac_type);
MacAddress(uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4, uint8_t b5, uint8_t b6);
MacAddress(uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4, uint8_t b5, uint8_t b6, uint8_t b7, uint8_t b8);
MacAddress(MACType mac_type, uint64_t mac);
MacAddress(MACType mac_type, const uint8_t *macbytearray);
//Default MAC6
MacAddress(uint64_t mac) : MacAddress(MAC6, mac) {}
MacAddress(const uint8_t *macbytearray) : MacAddress(MAC6, macbytearray) {}
MacAddress(const char *macstr);
MacAddress(const String &macstr);
virtual ~MacAddress() {}
bool fromString(const char *buf);
bool fromString(const String &macstr) {
return fromString(macstr.c_str());
}
void toBytes(uint8_t *buf);
int toString(char *buf);
String toString() const;
uint64_t Value();
uint8_t operator[](int index) const;
uint8_t &operator[](int index);
//MAC6 only
MacAddress &operator=(const uint8_t *macbytearray);
MacAddress &operator=(uint64_t macval);
bool operator==(const uint8_t *macbytearray) const;
bool operator==(const MacAddress &mac2) const;
operator uint64_t() const;
operator const uint8_t *() const;
operator const uint64_t *() const;
virtual size_t printTo(Print &p) const;
// future use in Arduino Networking
/*
friend class EthernetClass;
friend class UDP;
friend class Client;
friend class Server;
friend class DhcpClass;
friend class DNSClient;
*/
protected:
bool fromString6(const char *buf);
bool fromString8(const char *buf);
private:
int EnforceIndexBounds(int i) const;
};
#endif

View file

@ -29,351 +29,317 @@
#include "Print.h"
extern "C" {
#include "time.h"
#include "time.h"
}
// Public Methods //////////////////////////////////////////////////////////////
/* default implementation: may be overridden */
size_t Print::write(const uint8_t *buffer, size_t size)
{
size_t n = 0;
while(size--) {
n += write(*buffer++);
}
return n;
size_t Print::write(const uint8_t *buffer, size_t size) {
size_t n = 0;
while (size--) {
n += write(*buffer++);
}
return n;
}
size_t Print::vprintf(const char *format, va_list arg)
{
char loc_buf[64];
char * temp = loc_buf;
va_list copy;
va_copy(copy, arg);
int len = vsnprintf(temp, sizeof(loc_buf), format, copy);
va_end(copy);
if(len < 0) {
va_end(arg);
return 0;
}
if(len >= (int)sizeof(loc_buf)){ // comparation of same sign type for the compiler
temp = (char*) malloc(len+1);
if(temp == NULL) {
va_end(arg);
return 0;
}
len = vsnprintf(temp, len+1, format, arg);
}
size_t Print::vprintf(const char *format, va_list arg) {
char loc_buf[64];
char *temp = loc_buf;
va_list copy;
va_copy(copy, arg);
int len = vsnprintf(temp, sizeof(loc_buf), format, copy);
va_end(copy);
if (len < 0) {
va_end(arg);
len = write((uint8_t*)temp, len);
if(temp != loc_buf){
free(temp);
return 0;
}
if (len >= (int)sizeof(loc_buf)) { // comparison of same sign type for the compiler
temp = (char *)malloc(len + 1);
if (temp == NULL) {
va_end(arg);
return 0;
}
return len;
len = vsnprintf(temp, len + 1, format, arg);
}
va_end(arg);
len = write((uint8_t *)temp, len);
if (temp != loc_buf) {
free(temp);
}
return len;
}
size_t Print::printf(const __FlashStringHelper *ifsh, ...)
{
va_list arg;
va_start(arg, ifsh);
const char * format = (reinterpret_cast<const char *>(ifsh));
size_t ret = vprintf(format, arg);
va_end(arg);
return ret;
size_t Print::printf(const __FlashStringHelper *ifsh, ...) {
va_list arg;
va_start(arg, ifsh);
const char *format = (reinterpret_cast<const char *>(ifsh));
size_t ret = vprintf(format, arg);
va_end(arg);
return ret;
}
size_t Print::printf(const char *format, ...)
{
va_list arg;
va_start(arg, format);
size_t ret = vprintf(format, arg);
va_end(arg);
return ret;
size_t Print::printf(const char *format, ...) {
va_list arg;
va_start(arg, format);
size_t ret = vprintf(format, arg);
va_end(arg);
return ret;
}
size_t Print::print(const String &s)
{
return write(s.c_str(), s.length());
size_t Print::print(const String &s) {
return write(s.c_str(), s.length());
}
size_t Print::print(const char str[])
{
return write(str);
size_t Print::print(const char str[]) {
return write(str);
}
size_t Print::print(char c)
{
return write(c);
size_t Print::print(char c) {
return write(c);
}
size_t Print::print(unsigned char b, int base)
{
return print((unsigned long) b, base);
size_t Print::print(unsigned char b, int base) {
return print((unsigned long)b, base);
}
size_t Print::print(int n, int base)
{
return print((long) n, base);
size_t Print::print(int n, int base) {
return print((long)n, base);
}
size_t Print::print(unsigned int n, int base)
{
return print((unsigned long) n, base);
size_t Print::print(unsigned int n, int base) {
return print((unsigned long)n, base);
}
size_t Print::print(long n, int base)
{
int t = 0;
if (base == 10 && n < 0) {
t = print('-');
n = -n;
}
return printNumber(static_cast<unsigned long>(n), base) + t;
size_t Print::print(long n, int base) {
int t = 0;
if (base == 10 && n < 0) {
t = print('-');
n = -n;
}
return printNumber(static_cast<unsigned long>(n), base) + t;
}
size_t Print::print(unsigned long n, int base)
{
if(base == 0) {
return write(n);
} else {
return printNumber(n, base);
}
size_t Print::print(unsigned long n, int base) {
if (base == 0) {
return write(n);
} else {
return printNumber(n, base);
}
}
size_t Print::print(long long n, int base)
{
int t = 0;
if (base == 10 && n < 0) {
t = print('-');
n = -n;
}
return printNumber(static_cast<unsigned long long>(n), base) + t;
size_t Print::print(long long n, int base) {
int t = 0;
if (base == 10 && n < 0) {
t = print('-');
n = -n;
}
return printNumber(static_cast<unsigned long long>(n), base) + t;
}
size_t Print::print(unsigned long long n, int base)
{
if (base == 0) {
return write(n);
} else {
return printNumber(n, base);
}
size_t Print::print(unsigned long long n, int base) {
if (base == 0) {
return write(n);
} else {
return printNumber(n, base);
}
}
size_t Print::print(double n, int digits)
{
return printFloat(n, digits);
size_t Print::print(double n, int digits) {
return printFloat(n, digits);
}
size_t Print::print(const Printable& x)
{
return x.printTo(*this);
size_t Print::print(const Printable &x) {
return x.printTo(*this);
}
size_t Print::print(struct tm * timeinfo, const char * format)
{
const char * f = format;
if(!f){
f = "%c";
}
char buf[64];
size_t written = strftime(buf, 64, f, timeinfo);
if(written == 0){
return written;
}
return print(buf);
size_t Print::print(struct tm *timeinfo, const char *format) {
const char *f = format;
if (!f) {
f = "%c";
}
char buf[64];
size_t written = strftime(buf, 64, f, timeinfo);
if (written == 0) {
return written;
}
return print(buf);
}
size_t Print::println(void)
{
return print("\r\n");
size_t Print::println(void) {
return print("\r\n");
}
size_t Print::println(const String &s)
{
size_t n = print(s);
n += println();
return n;
size_t Print::println(const String &s) {
size_t n = print(s);
n += println();
return n;
}
size_t Print::println(const char c[])
{
size_t n = print(c);
n += println();
return n;
size_t Print::println(const char c[]) {
size_t n = print(c);
n += println();
return n;
}
size_t Print::println(char c)
{
size_t n = print(c);
n += println();
return n;
size_t Print::println(char c) {
size_t n = print(c);
n += println();
return n;
}
size_t Print::println(unsigned char b, int base)
{
size_t n = print(b, base);
n += println();
return n;
size_t Print::println(unsigned char b, int base) {
size_t n = print(b, base);
n += println();
return n;
}
size_t Print::println(int num, int base)
{
size_t n = print(num, base);
n += println();
return n;
size_t Print::println(int num, int base) {
size_t n = print(num, base);
n += println();
return n;
}
size_t Print::println(unsigned int num, int base)
{
size_t n = print(num, base);
n += println();
return n;
size_t Print::println(unsigned int num, int base) {
size_t n = print(num, base);
n += println();
return n;
}
size_t Print::println(long num, int base)
{
size_t n = print(num, base);
n += println();
return n;
size_t Print::println(long num, int base) {
size_t n = print(num, base);
n += println();
return n;
}
size_t Print::println(unsigned long num, int base)
{
size_t n = print(num, base);
n += println();
return n;
size_t Print::println(unsigned long num, int base) {
size_t n = print(num, base);
n += println();
return n;
}
size_t Print::println(long long num, int base)
{
size_t n = print(num, base);
n += println();
return n;
size_t Print::println(long long num, int base) {
size_t n = print(num, base);
n += println();
return n;
}
size_t Print::println(unsigned long long num, int base)
{
size_t n = print(num, base);
n += println();
return n;
size_t Print::println(unsigned long long num, int base) {
size_t n = print(num, base);
n += println();
return n;
}
size_t Print::println(double num, int digits)
{
size_t n = print(num, digits);
n += println();
return n;
size_t Print::println(double num, int digits) {
size_t n = print(num, digits);
n += println();
return n;
}
size_t Print::println(const Printable& x)
{
size_t n = print(x);
n += println();
return n;
size_t Print::println(const Printable &x) {
size_t n = print(x);
n += println();
return n;
}
size_t Print::println(struct tm * timeinfo, const char * format)
{
size_t n = print(timeinfo, format);
n += println();
return n;
size_t Print::println(struct tm *timeinfo, const char *format) {
size_t n = print(timeinfo, format);
n += println();
return n;
}
// Private Methods /////////////////////////////////////////////////////////////
size_t Print::printNumber(unsigned long n, uint8_t base)
{
char buf[8 * sizeof(n) + 1]; // Assumes 8-bit chars plus zero byte.
char *str = &buf[sizeof(buf) - 1];
size_t Print::printNumber(unsigned long n, uint8_t base) {
char buf[8 * sizeof(n) + 1]; // Assumes 8-bit chars plus zero byte.
char *str = &buf[sizeof(buf) - 1];
*str = '\0';
*str = '\0';
// prevent crash if called with base == 1
if(base < 2) {
base = 10;
}
// prevent crash if called with base == 1
if (base < 2) {
base = 10;
}
do {
char c = n % base;
n /= base;
do {
char c = n % base;
n /= base;
*--str = c < 10 ? c + '0' : c + 'A' - 10;
} while (n);
*--str = c < 10 ? c + '0' : c + 'A' - 10;
} while (n);
return write(str);
return write(str);
}
size_t Print::printNumber(unsigned long long n, uint8_t base)
{
char buf[8 * sizeof(n) + 1]; // Assumes 8-bit chars plus zero byte.
char* str = &buf[sizeof(buf) - 1];
size_t Print::printNumber(unsigned long long n, uint8_t base) {
char buf[8 * sizeof(n) + 1]; // Assumes 8-bit chars plus zero byte.
char *str = &buf[sizeof(buf) - 1];
*str = '\0';
*str = '\0';
// prevent crash if called with base == 1
if (base < 2) {
base = 10;
}
// prevent crash if called with base == 1
if (base < 2) {
base = 10;
}
do {
auto m = n;
n /= base;
char c = m - base * n;
do {
auto m = n;
n /= base;
char c = m - base * n;
*--str = c < 10 ? c + '0' : c + 'A' - 10;
} while (n);
*--str = c < 10 ? c + '0' : c + 'A' - 10;
} while (n);
return write(str);
return write(str);
}
size_t Print::printFloat(double number, uint8_t digits)
{
size_t n = 0;
size_t Print::printFloat(double number, uint8_t digits) {
size_t n = 0;
if(isnan(number)) {
return print("nan");
}
if(isinf(number)) {
return print("inf");
}
if(number > 4294967040.0) {
return print("ovf"); // constant determined empirically
}
if(number < -4294967040.0) {
return print("ovf"); // constant determined empirically
}
if (isnan(number)) {
return print("nan");
}
if (isinf(number)) {
return print("inf");
}
if (number > 4294967040.0) {
return print("ovf"); // constant determined empirically
}
if (number < -4294967040.0) {
return print("ovf"); // constant determined empirically
}
// Handle negative numbers
if(number < 0.0) {
n += print('-');
number = -number;
}
// Handle negative numbers
if (number < 0.0) {
n += print('-');
number = -number;
}
// Round correctly so that print(1.999, 2) prints as "2.00"
double rounding = 0.5;
for(uint8_t i = 0; i < digits; ++i) {
rounding /= 10.0;
}
// Round correctly so that print(1.999, 2) prints as "2.00"
double rounding = 0.5;
for (uint8_t i = 0; i < digits; ++i) {
rounding /= 10.0;
}
number += rounding;
number += rounding;
// Extract the integer part of the number and print it
unsigned long int_part = (unsigned long) number;
double remainder = number - (double) int_part;
n += print(int_part);
// Extract the integer part of the number and print it
unsigned long int_part = (unsigned long)number;
double remainder = number - (double)int_part;
n += print(int_part);
// Print the decimal point, but only if there are digits beyond
if(digits > 0) {
n += print(".");
}
// Print the decimal point, but only if there are digits beyond
if (digits > 0) {
n += print(".");
}
// Extract digits from the remainder one at a time
while(digits-- > 0) {
remainder *= 10.0;
int toPrint = int(remainder);
n += print(toPrint);
remainder -= toPrint;
}
// Extract digits from the remainder one at a time
while (digits-- > 0) {
remainder *= 10.0;
int toPrint = int(remainder);
n += print(toPrint);
remainder -= toPrint;
}
return n;
return n;
}

View file

@ -32,89 +32,87 @@
#define OCT 8
#define BIN 2
class Print
{
class Print {
private:
int write_error;
size_t printNumber(unsigned long, uint8_t);
size_t printNumber(unsigned long long, uint8_t);
size_t printFloat(double, uint8_t);
int write_error;
size_t printNumber(unsigned long, uint8_t);
size_t printNumber(unsigned long long, uint8_t);
size_t printFloat(double, uint8_t);
protected:
void setWriteError(int err = 1)
{
write_error = err;
}
void setWriteError(int err = 1) {
write_error = err;
}
public:
Print() :
write_error(0)
{
}
virtual ~Print() {}
int getWriteError()
{
return write_error;
}
void clearWriteError()
{
setWriteError(0);
}
Print() : write_error(0) {}
virtual ~Print() {}
int getWriteError() {
return write_error;
}
void clearWriteError() {
setWriteError(0);
}
virtual size_t write(uint8_t) = 0;
size_t write(const char *str)
{
if(str == NULL) {
return 0;
}
return write((const uint8_t *) str, strlen(str));
}
virtual size_t write(const uint8_t *buffer, size_t size);
size_t write(const char *buffer, size_t size)
{
return write((const uint8_t *) buffer, size);
virtual size_t write(uint8_t) = 0;
size_t write(const char *str) {
if (str == NULL) {
return 0;
}
return write((const uint8_t *)str, strlen(str));
}
virtual size_t write(const uint8_t *buffer, size_t size);
size_t write(const char *buffer, size_t size) {
return write((const uint8_t *)buffer, size);
}
size_t vprintf(const char *format, va_list arg);
size_t vprintf(const char *format, va_list arg);
size_t printf(const char * format, ...) __attribute__ ((format (printf, 2, 3)));
size_t printf(const __FlashStringHelper *ifsh, ...);
size_t printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
size_t printf(const __FlashStringHelper *ifsh, ...);
// add availableForWrite to make compatible with Arduino Print.h
// default to zero, meaning "a single write may block"
// should be overriden by subclasses with buffering
virtual int availableForWrite() { return 0; }
size_t print(const __FlashStringHelper *ifsh) { return print(reinterpret_cast<const char *>(ifsh)); }
size_t print(const String &);
size_t print(const char[]);
size_t print(char);
size_t print(unsigned char, int = DEC);
size_t print(int, int = DEC);
size_t print(unsigned int, int = DEC);
size_t print(long, int = DEC);
size_t print(unsigned long, int = DEC);
size_t print(long long, int = DEC);
size_t print(unsigned long long, int = DEC);
size_t print(double, int = 2);
size_t print(const Printable&);
size_t print(struct tm * timeinfo, const char * format = NULL);
// add availableForWrite to make compatible with Arduino Print.h
// default to zero, meaning "a single write may block"
// should be overridden by subclasses with buffering
virtual int availableForWrite() {
return 0;
}
size_t print(const __FlashStringHelper *ifsh) {
return print(reinterpret_cast<const char *>(ifsh));
}
size_t print(const String &);
size_t print(const char[]);
size_t print(char);
size_t print(unsigned char, int = DEC);
size_t print(int, int = DEC);
size_t print(unsigned int, int = DEC);
size_t print(long, int = DEC);
size_t print(unsigned long, int = DEC);
size_t print(long long, int = DEC);
size_t print(unsigned long long, int = DEC);
size_t print(double, int = 2);
size_t print(const Printable &);
size_t print(struct tm *timeinfo, const char *format = NULL);
size_t println(const __FlashStringHelper *ifsh) { return println(reinterpret_cast<const char *>(ifsh)); }
size_t println(const String &s);
size_t println(const char[]);
size_t println(char);
size_t println(unsigned char, int = DEC);
size_t println(int, int = DEC);
size_t println(unsigned int, int = DEC);
size_t println(long, int = DEC);
size_t println(unsigned long, int = DEC);
size_t println(long long, int = DEC);
size_t println(unsigned long long, int = DEC);
size_t println(double, int = 2);
size_t println(const Printable&);
size_t println(struct tm * timeinfo, const char * format = NULL);
size_t println(void);
virtual void flush() { /* Empty implementation for backward compatibility */ }
size_t println(const __FlashStringHelper *ifsh) {
return println(reinterpret_cast<const char *>(ifsh));
}
size_t println(const String &s);
size_t println(const char[]);
size_t println(char);
size_t println(unsigned char, int = DEC);
size_t println(int, int = DEC);
size_t println(unsigned int, int = DEC);
size_t println(long, int = DEC);
size_t println(unsigned long, int = DEC);
size_t println(long long, int = DEC);
size_t println(unsigned long long, int = DEC);
size_t println(double, int = 2);
size_t println(const Printable &);
size_t println(struct tm *timeinfo, const char *format = NULL);
size_t println(void);
virtual void flush() { /* Empty implementation for backward compatibility */ }
};
#endif

View file

@ -30,12 +30,10 @@ class Print;
Print::print and Print::println methods.
*/
class Printable
{
class Printable {
public:
virtual ~Printable() {}
virtual size_t printTo(Print& p) const = 0;
virtual ~Printable() {}
virtual size_t printTo(Print &p) const = 0;
};
#endif

View file

@ -26,342 +26,315 @@
// 32-bit integer manipulation macros (big endian)
#ifndef GET_UINT32_BE
#define GET_UINT32_BE(n,b,i) \
{ \
(n) = ((uint32_t) (b)[(i) ] << 24) \
| ((uint32_t) (b)[(i) + 1] << 16) \
| ((uint32_t) (b)[(i) + 2] << 8) \
| ((uint32_t) (b)[(i) + 3] ); \
}
#define GET_UINT32_BE(n, b, i) \
{ (n) = ((uint32_t)(b)[(i)] << 24) | ((uint32_t)(b)[(i) + 1] << 16) | ((uint32_t)(b)[(i) + 2] << 8) | ((uint32_t)(b)[(i) + 3]); }
#endif
#ifndef PUT_UINT32_BE
#define PUT_UINT32_BE(n,b,i) \
{ \
(b)[(i) ] = (uint8_t) ((n) >> 24); \
(b)[(i) + 1] = (uint8_t) ((n) >> 16); \
(b)[(i) + 2] = (uint8_t) ((n) >> 8); \
(b)[(i) + 3] = (uint8_t) ((n) ); \
}
#define PUT_UINT32_BE(n, b, i) \
{ \
(b)[(i)] = (uint8_t)((n) >> 24); \
(b)[(i) + 1] = (uint8_t)((n) >> 16); \
(b)[(i) + 2] = (uint8_t)((n) >> 8); \
(b)[(i) + 3] = (uint8_t)((n)); \
}
#endif
// Constants
static const uint8_t sha1_padding[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static const uint8_t sha1_padding[64] = {0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
// Private methods
void SHA1Builder::process(const uint8_t* data)
{
uint32_t temp, W[16], A, B, C, D, E;
void SHA1Builder::process(const uint8_t *data) {
uint32_t temp, W[16], A, B, C, D, E;
GET_UINT32_BE(W[ 0], data, 0);
GET_UINT32_BE(W[ 1], data, 4);
GET_UINT32_BE(W[ 2], data, 8);
GET_UINT32_BE(W[ 3], data, 12);
GET_UINT32_BE(W[ 4], data, 16);
GET_UINT32_BE(W[ 5], data, 20);
GET_UINT32_BE(W[ 6], data, 24);
GET_UINT32_BE(W[ 7], data, 28);
GET_UINT32_BE(W[ 8], data, 32);
GET_UINT32_BE(W[ 9], data, 36);
GET_UINT32_BE(W[10], data, 40);
GET_UINT32_BE(W[11], data, 44);
GET_UINT32_BE(W[12], data, 48);
GET_UINT32_BE(W[13], data, 52);
GET_UINT32_BE(W[14], data, 56);
GET_UINT32_BE(W[15], data, 60);
GET_UINT32_BE(W[0], data, 0);
GET_UINT32_BE(W[1], data, 4);
GET_UINT32_BE(W[2], data, 8);
GET_UINT32_BE(W[3], data, 12);
GET_UINT32_BE(W[4], data, 16);
GET_UINT32_BE(W[5], data, 20);
GET_UINT32_BE(W[6], data, 24);
GET_UINT32_BE(W[7], data, 28);
GET_UINT32_BE(W[8], data, 32);
GET_UINT32_BE(W[9], data, 36);
GET_UINT32_BE(W[10], data, 40);
GET_UINT32_BE(W[11], data, 44);
GET_UINT32_BE(W[12], data, 48);
GET_UINT32_BE(W[13], data, 52);
GET_UINT32_BE(W[14], data, 56);
GET_UINT32_BE(W[15], data, 60);
#define sha1_S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
#define sha1_S(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
#define sha1_R(t) \
( \
temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ \
W[(t - 14) & 0x0F] ^ W[ t & 0x0F], \
(W[t & 0x0F] = sha1_S(temp,1)) \
)
#define sha1_R(t) (temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ W[(t - 14) & 0x0F] ^ W[t & 0x0F], (W[t & 0x0F] = sha1_S(temp, 1)))
#define sha1_P(a,b,c,d,e,x) \
{ \
e += sha1_S(a,5) + sha1_F(b,c,d) + sha1_K + x; b = sha1_S(b,30); \
}
#define sha1_P(a, b, c, d, e, x) \
{ \
e += sha1_S(a, 5) + sha1_F(b, c, d) + sha1_K + x; \
b = sha1_S(b, 30); \
}
A = state[0];
B = state[1];
C = state[2];
D = state[3];
E = state[4];
A = state[0];
B = state[1];
C = state[2];
D = state[3];
E = state[4];
#define sha1_F(x,y,z) (z ^ (x & (y ^ z)))
#define sha1_K 0x5A827999
#define sha1_F(x, y, z) (z ^ (x & (y ^ z)))
#define sha1_K 0x5A827999
sha1_P(A, B, C, D, E, W[0]);
sha1_P(E, A, B, C, D, W[1]);
sha1_P(D, E, A, B, C, W[2]);
sha1_P(C, D, E, A, B, W[3]);
sha1_P(B, C, D, E, A, W[4]);
sha1_P(A, B, C, D, E, W[5]);
sha1_P(E, A, B, C, D, W[6]);
sha1_P(D, E, A, B, C, W[7]);
sha1_P(C, D, E, A, B, W[8]);
sha1_P(B, C, D, E, A, W[9]);
sha1_P(A, B, C, D, E, W[10]);
sha1_P(E, A, B, C, D, W[11]);
sha1_P(D, E, A, B, C, W[12]);
sha1_P(C, D, E, A, B, W[13]);
sha1_P(B, C, D, E, A, W[14]);
sha1_P(A, B, C, D, E, W[15]);
sha1_P(E, A, B, C, D, sha1_R(16));
sha1_P(D, E, A, B, C, sha1_R(17));
sha1_P(C, D, E, A, B, sha1_R(18));
sha1_P(B, C, D, E, A, sha1_R(19));
sha1_P(A, B, C, D, E, W[0]);
sha1_P(E, A, B, C, D, W[1]);
sha1_P(D, E, A, B, C, W[2]);
sha1_P(C, D, E, A, B, W[3]);
sha1_P(B, C, D, E, A, W[4]);
sha1_P(A, B, C, D, E, W[5]);
sha1_P(E, A, B, C, D, W[6]);
sha1_P(D, E, A, B, C, W[7]);
sha1_P(C, D, E, A, B, W[8]);
sha1_P(B, C, D, E, A, W[9]);
sha1_P(A, B, C, D, E, W[10]);
sha1_P(E, A, B, C, D, W[11]);
sha1_P(D, E, A, B, C, W[12]);
sha1_P(C, D, E, A, B, W[13]);
sha1_P(B, C, D, E, A, W[14]);
sha1_P(A, B, C, D, E, W[15]);
sha1_P(E, A, B, C, D, sha1_R(16));
sha1_P(D, E, A, B, C, sha1_R(17));
sha1_P(C, D, E, A, B, sha1_R(18));
sha1_P(B, C, D, E, A, sha1_R(19));
#undef sha1_K
#undef sha1_F
#define sha1_F(x,y,z) (x ^ y ^ z)
#define sha1_K 0x6ED9EBA1
#define sha1_F(x, y, z) (x ^ y ^ z)
#define sha1_K 0x6ED9EBA1
sha1_P(A, B, C, D, E, sha1_R(20));
sha1_P(E, A, B, C, D, sha1_R(21));
sha1_P(D, E, A, B, C, sha1_R(22));
sha1_P(C, D, E, A, B, sha1_R(23));
sha1_P(B, C, D, E, A, sha1_R(24));
sha1_P(A, B, C, D, E, sha1_R(25));
sha1_P(E, A, B, C, D, sha1_R(26));
sha1_P(D, E, A, B, C, sha1_R(27));
sha1_P(C, D, E, A, B, sha1_R(28));
sha1_P(B, C, D, E, A, sha1_R(29));
sha1_P(A, B, C, D, E, sha1_R(30));
sha1_P(E, A, B, C, D, sha1_R(31));
sha1_P(D, E, A, B, C, sha1_R(32));
sha1_P(C, D, E, A, B, sha1_R(33));
sha1_P(B, C, D, E, A, sha1_R(34));
sha1_P(A, B, C, D, E, sha1_R(35));
sha1_P(E, A, B, C, D, sha1_R(36));
sha1_P(D, E, A, B, C, sha1_R(37));
sha1_P(C, D, E, A, B, sha1_R(38));
sha1_P(B, C, D, E, A, sha1_R(39));
sha1_P(A, B, C, D, E, sha1_R(20));
sha1_P(E, A, B, C, D, sha1_R(21));
sha1_P(D, E, A, B, C, sha1_R(22));
sha1_P(C, D, E, A, B, sha1_R(23));
sha1_P(B, C, D, E, A, sha1_R(24));
sha1_P(A, B, C, D, E, sha1_R(25));
sha1_P(E, A, B, C, D, sha1_R(26));
sha1_P(D, E, A, B, C, sha1_R(27));
sha1_P(C, D, E, A, B, sha1_R(28));
sha1_P(B, C, D, E, A, sha1_R(29));
sha1_P(A, B, C, D, E, sha1_R(30));
sha1_P(E, A, B, C, D, sha1_R(31));
sha1_P(D, E, A, B, C, sha1_R(32));
sha1_P(C, D, E, A, B, sha1_R(33));
sha1_P(B, C, D, E, A, sha1_R(34));
sha1_P(A, B, C, D, E, sha1_R(35));
sha1_P(E, A, B, C, D, sha1_R(36));
sha1_P(D, E, A, B, C, sha1_R(37));
sha1_P(C, D, E, A, B, sha1_R(38));
sha1_P(B, C, D, E, A, sha1_R(39));
#undef sha1_K
#undef sha1_F
#define sha1_F(x,y,z) ((x & y) | (z & (x | y)))
#define sha1_K 0x8F1BBCDC
#define sha1_F(x, y, z) ((x & y) | (z & (x | y)))
#define sha1_K 0x8F1BBCDC
sha1_P(A, B, C, D, E, sha1_R(40));
sha1_P(E, A, B, C, D, sha1_R(41));
sha1_P(D, E, A, B, C, sha1_R(42));
sha1_P(C, D, E, A, B, sha1_R(43));
sha1_P(B, C, D, E, A, sha1_R(44));
sha1_P(A, B, C, D, E, sha1_R(45));
sha1_P(E, A, B, C, D, sha1_R(46));
sha1_P(D, E, A, B, C, sha1_R(47));
sha1_P(C, D, E, A, B, sha1_R(48));
sha1_P(B, C, D, E, A, sha1_R(49));
sha1_P(A, B, C, D, E, sha1_R(50));
sha1_P(E, A, B, C, D, sha1_R(51));
sha1_P(D, E, A, B, C, sha1_R(52));
sha1_P(C, D, E, A, B, sha1_R(53));
sha1_P(B, C, D, E, A, sha1_R(54));
sha1_P(A, B, C, D, E, sha1_R(55));
sha1_P(E, A, B, C, D, sha1_R(56));
sha1_P(D, E, A, B, C, sha1_R(57));
sha1_P(C, D, E, A, B, sha1_R(58));
sha1_P(B, C, D, E, A, sha1_R(59));
sha1_P(A, B, C, D, E, sha1_R(40));
sha1_P(E, A, B, C, D, sha1_R(41));
sha1_P(D, E, A, B, C, sha1_R(42));
sha1_P(C, D, E, A, B, sha1_R(43));
sha1_P(B, C, D, E, A, sha1_R(44));
sha1_P(A, B, C, D, E, sha1_R(45));
sha1_P(E, A, B, C, D, sha1_R(46));
sha1_P(D, E, A, B, C, sha1_R(47));
sha1_P(C, D, E, A, B, sha1_R(48));
sha1_P(B, C, D, E, A, sha1_R(49));
sha1_P(A, B, C, D, E, sha1_R(50));
sha1_P(E, A, B, C, D, sha1_R(51));
sha1_P(D, E, A, B, C, sha1_R(52));
sha1_P(C, D, E, A, B, sha1_R(53));
sha1_P(B, C, D, E, A, sha1_R(54));
sha1_P(A, B, C, D, E, sha1_R(55));
sha1_P(E, A, B, C, D, sha1_R(56));
sha1_P(D, E, A, B, C, sha1_R(57));
sha1_P(C, D, E, A, B, sha1_R(58));
sha1_P(B, C, D, E, A, sha1_R(59));
#undef sha1_K
#undef sha1_F
#define sha1_F(x,y,z) (x ^ y ^ z)
#define sha1_K 0xCA62C1D6
#define sha1_F(x, y, z) (x ^ y ^ z)
#define sha1_K 0xCA62C1D6
sha1_P(A, B, C, D, E, sha1_R(60));
sha1_P(E, A, B, C, D, sha1_R(61));
sha1_P(D, E, A, B, C, sha1_R(62));
sha1_P(C, D, E, A, B, sha1_R(63));
sha1_P(B, C, D, E, A, sha1_R(64));
sha1_P(A, B, C, D, E, sha1_R(65));
sha1_P(E, A, B, C, D, sha1_R(66));
sha1_P(D, E, A, B, C, sha1_R(67));
sha1_P(C, D, E, A, B, sha1_R(68));
sha1_P(B, C, D, E, A, sha1_R(69));
sha1_P(A, B, C, D, E, sha1_R(70));
sha1_P(E, A, B, C, D, sha1_R(71));
sha1_P(D, E, A, B, C, sha1_R(72));
sha1_P(C, D, E, A, B, sha1_R(73));
sha1_P(B, C, D, E, A, sha1_R(74));
sha1_P(A, B, C, D, E, sha1_R(75));
sha1_P(E, A, B, C, D, sha1_R(76));
sha1_P(D, E, A, B, C, sha1_R(77));
sha1_P(C, D, E, A, B, sha1_R(78));
sha1_P(B, C, D, E, A, sha1_R(79));
sha1_P(A, B, C, D, E, sha1_R(60));
sha1_P(E, A, B, C, D, sha1_R(61));
sha1_P(D, E, A, B, C, sha1_R(62));
sha1_P(C, D, E, A, B, sha1_R(63));
sha1_P(B, C, D, E, A, sha1_R(64));
sha1_P(A, B, C, D, E, sha1_R(65));
sha1_P(E, A, B, C, D, sha1_R(66));
sha1_P(D, E, A, B, C, sha1_R(67));
sha1_P(C, D, E, A, B, sha1_R(68));
sha1_P(B, C, D, E, A, sha1_R(69));
sha1_P(A, B, C, D, E, sha1_R(70));
sha1_P(E, A, B, C, D, sha1_R(71));
sha1_P(D, E, A, B, C, sha1_R(72));
sha1_P(C, D, E, A, B, sha1_R(73));
sha1_P(B, C, D, E, A, sha1_R(74));
sha1_P(A, B, C, D, E, sha1_R(75));
sha1_P(E, A, B, C, D, sha1_R(76));
sha1_P(D, E, A, B, C, sha1_R(77));
sha1_P(C, D, E, A, B, sha1_R(78));
sha1_P(B, C, D, E, A, sha1_R(79));
#undef sha1_K
#undef sha1_F
state[0] += A;
state[1] += B;
state[2] += C;
state[3] += D;
state[4] += E;
state[0] += A;
state[1] += B;
state[2] += C;
state[3] += D;
state[4] += E;
}
// Public methods
void SHA1Builder::begin(void)
{
total[0] = 0;
total[1] = 0;
void SHA1Builder::begin(void) {
total[0] = 0;
total[1] = 0;
state[0] = 0x67452301;
state[1] = 0xEFCDAB89;
state[2] = 0x98BADCFE;
state[3] = 0x10325476;
state[4] = 0xC3D2E1F0;
state[0] = 0x67452301;
state[1] = 0xEFCDAB89;
state[2] = 0x98BADCFE;
state[3] = 0x10325476;
state[4] = 0xC3D2E1F0;
memset(buffer, 0x00, sizeof(buffer));
memset(hash, 0x00, sizeof(hash));
memset(buffer, 0x00, sizeof(buffer));
memset(hash, 0x00, sizeof(hash));
}
void SHA1Builder::add(const uint8_t* data, size_t len)
{
size_t fill;
uint32_t left;
void SHA1Builder::add(const uint8_t *data, size_t len) {
size_t fill;
uint32_t left;
if(len == 0)
{
return;
}
if (len == 0) {
return;
}
left = total[0] & 0x3F;
fill = 64 - left;
left = total[0] & 0x3F;
fill = 64 - left;
total[0] += (uint32_t) len;
total[0] &= 0xFFFFFFFF;
total[0] += (uint32_t)len;
total[0] &= 0xFFFFFFFF;
if(total[0] < (uint32_t) len)
{
total[1]++;
}
if (total[0] < (uint32_t)len) {
total[1]++;
}
if(left && len >= fill)
{
memcpy((void *) (buffer + left), data, fill);
process(buffer);
data += fill;
len -= fill;
left = 0;
}
if (left && len >= fill) {
memcpy((void *)(buffer + left), data, fill);
process(buffer);
data += fill;
len -= fill;
left = 0;
}
while(len >= 64)
{
process(data);
data += 64;
len -= 64;
}
while (len >= 64) {
process(data);
data += 64;
len -= 64;
}
if(len > 0) {
memcpy((void *) (buffer + left), data, len);
}
if (len > 0) {
memcpy((void *)(buffer + left), data, len);
}
}
void SHA1Builder::addHexString(const char * data)
{
uint16_t len = strlen(data);
uint8_t * tmp = (uint8_t*)malloc(len/2);
if(tmp == NULL) {
return;
}
hex2bytes(tmp, len/2, data);
add(tmp, len/2);
free(tmp);
void SHA1Builder::addHexString(const char *data) {
uint16_t len = strlen(data);
uint8_t *tmp = (uint8_t *)malloc(len / 2);
if (tmp == NULL) {
return;
}
hex2bytes(tmp, len / 2, data);
add(tmp, len / 2);
free(tmp);
}
bool SHA1Builder::addStream(Stream & stream, const size_t maxLen)
{
const int buf_size = 512;
int maxLengthLeft = maxLen;
uint8_t * buf = (uint8_t*) malloc(buf_size);
bool SHA1Builder::addStream(Stream &stream, const size_t maxLen) {
const int buf_size = 512;
int maxLengthLeft = maxLen;
uint8_t *buf = (uint8_t *)malloc(buf_size);
if(!buf) {
return false;
if (!buf) {
return false;
}
int bytesAvailable = stream.available();
while ((bytesAvailable > 0) && (maxLengthLeft > 0)) {
// determine number of bytes to read
int readBytes = bytesAvailable;
if (readBytes > maxLengthLeft) {
readBytes = maxLengthLeft; // read only until max_len
}
if (readBytes > buf_size) {
readBytes = buf_size; // not read more the buffer can handle
}
int bytesAvailable = stream.available();
while((bytesAvailable > 0) && (maxLengthLeft > 0)) {
// determine number of bytes to read
int readBytes = bytesAvailable;
if(readBytes > maxLengthLeft) {
readBytes = maxLengthLeft ; // read only until max_len
}
if(readBytes > buf_size) {
readBytes = buf_size; // not read more the buffer can handle
}
// read data and check if we got something
int numBytesRead = stream.readBytes(buf, readBytes);
if(numBytesRead< 1) {
free(buf);
return false;
}
// Update SHA1 with buffer payload
add(buf, numBytesRead);
// update available number of bytes
maxLengthLeft -= numBytesRead;
bytesAvailable = stream.available();
// read data and check if we got something
int numBytesRead = stream.readBytes(buf, readBytes);
if (numBytesRead < 1) {
free(buf);
return false;
}
free(buf);
return true;
// Update SHA1 with buffer payload
add(buf, numBytesRead);
// update available number of bytes
maxLengthLeft -= numBytesRead;
bytesAvailable = stream.available();
}
free(buf);
return true;
}
void SHA1Builder::calculate(void)
{
uint32_t last, padn;
uint32_t high, low;
uint8_t msglen[8];
void SHA1Builder::calculate(void) {
uint32_t last, padn;
uint32_t high, low;
uint8_t msglen[8];
high = (total[0] >> 29) | (total[1] << 3);
low = (total[0] << 3);
high = (total[0] >> 29) | (total[1] << 3);
low = (total[0] << 3);
PUT_UINT32_BE(high, msglen, 0);
PUT_UINT32_BE(low, msglen, 4);
PUT_UINT32_BE(high, msglen, 0);
PUT_UINT32_BE(low, msglen, 4);
last = total[0] & 0x3F;
padn = (last < 56) ? (56 - last) : (120 - last);
last = total[0] & 0x3F;
padn = (last < 56) ? (56 - last) : (120 - last);
add((uint8_t*)sha1_padding, padn);
add(msglen, 8);
add((uint8_t *)sha1_padding, padn);
add(msglen, 8);
PUT_UINT32_BE(state[0], hash, 0);
PUT_UINT32_BE(state[1], hash, 4);
PUT_UINT32_BE(state[2], hash, 8);
PUT_UINT32_BE(state[3], hash, 12);
PUT_UINT32_BE(state[4], hash, 16);
PUT_UINT32_BE(state[0], hash, 0);
PUT_UINT32_BE(state[1], hash, 4);
PUT_UINT32_BE(state[2], hash, 8);
PUT_UINT32_BE(state[3], hash, 12);
PUT_UINT32_BE(state[4], hash, 16);
}
void SHA1Builder::getBytes(uint8_t * output)
{
memcpy(output, hash, SHA1_HASH_SIZE);
void SHA1Builder::getBytes(uint8_t *output) {
memcpy(output, hash, SHA1_HASH_SIZE);
}
void SHA1Builder::getChars(char * output)
{
bytes2hex(output, SHA1_HASH_SIZE*2+1, hash, SHA1_HASH_SIZE);
void SHA1Builder::getChars(char *output) {
bytes2hex(output, SHA1_HASH_SIZE * 2 + 1, hash, SHA1_HASH_SIZE);
}
String SHA1Builder::toString(void)
{
char out[(SHA1_HASH_SIZE * 2) + 1];
getChars(out);
return String(out);
String SHA1Builder::toString(void) {
char out[(SHA1_HASH_SIZE * 2) + 1];
getChars(out);
return String(out);
}

View file

@ -22,30 +22,29 @@
#define SHA1_HASH_SIZE 20
class SHA1Builder : public HashBuilder
{
class SHA1Builder : public HashBuilder {
private:
uint32_t total[2]; /* number of bytes processed */
uint32_t state[5]; /* intermediate digest state */
unsigned char buffer[64]; /* data block being processed */
uint8_t hash[SHA1_HASH_SIZE]; /* SHA-1 result */
uint32_t total[2]; /* number of bytes processed */
uint32_t state[5]; /* intermediate digest state */
unsigned char buffer[64]; /* data block being processed */
uint8_t hash[SHA1_HASH_SIZE]; /* SHA-1 result */
void process(const uint8_t* data);
void process(const uint8_t *data);
public:
void begin() override;
void begin() override;
using HashBuilder::add;
void add(const uint8_t* data, size_t len) override;
using HashBuilder::add;
void add(const uint8_t *data, size_t len) override;
using HashBuilder::addHexString;
void addHexString(const char* data) override;
using HashBuilder::addHexString;
void addHexString(const char *data) override;
bool addStream(Stream& stream, const size_t maxLen) override;
void calculate() override;
void getBytes(uint8_t* output) override;
void getChars(char* output) override;
String toString() override;
bool addStream(Stream &stream, const size_t maxLen) override;
void calculate() override;
void getBytes(uint8_t *output) override;
void getChars(char *output) override;
String toString() override;
};
#endif

Some files were not shown because too many files have changed in this diff Show more