Skip to content

Commit 34e67cc

Browse files
committed
Merge branch 'feat/zigbee-rejoin-scan-enhancement' of github.com:P-R-O-C-H-Y/arduino-esp32 into feat/zigbee-rejoin-scan-enhancement
2 parents a2b5105 + ad1b952 commit 34e67cc

15 files changed

+232
-148
lines changed

Diff for: .github/scripts/set_push_chunks.sh

+90-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,93 @@
22

33
build_all=false
44
chunks_count=0
5+
last_check_files=""
6+
last_check_result=""
7+
gh_output=""
8+
9+
# Define the file patterns
10+
core_files=(
11+
'\.github/.*'
12+
'cores/.*'
13+
'package/.*'
14+
'tools/.*'
15+
'platform\.txt'
16+
'programmers\.txt'
17+
'variants/esp32/.*'
18+
'variants/esp32c3/.*'
19+
'variants/esp32c6/.*'
20+
'variants/esp32h2/.*'
21+
'variants/esp32p4/.*'
22+
'variants/esp32s2/.*'
23+
'variants/esp32s3/.*'
24+
)
25+
library_files=(
26+
'libraries/.*/examples/.*'
27+
'libraries/.*/src/.*'
28+
)
29+
networking_files=(
30+
'libraries/Network/src/.*'
31+
)
32+
fs_files=(
33+
'libraries/FS/src/.*'
34+
)
35+
static_sketches_files=(
36+
'libraries/NetworkClientSecure/examples/WiFiClientSecure/WiFiClientSecure\.ino'
37+
'libraries/BLE/examples/Server/Server\.ino'
38+
'libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer\.ino'
39+
'libraries/Insights/examples/MinimalDiagnostics/MinimalDiagnostics\.ino'
40+
'libraries/NetworkClientSecure/src/.*'
41+
'libraries/BLE/src/.*'
42+
'libraries/Insights/src/.*'
43+
)
44+
idf_files=(
45+
'idf_component\.yml'
46+
'Kconfig\.projbuild'
47+
'CMakeLists\.txt'
48+
'variants/esp32c2/.*'
49+
)
50+
51+
# Function to check if any files match the patterns
52+
check_files() {
53+
local patterns=("$@")
54+
local files_found=""
55+
for pattern in "${patterns[@]}"; do
56+
echo "Checking pattern: $pattern"
57+
matched_files=$(echo "$gh_output" | grep -E "$pattern")
58+
echo "matched_files: $matched_files"
59+
files_found+="$matched_files "
60+
done
61+
62+
last_check_files=$(echo "$files_found" | xargs)
63+
if [[ -n $last_check_files ]]; then
64+
last_check_result="true"
65+
else
66+
last_check_result="false"
67+
fi
68+
echo "last_check_result: $last_check_result"
69+
}
70+
71+
if [[ $IS_PR != 'true' ]]; then
72+
gh_output=$(gh api repos/espressif/arduino-esp32/commits/"$GITHUB_SHA" --jq '.files[].filename')
73+
else
74+
gh_output=$(gh pr diff "$PR_NUM" --name-only)
75+
fi
76+
echo "gh_output: $gh_output"
77+
78+
# Output the results
79+
check_files "${core_files[@]}"
80+
CORE_CHANGED=$last_check_result
81+
check_files "${library_files[@]}"
82+
LIB_CHANGED=$last_check_result
83+
LIB_FILES=$last_check_files
84+
check_files "${networking_files[@]}"
85+
NETWORKING_CHANGED=$last_check_result
86+
check_files "${fs_files[@]}"
87+
FS_CHANGED=$last_check_result
88+
check_files "${static_sketches_files[@]}"
89+
STATIC_SKETCHES_CHANGED=$last_check_result
90+
check_files "${idf_files[@]}"
91+
IDF_CHANGED=$last_check_result
592

693
if [[ $CORE_CHANGED == 'true' ]] || [[ $IS_PR != 'true' ]]; then
794
echo "Core files changed or not a PR. Building all."
@@ -76,9 +163,9 @@ chunks+="]"
76163

