Skip to content

Commit 09ddacb

Browse files
authored
Merge branch 'master' into middleware
2 parents 4668e78 + f083e2d commit 09ddacb

File tree

250 files changed

+7807
-2431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

250 files changed

+7807
-2431
lines changed

Diff for: .github/scripts/install-platformio-esp32.sh

+40-9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ PLATFORMIO_ESP32_URL="https://github.com/platformio/platform-espressif32.git"
66
TOOLCHAIN_VERSION="12.2.0+20230208"
77
ESPTOOLPY_VERSION="~1.40501.0"
88
ESPRESSIF_ORGANIZATION_NAME="espressif"
9+
SDKCONFIG_DIR="$PLATFORMIO_ESP32_PATH/tools/esp32-arduino-libs"
910

1011
echo "Installing Python Wheel ..."
1112
pip install wheel > /dev/null 2>&1
@@ -88,12 +89,26 @@ function count_sketches(){ # count_sketches <examples-path>
8889
local sketchname=$(basename $sketch)
8990
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
9091
continue
92+
elif [ -f $sketchdir/ci.json ]; then
93+
# If the target is listed as false, skip the sketch. Otherwise, include it.
94+
is_target=$(jq -r '.targets[esp32]' $sketchdir/ci.json)
95+
if [[ "$is_target" == "false" ]]; then
96+
continue
97+
fi
98+
99+
# Check if the sketch requires any configuration options
100+
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
101+
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
102+
for requirement in $requirements; do
103+
requirement=$(echo $requirement | xargs)
104+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
105+
if [[ "$found_line" == "" ]]; then
106+
continue 2
107+
fi
108+
done
109+
fi
91110
fi
92-
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
93-
# If the target is listed as false, skip the sketch. Otherwise, include it.
94-
if [[ "$is_target" == "false" ]]; then
95-
continue
96-
fi
111+
97112
echo $sketch >> sketches.txt
98113
sketchnum=$(($sketchnum + 1))
99114
done
@@ -163,12 +178,28 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-
163178
local sketchdir=$(dirname $sketch)
164179
local sketchdirname=$(basename $sketchdir)
165180
local sketchname=$(basename $sketch)
166-
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
167-
# If the target is listed as false, skip the sketch. Otherwise, include it.
168-
if [ "${sketchdirname}.ino" != "$sketchname" ] \
169-
|| [[ "$is_target" == "false" ]]; then
181+
if [[ "$sketchdirname.ino" != "$sketchname" ]]; then
170182
continue
183+
elif [ -f $sketchdir/ci.json ]; then
184+
# If the target is listed as false, skip the sketch. Otherwise, include it.
185+
is_target=$(jq -r '.targets[esp32]' $sketchdir/ci.json)
186+
if [[ "$is_target" == "false" ]]; then
187+
continue
188+
fi
189+
190+
# Check if the sketch requires any configuration options
191+
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
192+
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
193+
for requirement in $requirements; do
194+
requirement=$(echo $requirement | xargs)
195+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
196+
if [[ "$found_line" == "" ]]; then
197+
continue 2
198+
fi
199+
done
200+
fi
171201
fi
202+
172203
sketchnum=$(($sketchnum + 1))
173204
if [ "$sketchnum" -le "$start_index" ] \
174205
|| [ "$sketchnum" -gt "$end_index" ]; then

Diff for: .github/scripts/sketch_utils.sh

+59-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/bin/bash
22

3+
if [ -d "$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs" ]; then
4+
SDKCONFIG_DIR="$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs"
5+
elif [ -d "$GITHUB_WORKSPACE/tools/esp32-arduino-libs" ]; then
6+
SDKCONFIG_DIR="$GITHUB_WORKSPACE/tools/esp32-arduino-libs"
7+
else
8+
SDKCONFIG_DIR="tools/esp32-arduino-libs"
9+
fi
10+
311
function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [extra-options]
412
while [ ! -z "$1" ]; do
513
case "$1" in
@@ -81,14 +89,21 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
8189

8290
len=1
8391

92+
if [ -f $sketchdir/ci.json ]; then
93+
fqbn_append=`jq -r '.fqbn_append' $sketchdir/ci.json`
94+
if [ $fqbn_append == "null" ]; then
95+
fqbn_append=""
96+
fi
97+
fi
98+
8499
# Default FQBN options if none were passed in the command line.
85100

86-
esp32_opts="PSRAM=enabled,PartitionScheme=huge_app,FlashMode=dio"
87-
esp32s2_opts="PSRAM=enabled,PartitionScheme=huge_app,FlashMode=dio"
88-
esp32s3_opts="PSRAM=opi,USBMode=default,PartitionScheme=huge_app,FlashMode=dio"
89-
esp32c3_opts="PartitionScheme=huge_app,FlashMode=dio"
90-
esp32c6_opts="PartitionScheme=huge_app,FlashMode=dio"
91-
esp32h2_opts="PartitionScheme=huge_app,FlashMode=dio"
101+
esp32_opts="PSRAM=enabled,FlashMode=dio${fqbn_append:+,$fqbn_append}"
102+
esp32s2_opts="PSRAM=enabled,FlashMode=dio${fqbn_append:+,$fqbn_append}"
103+
esp32s3_opts="PSRAM=opi,USBMode=default,FlashMode=dio${fqbn_append:+,$fqbn_append}"
104+
esp32c3_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}"
105+
esp32c6_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}"
106+
esp32h2_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}"
92107

