diff --git a/.github/pages/index.html b/.github/pages/index.html new file mode 100644 index 0000000..0eeb2ac --- /dev/null +++ b/.github/pages/index.html @@ -0,0 +1,67 @@ + + + + CYD Example Web Installer + + + + + +

Cheap Yellow Display (CYD) Example Web Installer

+ +
+ +
+ +

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.

+ + + + + + + + + + \ No newline at end of file diff --git a/.github/pages/manifest.json b/.github/pages/manifest.json new file mode 100644 index 0000000..a361f08 --- /dev/null +++ b/.github/pages/manifest.json @@ -0,0 +1,12 @@ +{ + "name": "Example", + "builds": [ + { + "chipFamily": "ESP32", + "improv": false, + "parts": [ + { "path": "merged-flash.bin", "offset": 0 } + ] + } + ] +} \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..0d5df98 --- /dev/null +++ b/.github/workflows/main.yml @@ -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 \ No newline at end of file diff --git a/Examples/Basics/3-SDCardTest/platformio.ini b/Examples/Basics/3-SDCardTest/platformio.ini index 0d1642c..0772d39 100644 --- a/Examples/Basics/3-SDCardTest/platformio.ini +++ b/Examples/Basics/3-SDCardTest/platformio.ini @@ -1,7 +1,8 @@ [platformio] src_dir = . +default_envs = cyd -[env:cyd] +[env] platform = espressif32 board = esp32dev framework = arduino @@ -12,4 +13,10 @@ lib_deps = monitor_speed = 115200 monitor_filters = esp32_exception_decoder upload_speed = 921600 -board_build.partitions=min_spiffs.csv \ No newline at end of file +board_build.partitions=min_spiffs.csv + +[env:cyd] +# no difference + +[env:cyd2usb] +# no difference \ No newline at end of file diff --git a/Examples/Basics/6-LEDTest/platformio.ini b/Examples/Basics/6-LEDTest/platformio.ini index 3ccdb0d..3578591 100644 --- a/Examples/Basics/6-LEDTest/platformio.ini +++ b/Examples/Basics/6-LEDTest/platformio.ini @@ -1,11 +1,18 @@ [platformio] src_dir = . -[env:cyd] +[env] platform = espressif32 board = esp32dev framework = arduino monitor_speed = 115200 monitor_filters = esp32_exception_decoder upload_speed = 921600 -board_build.partitions=min_spiffs.csv \ No newline at end of file +board_build.partitions=min_spiffs.csv + + +[env:cyd] +# no difference + +[env:cyd2usb] +# no difference \ No newline at end of file