Skip to content

Commit 7b0075d

Browse files
authored
Merge pull request wled#4592 from netmindz/usermod-libs-matrix
Usermod libs matrix
2 parents cc81cc2 + e227d01 commit 7b0075d

File tree

5 files changed

+110
-15
lines changed

5 files changed

+110
-15
lines changed

.github/workflows/usermods.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Usermod CI
2+
3+
on:
4+
push:
5+
paths:
6+
- usermods/**
7+
- .github/workflows/usermods.yml
8+
9+
jobs:
10+
11+
get_usermod_envs:
12+
name: Gather Usermods
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.12'
19+
cache: 'pip'
20+
- name: Install PlatformIO
21+
run: pip install -r requirements.txt
22+
- name: Get default environments
23+
id: envs
24+
run: |
25+
echo "usermods=$(find usermods/ -name library.json | xargs dirname | xargs -n 1 basename | jq -R | grep -v PWM_fan | grep -v BME68X_v2| grep -v pixels_dice_tray | jq --slurp -c)" >> $GITHUB_OUTPUT
26+
outputs:
27+
usermods: ${{ steps.envs.outputs.usermods }}
28+
29+
30+
build:
31+
name: Build Enviornments
32+
runs-on: ubuntu-latest
33+
needs: get_usermod_envs
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
usermod: ${{ fromJSON(needs.get_usermod_envs.outputs.usermods) }}
38+
environment: [usermods_esp32, usermods_esp32c3, usermods_esp32s2, usermods_esp32s3]
39+
steps:
40+
- uses: actions/checkout@v4
41+
- name: Set up Node.js
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version-file: '.nvmrc'
45+
cache: 'npm'
46+
- run: npm ci
47+
- name: Cache PlatformIO
48+
uses: actions/cache@v4
49+
with:
50+
path: |
51+
~/.platformio/.cache
52+
~/.buildcache
53+
build_output
54+
key: pio-${{ runner.os }}-${{ matrix.environment }}-${{ hashFiles('platformio.ini', 'pio-scripts/output_bins.py') }}-${{ hashFiles('wled00/**', 'usermods/**') }}
55+
restore-keys: pio-${{ runner.os }}-${{ matrix.environment }}-${{ hashFiles('platformio.ini', 'pio-scripts/output_bins.py') }}-
56+
- name: Set up Python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: '3.12'
60+
cache: 'pip'
61+
- name: Install PlatformIO
62+
run: pip install -r requirements.txt
63+
- name: Add usermods environment
64+
run: |
65+
cp -v usermods/platformio_override.usermods.ini platformio_override.ini
66+
echo >> platformio_override.ini
67+
echo "custom_usermods = ${{ matrix.usermod }}" >> platformio_override.ini
68+
cat platformio_override.ini
69+
70+
- name: Build firmware
71+
run: pio run -e ${{ matrix.environment }}

usermods/Si7021_MQTT_HA/library.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"build": { "libArchive": false },
44
"dependencies": {
55
"finitespace/BME280":"3.0.0",
6-
"adafruit/Adafruit Si7021 Library" : "1.5.3"
6+
"adafruit/Adafruit Si7021 Library" : "1.5.3",
7+
"SPI":"*",
8+
"adafruit/Adafruit BusIO": "1.17.1"
79
}
810
}

usermods/Si7021_MQTT_HA/readme.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,8 @@ SDA_PIN = 4;
4949

5050
## Software
5151

52-
Add to `build_flags` in platformio.ini:
52+
Add `Si7021_MQTT_HA` to custom_usermods
5353

54-
```
55-
-D USERMOD_SI7021_MQTT_HA
56-
```
57-
58-
Add to `lib_deps` in platformio.ini:
59-
60-
```
61-
adafruit/Adafruit Si7021 Library @ 1.4.0
62-
BME280@~3.0.0
63-
```
6454

6555
# Credits
6656

usermods/buzzer/buzzer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55

66
#define USERMOD_ID_BUZZER 900
77
#ifndef USERMOD_BUZZER_PIN
8+
#ifdef GPIO_NUM_32
89
#define USERMOD_BUZZER_PIN GPIO_NUM_32
10+
#else
11+
#define USERMOD_BUZZER_PIN 21
12+
#endif
913
#endif
1014

1115
/*
1216
* Usermods allow you to add own functionality to WLED more easily
1317
* See: https://github.com/wled-dev/WLED/wiki/Add-own-functionality
1418
*
15-
* Using a usermod:
16-
* 1. Copy the usermod into the sketch folder (same folder as wled00.ino)
17-
* 2. Register the usermod by adding #include "usermod_filename.h" in the top and registerUsermod(new MyUsermodClass()) in the bottom of usermods_list.cpp
1819
*/
1920

2021
class BuzzerUsermod : public Usermod {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[platformio]
2+
default_envs = usermods_esp32, usermods_esp32c3, usermods_esp32s2, usermods_esp32s3
3+
4+
[env:usermods_esp32]
5+
extends = env:esp32dev_V4
6+
custom_usermods = ${usermods.custom_usermods}
7+
board_build.partitions = ${esp32.extreme_partitions} ; We're gonna need a bigger boat
8+
9+
10+
[env:usermods_esp32c3]
11+
extends = env:esp32c3dev
12+
board = esp32-c3-devkitm-1
13+
custom_usermods = ${usermods.custom_usermods}
14+
board_build.partitions = ${esp32.extreme_partitions} ; We're gonna need a bigger boat
15+
16+
17+
[env:usermods_esp32s2]
18+
extends = env:lolin_s2_mini
19+
custom_usermods = ${usermods.custom_usermods}
20+
board_build.partitions = ${esp32.extreme_partitions} ; We're gonna need a bigger boat
21+
22+
23+
[env:usermods_esp32s3]
24+
extends = env:esp32s3dev_16MB_opi
25+
custom_usermods = ${usermods.custom_usermods}
26+
board_build.partitions = ${esp32.extreme_partitions} ; We're gonna need a bigger boat
27+
28+
29+
30+
[usermods]
31+
# Added in CI

0 commit comments

Comments
 (0)