Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

Commit 6049c64

Browse files
authored
Merge pull request #107 from bmorcelli/main
Fix to Nemo Portal
2 parents 152693f + 94a4025 commit 6049c64

File tree

2 files changed

+235
-1
lines changed

2 files changed

+235
-1
lines changed

.github/workflows/dev_compile.yml

+233
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
---
2+
name: Compile Develop Brench
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- "*"
10+
pull_request:
11+
branches:
12+
- main
13+
workflow_dispatch:
14+
inputs:
15+
board:
16+
description: 'Board to Compile'
17+
type: choice
18+
required: true
19+
default: 'M5Cardputer'
20+
options: ['M5Cardputer', 'M5StickCPlus2', 'M5StickCPlus', 'M5StickC']
21+
22+
jobs:
23+
compile_sketch:
24+
name: Build ${{ matrix.board.name }} (${{ matrix.locale }})
25+
runs-on: ubuntu-latest
26+
strategy:
27+
# max-parallel: 4
28+
fail-fast: false
29+
matrix:
30+
locale:
31+
- en-us
32+
- pt-br
33+
board:
34+
- {
35+
name: "M5Cardputer",
36+
fqbn: "m5stack:esp32:m5stack_cardputer",
37+
extra_flags: "-DCARDPUTER",
38+
libraries: "M5Cardputer IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
39+
partitions: {
40+
bootloader_addr: "0x0000",
41+
},
42+
}
43+
- {
44+
name: "M5StickCPlus2",
45+
fqbn: "m5stack:esp32:m5stack_stickc_plus2",
46+
extra_flags: "-DSTICK_C_PLUS2",
47+
libraries: "M5StickCPlus2 IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
48+
partitions: {
49+
bootloader_addr: "0x1000",
50+
},
51+
}
52+
- {
53+
name: "M5StickCPlus",
54+
fqbn: "m5stack:esp32:m5stack_stickc_plus",
55+
extra_flags: "-DSTICK_C_PLUS",
56+
libraries: "M5StickCPlus IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
57+
partitions: {
58+
bootloader_addr: "0x1000",
59+
},
60+
}
61+
- {
62+
name: "M5StickC",
63+
fqbn: "m5stack:esp32:m5stack_stickc",
64+
extra_flags: "-DSTICK_C",
65+
# TODO: M5StickC's latest version has some dependency issues with M5Hat-JoyC library
66+
libraries: "M5StickC@0.2.8 IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
67+
partitions: {
68+
bootloader_addr: "0x1000",
69+
},
70+
}
71+
72+
steps:
73+
- uses: actions/checkout@v4
74+
75+
- id: nemo_version
76+
name: Get NEMO Version
77+
run: |
78+
set -x
79+
80+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
81+
version=${{ github.ref_name }}
82+
else
83+
version="${GITHUB_SHA::7}"
84+
fi
85+
86+
echo "version=${version}" > $GITHUB_OUTPUT
87+
88+
- name: Setup Arduino CLI
89+
uses: arduino/setup-arduino-cli@v1
90+
91+
- name: Install platform
92+
run: |
93+
set -x
94+
95+
# arduino-cli core install esp32:esp32
96+
arduino-cli core install m5stack:esp32 --additional-urls "file:///${PWD}/package_m5stack_index.json"
97+
98+
arduino-cli core search m5stack
99+
arduino-cli board listall
100+
101+
arduino-cli lib install ${{ matrix.board.libraries }} --log-level warn --verbose
102+
103+
- name: Install esptool
104+
run: |
105+
pip install -U esptool
106+
107+
- name: Setup platform.txt
108+
run: |
109+
baseFolder="$HOME/.arduino15/packages/m5stack/hardware/esp32"
110+
111+
# Find the latest version of the folder
112+
latestVersion=$(find "$baseFolder" -maxdepth 1 -type d -exec basename {} \; | sort -V | head -n 1)
113+
114+
115+
# Full path to the file to be edited
116+
file="$baseFolder/$latestVersion/platform.txt"
117+
backupFile="$baseFolder/$latestVersion/platform.txt.bkp"
118+
prefix="build.extra_flags.esp32"
119+
option=" -w "
120+
121+
prefix2="compiler.c.elf.libs.esp32"
122+
option2=" -zmuldefs "
123+
124+
# Use awk to insert options after the first equals sign on lines with specified prefixes
125+
awk -v prefix="$prefix" -v option="$option" -v prefix2="$prefix2" -v option2="$option2" '{
126+
if ($0 ~ "^" prefix) {
127+
sub(/=/, "=" option);
128+
print;
129+
} else if ($0 ~ "^" prefix2) {
130+
sub(/=/, "=" option2);
131+
print;
132+
} else {
133+
print;
134+
}
135+
}' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
136+
137+
echo "Done."
138+
139+
- name: Compile ${{ matrix.board.name }} Sketch
140+
run: |
141+
set -x
142+
143+
version=${{ steps.nemo_version.outputs.version }}
144+
locale=${{ matrix.locale }}
145+
language=$(echo "LANGUAGE_${locale//-/_}" | tr '[:lower:]' '[:upper:]')
146+
147+
extra_flags="${{ matrix.board.extra_flags }} -DNEMO_VERSION=\"${version}\" -D${language}"
148+
149+
arduino-cli compile --fqbn ${{ matrix.board.fqbn }} -e \
150+
--build-property build.partitions=huge_app \
151+
--build-property upload.maximum_size=3145728 \
152+
--build-property compiler.cpp.extra_flags="${extra_flags}" \
153+
./m5stick-nemo.ino
154+
155+
- name: Create ${{ matrix.board.name }} Firmware Binary
156+
run: |
157+
set -x
158+
159+
version=${{ steps.nemo_version.outputs.version }}
160+
locale=${{ matrix.locale }}
161+
162+
if [[ "${locale}" == "en-us" ]]; then
163+
output_file="M5Nemo-${version}-${{ matrix.board.name }}.bin"
164+
else
165+
output_file="M5Nemo-${version}-${{ matrix.board.name }}.${locale}.bin"
166+
fi
167+
168+
fqbn=${{ matrix.board.fqbn }}
169+
directory="${fqbn//:/.}"
170+
171+
esptool.py --chip esp32s3 merge_bin --output ${output_file} \
172+
${{ matrix.board.partitions.bootloader_addr }} build/${directory}/m5stick-nemo.ino.bootloader.bin \
173+
0x8000 build/${directory}/m5stick-nemo.ino.partitions.bin \
174+
0x10000 build/${directory}/m5stick-nemo.ino.bin
175+
176+
- name: List all files
177+
if: always()
178+
continue-on-error: true
179+
run: |
180+
set -x
181+
pwd
182+
ls -all
183+
tree
184+
185+
# TODO: Validate the firmware
186+
187+
- name: Upload ${{ matrix.board.name }} Firmware Binary
188+
uses: actions/upload-artifact@v4
189+
with:
190+
name: M5Nemo-${{ matrix.board.name }}.${{ matrix.locale }}
191+
path: M5Nemo-*.bin
192+
if-no-files-found: error
193+
194+
create_release:
195+
runs-on: ubuntu-latest
196+
environment: github_release
197+
needs: [compile_sketch]
198+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
199+
200+
steps:
201+
- id: nemo_version
202+
name: Get NEMO Version
203+
run: |
204+
set -x
205+
206+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
207+
version=${{ github.ref_name }}
208+
else
209+
version="${GITHUB_SHA::7}"
210+
fi
211+
212+
echo "version=${version}" > $GITHUB_OUTPUT
213+
214+
- uses: actions/download-artifact@v4
215+
with:
216+
merge-multiple: true
217+
218+
- name: List all files
219+
if: always()
220+
run: |
221+
set -x
222+
pwd
223+
ls -all
224+
tree
225+
226+
- name: Create Release ${{ steps.nemo_version.outputs.version }}
227+
uses: softprops/action-gh-release@v1
228+
with:
229+
name: NEMO Release ${{ steps.nemo_version.outputs.version }}
230+
tag_name: ${{ steps.nemo_version.outputs.version }}
231+
generate_release_notes: true
232+
files: |
233+
M5Nemo-*.bin

m5stick-nemo.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -2034,9 +2034,10 @@ void portal_loop(){
20342034
}
20352035
}
20362036
#endif
2037+
}
20372038
dnsServer.processNextRequest();
20382039
webServer.handleClient();
2039-
}
2040+
20402041
if (check_next_press()){
20412042
shutdownWebServer();
20422043
portal_active = false;

0 commit comments

Comments
 (0)