93108
# Select the common part of the FQBN based on the target. The rest will be
94109
# appended depending on the passed options.
@@ -140,16 +155,26 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
140155

141156
sketchname=$(basename $sketchdir)
142157

143-
# If the target is listed as false, skip the sketch. Otherwise, include it.
144158
if [ -f $sketchdir/ci.json ]; then
159+
# If the target is listed as false, skip the sketch. Otherwise, include it.
145160
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
146-
else
147-
is_target="true"
148-
fi
161+
if [[ "$is_target" == "false" ]]; then
162+
echo "Skipping $sketchname for target $target"
163+
exit 0
164+
fi
149165

150-
if [[ "$is_target" == "false" ]]; then
151-
echo "Skipping $sketchname for target $target"
152-
exit 0
166+
# Check if the sketch requires any configuration options
167+
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
168+
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
169+
for requirement in $requirements; do
170+
requirement=$(echo $requirement | xargs)
171+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/$target/sdkconfig")
172+
if [[ "$found_line" == "" ]]; then
173+
echo "Target $target does not meet the requirement $requirement for $sketchname. Skipping."
174+
exit 0
175+
fi
176+
done
177+
fi
153178
fi
154179

155180
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
@@ -259,10 +284,11 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
259284
unset options
260285
}
261286

262-
function count_sketches(){ # count_sketches <path> [target] [file]
287+
function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requirements]
263288
local path=$1
264289
local target=$2
265-
local file=$3
290+
local ignore_requirements=$3
291+
local file=$4
266292

