-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/witnessmenow/ESP32-Cheap-Ye…
- Loading branch information
Showing
44 changed files
with
15,577 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>CYD Example Web Installer</title> | ||
<meta charset="utf-8"> | ||
<script type="module" src="https://unpkg.com/esp-web-tools@9/dist/web/install-button.js?module"></script> | ||
<script> | ||
function loadExamples(type) { | ||
if(!type) { | ||
return; | ||
} | ||
let examples = document.getElementById('examples'); | ||
examples.innerHTML = ''; | ||
fetch('examples.json') | ||
.then(response => response.json()) | ||
.then(json => { | ||
json.examples.sort().forEach((element) => { | ||
let w = document.importNode(document.getElementById('webflash').content, true); | ||
w.querySelector('button').textContent = 'Install ' + element; | ||
w.querySelector('esp-web-install-button').setAttribute('manifest', element + '/' + type + '/manifest.json'); | ||
examples.appendChild(w); | ||
}); | ||
}); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<h1>Cheap Yellow Display (CYD) Example Web Installer</h1> | ||
|
||
<form onsubmit="return false;" class="flashable"> | ||
<label>Choose your CYD: | ||
<select name="cyd" onchange="loadExamples(this.value)"> | ||
<option value=""></option> | ||
<option value="cyd">CYD</option> | ||
<option value="cyd2usb">CYD with 2 USBs</option> | ||
</select> | ||
</label> | ||
</form> | ||
|
||
<p class="flashable">Make sure to close anything using your devices com port (e.g. Serial monitor). Just hit the button to install the example on your CYD.</p> | ||
|
||
<div id="examples" style="display: none;" class="flashable"> | ||
</div> | ||
|
||
<template id="webflash"> | ||
<div style="margin-bottom: 10px;"> | ||
<esp-web-install-button class="installButton"> | ||
<button slot="activate"></button> | ||
</esp-web-install-button> | ||
</div> | ||
</template> | ||
<p id="notSupported" style="display: none; color: red;"> | ||
Your browser does not support the Web Serial API. Please open this page using Edge or Chrome. | ||
</p> | ||
|
||
|
||
<script> | ||
if(navigator.serial){ | ||
document.getElementById('examples').style.display = 'block'; | ||
} else { | ||
console.log('Serial not supported'); | ||
[...document.getElementsByClassName('flashable')].forEach((e) => {e.style.display = 'none';}); | ||
document.getElementById('notSupported').style.display = 'block'; | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "Example", | ||
"builds": [ | ||
{ | ||
"chipFamily": "ESP32", | ||
"improv": false, | ||
"parts": [ | ||
{ "path": "merged-flash.bin", "offset": 0 } | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: CI | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
paths-ignore: | ||
- '**.md' | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Cache pip | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Cache PlatformIO | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.platformio | ||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
- name: Install PlatformIO | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade platformio | ||
- name: Build | ||
run: | | ||
find . -not -path '*/.*' -type f -name 'platformio.ini' -printf '%h\n' | xargs -i bash -c "(echo {}; pio run -e cyd -e cyd2usb -d {})" | ||
- name: Merge flash files | ||
run: | | ||
find . -path '*/.pio*' -type f -name 'firmware.bin' -printf '%h\n' | xargs -i bash -c "(echo {}; cd {}; ~/.platformio/packages/tool-esptoolpy/esptool.py --chip esp32 merge_bin -o merged-flash.bin --flash_mode dio --flash_size 4MB 0x1000 bootloader.bin 0x8000 partitions.bin 0x10000 firmware.bin)" | ||
- name: Create JSON | ||
run: | | ||
mkdir tmp | ||
cp ./.github/pages/index.html tmp/ | ||
echo '{"examples":[' > tmp/examples.json | ||
first=1 | ||
find . -path './Examples/*/.pio*' -type f -name 'firmware.bin' | awk -F '.pio' '{print $1}' - | uniq | while read -r example ; do | ||
echo $example | ||
if [ $first -eq 1 ] | ||
then | ||
first=0 | ||
else | ||
echo ',' >> tmp/examples.json | ||
fi | ||
mkdir -p tmp/$example/cyd | ||
mkdir -p tmp/$example/cyd2usb | ||
echo -n '"' >> tmp/examples.json | ||
realpath --relative-to=./tmp tmp/$example | xargs echo -n >> tmp/examples.json | ||
echo -n '"' >> tmp/examples.json | ||
cp ./.github/pages/manifest.json tmp/$example/cyd | ||
cp ./.github/pages/manifest.json tmp/$example/cyd2usb | ||
cp $example.pio/build/cyd/merged-flash.bin tmp/$example/cyd | ||
cp $example.pio/build/cyd2usb/merged-flash.bin tmp/$example/cyd2usb | ||
done | ||
echo ']}' >> tmp/examples.json | ||
- name: Setup Github Page | ||
uses: actions/configure-pages@v3 | ||
- name: Upload webflash files | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: ./tmp | ||
|
||
deploy: | ||
needs: build | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.pio | ||
.vscode |
Binary file not shown.
Oops, something went wrong.