77164
{
78165
echo "build_all=$build_all"
79-
echo "build_libraries=$BUILD_LIBRARIES"
80-
echo "build_static_sketches=$BUILD_STATIC_SKETCHES"
81-
echo "build_idf=$BUILD_IDF"
166+
echo "build_libraries=$LIB_CHANGED"
167+
echo "build_static_sketches=$STATIC_SKETCHES_CHANGED"
168+
echo "build_idf=$IDF_CHANGED"
82169
echo "chunk_count=$chunks_count"
83170
echo "chunks=$chunks"
84171
} >> "$GITHUB_OUTPUT"

Diff for: .github/workflows/build_py_tools.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ jobs:
3030
echo "Make sure you are using a branch inside the repository and not a fork."
3131
3232
- name: Verify Python Tools Changed
33-
uses: tj-actions/changed-files@v41
3433
id: verify-changed-files
35-
with:
36-
fetch_depth: "2"
37-
since_last_remote_commit: "true"
38-
files: |
39-
tools/get.py
40-
tools/espota.py
41-
tools/gen_esp32part.py
42-
tools/gen_insights_package.py
34+
run: |
35+
CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r ^HEAD -- tools/get.py tools/espota.py tools/gen_esp32part.py tools/gen_insights_package.py | xargs)
36+
echo "all_changed_files=$CHANGED_FILES" >> $GITHUB_OUTPUT
37+
if [ -n "$CHANGED_FILES" ]; then
38+
echo "any_changed=true" >> $GITHUB_OUTPUT
39+
else
40+
echo "any_changed=false" >> $GITHUB_OUTPUT
41+
fi
42+
4343
- name: List all changed files
4444
shell: bash
4545
run: |

Diff for: .github/workflows/pre-commit.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,22 @@ jobs:
5858

5959
- name: Get changed files
6060
id: changed-files
61-
uses: tj-actions/[email protected]
61+
env:
62+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
PR_NUM: ${{ github.event.pull_request.number }}
64+
IS_PR: ${{ github.event_name == 'pull_request' }}
65+
GITHUB_SHA: ${{ github.sha }}
66+
run: |
67+
if [[ $IS_PR != 'true' ]]; then
68+
files_changed=$(gh api repos/espressif/arduino-esp32/commits/"$GITHUB_SHA" --jq '.files[].filename' | xargs)
69+
else
70+
files_changed=$(gh pr diff "$PR_NUM" --name-only | xargs)
71+
fi
72+
echo "all_changed_files=$files_changed" >> $GITHUB_OUTPUT
73+
echo "Changed files:"
74+
for file in $files_changed; do
75+
echo " $file"
76+
done
6277
6378
- name: Run pre-commit hooks in changed files
6479
run: pre-commit run --color=always --show-diff-on-failure --files ${{ steps.changed-files.outputs.all_changed_files }}

Diff for: .github/workflows/push.yml

+5-49
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ on:
4545
- "!.github/scripts/tests_*"
4646
- "!.github/scripts/upload_*"
4747
- "variants/esp32/**/*"
48-
- "variants/esp32s2/**/*"
49-
- "variants/esp32s3/**/*"
5048
- "variants/esp32c2/**/*"
5149
- "variants/esp32c3/**/*"
5250
- "variants/esp32c6/**/*"
5351
- "variants/esp32h2/**/*"
52+
- "variants/esp32p4/**/*"
53+
- "variants/esp32s2/**/*"
54+
- "variants/esp32s3/**/*"
5455

5556
concurrency:
5657
group: build-${{github.event.pull_request.number || github.ref}}
@@ -85,58 +86,13 @@ jobs:
8586
with:
8687
fetch-depth: 2
8788