267293
if [ $# -lt 1 ]; then
268294
echo "ERROR: Illegal number of parameters"
@@ -275,7 +301,7 @@ function count_sketches(){ # count_sketches <path> [target] [file]
275301
return 0
276302
fi
277303

278-
if [ -n "$file" ]; then
304+
if [ -f "$file" ]; then
279305
local sketches=$(cat $file)
280306
else
281307
local sketches=$(find $path -name *.ino | sort)
@@ -288,16 +314,26 @@ function count_sketches(){ # count_sketches <path> [target] [file]
288314
local sketchname=$(basename $sketch)
289315
if [[ "$sketchdirname.ino" != "$sketchname" ]]; then
290316
continue
291-
elif [[ -n $target ]]; then
317+
elif [[ -n $target ]] && [[ -f $sketchdir/ci.json ]]; then
292318
# If the target is listed as false, skip the sketch. Otherwise, include it.
293-
if [ -f $sketchdir/ci.json ]; then
294-
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
295-
else
296-
is_target="true"
297-
fi
319+
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
298320
if [[ "$is_target" == "false" ]]; then
299321
continue
300322
fi
323+
324+
if [ "$ignore_requirements" != "1" ]; then
325+
# Check if the sketch requires any configuration options
326+
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
327+
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
328+
for requirement in $requirements; do
329+
requirement=$(echo $requirement | xargs)
330+
found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig)
331+
if [[ "$found_line" == "" ]]; then
332+
continue 2
333+
fi
334+
done
335+
fi
336+
fi
301337
fi
302338
echo $sketch >> sketches.txt
303339
sketchnum=$(($sketchnum + 1))
@@ -374,7 +410,7 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
374410

375411
set +e
376412
if [ -n "$sketches_file" ]; then
377-
count_sketches "$path" "$target" "$sketches_file"
413+
count_sketches "$path" "$target" "0" "$sketches_file"
378414
local sketchcount=$?
379415
else
380416
count_sketches "$path" "$target"

Diff for: .github/scripts/tests_run.sh

+34-16
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,6 @@ function run_test() {
1010
local result=0
1111
local error=0
1212

13-
# If the target or platform is listed as false, skip the sketch. Otherwise, include it.
14-
if [ -f $sketchdir/ci.json ]; then
15-
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
16-
selected_platform=$(jq -r --arg platform $platform '.platforms[$platform]' $sketchdir/ci.json)
17-
else
18-
is_target="true"
19-
selected_platform="true"
20-
fi
21-
22-
if [[ $is_target == "false" ]] || [[ $selected_platform == "false" ]]; then
23-
printf "\033[93mSkipping $sketchname test for $target, platform: $platform\033[0m\n"
24-
printf "\n\n\n"
25-
return 0
26-
fi
27-
2813
if [ $options -eq 0 ] && [ -f $sketchdir/ci.json ]; then
2914
len=`jq -r --arg target $target '.fqbn[$target] | length' $sketchdir/ci.json`
3015
if [ $len -eq 0 ]; then
@@ -34,6 +19,38 @@ function run_test() {
3419
len=1
3520
fi
3621

22+
if [ $len -eq 1 ]; then
23+
SDKCONFIG_PATH="$HOME/.arduino/tests/$sketchname/build.tmp/sdkconfig"
24+
else
25+
SDKCONFIG_PATH="$HOME/.arduino/tests/$sketchname/build0.tmp/sdkconfig"
26+
fi
27+
28+
if [ -f $sketchdir/ci.json ]; then
29+
# If the target or platform is listed as false, skip the sketch. Otherwise, include it.
30+
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
31+
selected_platform=$(jq -r --arg platform $platform '.platforms[$platform]' $sketchdir/ci.json)
32+
33+
if [[ $is_target == "false" ]] || [[ $selected_platform == "false" ]]; then
34+
printf "\033[93mSkipping $sketchname test for $target, platform: $platform\033[0m\n"
35+
printf "\n\n\n"
36+
return 0
37+
fi
38+
39+
# Check if the sketch requires any configuration options
40+
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
41+
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
42+
for requirement in $requirements; do
43+
requirement=$(echo $requirement | xargs)
44+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_PATH")
45+
if [[ "$found_line" == "" ]]; then
46+
printf "\033[93mTarget $target does not meet the requirement $requirement for $sketchname. Skipping.\033[0m\n"
47+
printf "\n\n\n"
48+
return 0
49+
fi
50+
done
51+
fi
52+
fi
53+
3754
if [ $len -eq 1 ]; then
3855
# build_dir="$sketchdir/build"
3956
build_dir="$HOME/.arduino/tests/$sketchname/build.tmp"
@@ -212,7 +229,8 @@ else
212229
fi
213230

214231
set +e
215-
${COUNT_SKETCHES} $test_folder $target
232+
# Ignore requirements as we don't have the libs. The requirements will be checked in the run_test function
233+
${COUNT_SKETCHES} "$test_folder" "$target" "1"
216234
sketchcount=$?
217235
set -e
218236
sketches=$(cat sketches.txt)

Diff for: .github/workflows/tests_build.yml

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
~/.arduino/tests/**/build*.tmp/*.bin
3030
~/.arduino/tests/**/build*.tmp/*.elf
3131
~/.arduino/tests/**/build*.tmp/*.json
32+
~/.arduino/tests/**/build*.tmp/sdkconfig
3233
3334
- name: Evaluate if tests should be built
3435
id: check-build
@@ -75,6 +76,7 @@ jobs:
7576
~/.arduino/tests/**/build*.tmp/*.bin
7677
~/.arduino/tests/**/build*.tmp/*.elf
7778
~/.arduino/tests/**/build*.tmp/*.json
79+
~/.arduino/tests/**/build*.tmp/sdkconfig
7880
7981
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} binaries as artifacts
8082
uses: actions/upload-artifact@v4
@@ -85,3 +87,4 @@ jobs:
8587
~/.arduino/tests/**/build*.tmp/*.bin
8688
~/.arduino/tests/**/build*.tmp/*.elf
8789
~/.arduino/tests/**/build*.tmp/*.json
90+
~/.arduino/tests/**/build*.tmp/sdkconfig

Diff for: .github/workflows/tests_hw.yml

-4
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ jobs:
5959
sparse-checkout: |
6060
*
6161
62-
- name: List files
63-
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
64-
run: ls -la
65-
6662
# setup-python currently only works on ubuntu images
6763
# - uses: actions/setup-python@v5
6864
# if: ${{ steps.check-tests.outputs.enabled == 'true' }}

Diff for: CMakeLists.txt

+13
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ set(ARDUINO_ALL_LIBRARIES
112112
WiFi
113113
WiFiProv
114114
Wire
115+
Zigbee
115116
)
116117

117118
set(ARDUINO_LIBRARY_ArduinoOTA_SRCS libraries/ArduinoOTA/src/ArduinoOTA.cpp)
@@ -244,6 +245,18 @@ set(ARDUINO_LIBRARY_WiFiProv_SRCS libraries/WiFiProv/src/WiFiProv.cpp)
244245

245246
set(ARDUINO_LIBRARY_Wire_SRCS libraries/Wire/src/Wire.cpp)
246247

248+
set(ARDUINO_LIBRARY_Zigbee_SRCS
249+
libraries/Zigbee/src/ZigbeeCore.cpp
250+
libraries/Zigbee/src/ZigbeeEP.cpp
251+
libraries/Zigbee/src/ZigbeeHandlers.cpp
252+
libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.cpp
253+
libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.cpp
254+
libraries/Zigbee/src/ep/ZigbeeLight.cpp
255+
libraries/Zigbee/src/ep/ZigbeeSwitch.cpp
256+
libraries/Zigbee/src/ep/ZigbeeTempSensor.cpp
257+
libraries/Zigbee/src/ep/ZigbeeThermostat.cpp
258+
)
259+
247260
set(ARDUINO_LIBRARY_BLE_SRCS
248261
libraries/BLE/src/BLE2901.cpp
249262
libraries/BLE/src/BLE2902.cpp

0 commit comments

Comments
 (0)