88-
- name: Get changed files
89-
id: changed-files
90-
uses: tj-actions/changed-files@v44
91-
with:
92-
files_yaml: |
93-
core:
94-
- '.github/**'
95-
- 'cores/**'
96-
- 'package/**'
97-
- 'tools/**'
98-
- 'platform.txt'
99-
- 'programmers.txt'
100-
- "variants/esp32/**/*"
101-
- "variants/esp32s2/**/*"
102-
- "variants/esp32s3/**/*"
103-
- "variants/esp32c3/**/*"
104-
- "variants/esp32c6/**/*"
105-
- "variants/esp32h2/**/*"
106-
libraries:
107-
- 'libraries/**/examples/**'
108-
- 'libraries/**/src/**'
109-
networking:
110-
- 'libraries/Network/src/**'
111-
fs:
112-
- 'libraries/FS/src/**'
113-
static_sketeches:
114-
- 'libraries/NetworkClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino'
115-
- 'libraries/BLE/examples/Server/Server.ino'
116-
- 'libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino'
117-
- 'libraries/Insights/examples/MinimalDiagnostics/MinimalDiagnostics.ino'
118-
- 'libraries/NetworkClientSecure/src/**'
119-
- 'libraries/BLE/src/**'
120-
- 'libraries/Insights/src/**'
121-
idf:
122-
- 'idf_component.yml'
123-
- 'Kconfig.projbuild'
124-
- 'CMakeLists.txt'
125-
- "variants/esp32c2/**/*"
126-
12789
- name: Set chunks
12890
id: set-chunks
12991
env:
130-
LIB_FILES: ${{ steps.changed-files.outputs.libraries_all_changed_files }}
13192
IS_PR: ${{ github.event_name == 'pull_request' }}
93+
PR_NUM: ${{ github.event.pull_request.number }}
13294
MAX_CHUNKS: ${{ env.MAX_CHUNKS }}
133-
BUILD_IDF: ${{ steps.changed-files.outputs.idf_any_changed == 'true' }}
134-
BUILD_LIBRARIES: ${{ steps.changed-files.outputs.libraries_any_changed == 'true' }}
135-
BUILD_STATIC_SKETCHES: ${{ steps.changed-files.outputs.static_sketeches_any_changed == 'true' }}
136-
FS_CHANGED: ${{ steps.changed-files.outputs.fs_any_changed == 'true' }}
137-
NETWORKING_CHANGED: ${{ steps.changed-files.outputs.networking_any_changed == 'true' }}
138-
CORE_CHANGED: ${{ steps.changed-files.outputs.core_any_changed == 'true' }}
139-
LIB_CHANGED: ${{ steps.changed-files.outputs.libraries_any_changed == 'true' }}
95+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14096
run: |
14197
bash ./.github/scripts/set_push_chunks.sh
14298

Diff for: README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Arduino core for the ESP32, ESP32-P4, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 and ESP32-H2
1+
# Arduino core for the ESP32, ESP32-C3, ESP32-C6, ESP32-H2, ESP32-P4, ESP32-S2 and ESP32-S3.
22

33
[![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)
44
[![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)
@@ -67,16 +67,17 @@ Here are the ESP32 series supported by the Arduino-ESP32 project:
6767
| **SoC** | **Stable** | **Development** | **Datasheet** |
6868
|----------|:----------:|:---------------:|:-------------------------------------------------------------------------------------------------:|
6969
| ESP32 | Yes | Yes | [ESP32](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) |
70-
| ESP32-S2 | Yes | Yes | [ESP32-S2](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) |
7170
| ESP32-C3 | Yes | Yes | [ESP32-C3](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) |
72-
| ESP32-S3 | Yes | Yes | [ESP32-S3](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) |
7371
| ESP32-C6 | Yes | Yes | [ESP32-C6](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf) |
7472
| ESP32-H2 | Yes | Yes | [ESP32-H2](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf) |
7573
| ESP32-P4 | Yes | Yes | [ESP32-P4](https://www.espressif.com/sites/default/files/documentation/esp32-p4_datasheet_en.pdf) |
74+
| ESP32-S2 | Yes | Yes | [ESP32-S2](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) |
75+
| ESP32-S3 | Yes | Yes | [ESP32-S3](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) |
7676

7777
> [!NOTE]
78-
> ESP32-C2 is also supported by Arduino-ESP32 but requires rebuilding the static libraries. This is not trivial and requires a good understanding of the ESP-IDF
79-
> build system. For more information, see the [Lib Builder documentation](https://docs.espressif.com/projects/arduino-esp32/en/latest/lib_builder.html).
78+
> ESP32-C2 is also supported by Arduino-ESP32 but requires using Arduino as an ESP-IDF component or rebuilding the static libraries.
79+
> 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
80+
> [Lib Builder documentation](https://docs.espressif.com/projects/arduino-esp32/en/latest/lib_builder.html), respectively.
8081
8182
For more details visit the [supported chips](https://docs.espressif.com/projects/arduino-esp32/en/latest/getting_started.html#supported-soc-s) documentation page.
8283

Diff for: cores/esp32/esp32-hal-uart.c

+9-12
Original file line numberDiff line numberDiff line change
@@ -585,17 +585,11 @@ uart_t *uartBegin(
585585
uartEnd(uart_nr);
586586
} else {
587587
bool retCode = true;
588-
UART_MUTEX_LOCK();
589588
//User may just want to change some parameters, such as baudrate, data length, parity, stop bits or pins
590589
if (uart->_baudrate != baudrate) {
591-
if (ESP_OK != uart_set_baudrate(uart_nr, baudrate)) {
592-
log_e("UART%d changing baudrate failed.", uart_nr);
593-
retCode = false;
594-
} else {
595-
log_v("UART%d changed baudrate to %d", uart_nr, baudrate);
596-
uart->_baudrate = baudrate;
597-
}
590+
retCode = uartSetBaudRate(uart, baudrate);
598591
}
592+
UART_MUTEX_LOCK();
599593
uart_word_length_t data_bits = (config & 0xc) >> 2;
600594
uart_parity_t parity = config & 0x3;
601595
uart_stop_bits_t stop_bits = (config & 0x30) >> 4;
@@ -972,10 +966,11 @@ void uartFlushTxOnly(uart_t *uart, bool txOnly) {
972966
UART_MUTEX_UNLOCK();
973967
}
974968

975-
void uartSetBaudRate(uart_t *uart, uint32_t baud_rate) {
969+
bool uartSetBaudRate(uart_t *uart, uint32_t baud_rate) {
976970
if (uart == NULL) {
977-
return;
971+
return false;
978972
}
973+
bool retCode = true;
979974
UART_MUTEX_LOCK();
980975
#if SOC_UART_SUPPORT_XTAL_CLK // ESP32-S3, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-H2 and ESP32-P4
981976
soc_module_clk_t newClkSrc = UART_SCLK_XTAL;
@@ -993,12 +988,14 @@ void uartSetBaudRate(uart_t *uart, uint32_t baud_rate) {
993988
uart_ll_set_sclk(UART_LL_GET_HW(uart->num), newClkSrc);
994989
#endif
995990
if (uart_set_baudrate(uart->num, baud_rate) == ESP_OK) {
996-
log_v("Setting UART%d baud rate to %d.", uart->num, baud_rate);
991+
log_v("Setting UART%d baud rate to %ld.", uart->num, baud_rate);
997992
uart->_baudrate = baud_rate;
998993
} else {
999-
log_e("Setting UART%d baud rate to %d has failed.", uart->num, baud_rate);
994+
retCode = false;
995+
log_e("Setting UART%d baud rate to %ld has failed.", uart->num, baud_rate);
1000996
}
1001997
UART_MUTEX_UNLOCK();
998+
return retCode;
1002999
}
10031000

10041001
uint32_t uartGetBaudRate(uart_t *uart) {

Diff for: cores/esp32/esp32-hal-uart.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void uartWriteBuf(uart_t *uart, const uint8_t *data, size_t len);
5858
void uartFlush(uart_t *uart);
5959
void uartFlushTxOnly(uart_t *uart, bool txOnly);
6060

61-
void uartSetBaudRate(uart_t *uart, uint32_t baud_rate);
61+
bool uartSetBaudRate(uart_t *uart, uint32_t baud_rate);
6262
uint32_t uartGetBaudRate(uart_t *uart);
6363

6464
void uartSetRxInvert(uart_t *uart, bool invert);

Diff for: docs/en/boards/boards.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@ The ESP32 is divided by family:
1818

1919
* ESP32
2020
* Wi-Fi, BT and BLE 4
21-
* ESP32-S2
22-
* Wi-Fi only
23-
* ESP32-S3
24-
* Wi-Fi and BLE 5
2521
* ESP32-C3
2622
* Wi-Fi and BLE 5
2723
* ESP32-C6
2824
* Wi-Fi, BLE 5 and IEEE 802.15.4
2925
* ESP32-H2
3026
* BLE 5 and IEEE 802.15.4
27+
* ESP32-P4
28+
* 400 MHz Dual Core RISC-V CPU, 40 MHz ULP Co-processor, single-precision FPU and AI extensions.
29+
* ESP32-S2
30+
* Wi-Fi only
31+
* ESP32-S3
32+
* Wi-Fi and BLE 5
3133

3234
For each family, we have SoC variants with some differentiation. The differences are more about the embedded flash and its size and the number of the cores (dual or single).
3335

Diff for: docs/en/common/datasheet.inc

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@ Datasheet
22
---------
33

44
* `ESP32`_ (Datasheet)
5-
* `ESP32-S2`_ (Datasheet)
5+
* `ESP32-C2`_ (Datasheet)
66
* `ESP32-C3`_ (Datasheet)
7-
* `ESP32-S3`_ (Datasheet)
87
* `ESP32-C6`_ (Datasheet)
98
* `ESP32-H2`_ (Datasheet)
9+
* `ESP32-P4`_ (Datasheet)
10+
* `ESP32-S2`_ (Datasheet)
11+
* `ESP32-S3`_ (Datasheet)
1012

1113
.. _Espressif Product Selector: https://products.espressif.com/
1214
.. _ESP32: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
13-
.. _ESP32-S2: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf
15+
.. _ESP32-C2: https://www.espressif.com/sites/default/files/documentation/esp8684_datasheet_en.pdf
1416
.. _ESP32-C3: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf
15-
.. _ESP32-S3: https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf
1617
.. _ESP32-C6: https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf
1718
.. _ESP32-H2: https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf
19+
.. _ESP32-P4: https://www.espressif.com/sites/default/files/documentation/esp32-p4_datasheet_en.pdf
20+
.. _ESP32-S2: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf
21+
.. _ESP32-S3: https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf

Diff for: docs/en/getting_started.rst

+6-5
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,18 @@ Here are the ESP32 series supported by the Arduino-ESP32 project:
3838
SoC Stable Development Datasheet
3939
========== ====== =========== =================================
4040
ESP32 Yes Yes `ESP32`_
41-
ESP32-S2 Yes Yes `ESP32-S2`_
4241
ESP32-C3 Yes Yes `ESP32-C3`_
43-
ESP32-S3 Yes Yes `ESP32-S3`_
4442
ESP32-C6 Yes Yes `ESP32-C6`_
4543
ESP32-H2 Yes Yes `ESP32-H2`_
44+
ESP32-P4 Yes Yes `ESP32-P4`_
45+
ESP32-S2 Yes Yes `ESP32-S2`_
46+
ESP32-S3 Yes Yes `ESP32-S3`_
4647
========== ====== =========== =================================
4748

4849
.. note::
49-
ESP32-C2 is also supported by Arduino-ESP32 but requires rebuilding the static libraries.
50-
This is not trivial and requires a good understanding of the ESP-IDF build system.
51-
For more information, see the `Lib Builder documentation <lib_builder.html>`_.
50+
ESP32-C2 is also supported by Arduino-ESP32 but requires using Arduino as an ESP-IDF component or rebuilding the static libraries.
51+
For more information, see the `Arduino as an ESP-IDF component documentation <esp-idf_component.html>`_ or the
52+
`Lib Builder documentation <lib_builder.html>`_, respectively.
5253

5354
See `Boards <boards/boards.html>`_ for more details about ESP32 development boards.
5455

0 commit comments

Comments
 (0)