Add 2.9 inch EPD support

This commit is contained in:
Djuri Baars 2024-03-18 19:32:34 +01:00
parent 23ef2a64cc
commit d58c38c8c4
5 changed files with 93 additions and 29 deletions

View file

@ -37,7 +37,7 @@ runs:
detailed_summary: true detailed_summary: true
- name: Build BTClock firmware - name: Build BTClock firmware
shell: bash shell: bash
run: pio run -e lolin_s3_mini_qr run: pio run
- name: Build BTClock filesystem - name: Build BTClock filesystem
shell: bash shell: bash
run: pio run -e lolin_s3_mini_qr --target buildfs run: pio run --target buildfs

View file

@ -17,46 +17,90 @@ jobs:
submodules: recursive submodules: recursive
- name: "Install and build" - name: "Install and build"
uses: ./.github/actions/install-build uses: ./.github/actions/install-build
- name: Copy bootloader to output folder
run: cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin .pio
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: prepared-outputs
path: .pio/**/*.bin
merge:
runs-on: ubuntu-latest
permissions:
contents: write
checks: write
needs: build
continue-on-error: true
strategy:
matrix:
chip:
- name: lolin_s3_mini
version: esp32s3
epd_variant: [213epd, 29epd]
steps:
- uses: actions/download-artifact@v4
with:
name: prepared-outputs
path: .pio
- name: Install esptools.py - name: Install esptools.py
run: pip install --upgrade esptool run: pip install --upgrade esptool
- name: Create merged firmware binary - name: Create merged firmware binary
run: mkdir -p output && esptool.py --chip esp32s3 merge_bin -o output/full-firmware.bin --flash_mode dio 0x0000 .pio/build/lolin_s3_mini_qr/bootloader.bin 0x8000 .pio/build/lolin_s3_mini_qr/partitions.bin 0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/lolin_s3_mini_qr/firmware.bin 0x369000 .pio/build/lolin_s3_mini_qr/littlefs.bin run: mkdir -p ${{ matrix.chip.name }}_${{ matrix.epd_variant }} && esptool.py --chip ${{ matrix.chip.version }} merge_bin -o ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin --flash_mode dio 0x0000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/bootloader.bin 0x8000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/partitions.bin 0xe000 .pio/boot_app0.bin 0x10000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin 0x369000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin
- name: Create checksum for merged binary - name: Create checksum for merged binary
run: shasum -a 256 output/full-firmware.bin | awk '{print $1}' > output/full-firmware.sha256 run: shasum -a 256 ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin | awk '{print $1}' > ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.sha256
- name: Write commit hash to file # - name: Copy all artifacts to output folder
run: echo $GITHUB_SHA > output/commit.txt # run: cp .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/*.bin ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin ${{ matrix.chip.name }}_${{ matrix.epd_variant }}
- name: Write build date to file
run: echo "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" > output/date.txt
- name: Copy all artifacts to output folder
run: cp .pio/build/lolin_s3_mini_qr/*.bin ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin output
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: build-${{ matrix.chip.name }}-${{ matrix.epd_variant }}
path: | path: |
.pio/build/lolin_s3_mini_qr/*.bin ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/*.bin
output/full-firmware.bin ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/*.sha256
output/full-firmware.sha256 release:
runs-on: ubuntu-latest
permissions:
contents: write
checks: write
needs: build
steps:
- name: Download matrix outputs
uses: actions/download-artifact@v4
with:
pattern: build-*
merge-multiple: true
- name: Write commit hash to file
run: mkdir -p lolin_s3_mini_213epd && echo $GITHUB_SHA > lolin_s3_mini_213epd/commit.txt
- name: Write build date to file
run: echo "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" > lolin_s3_mini_213epd/date.txt
- name: Create release - name: Create release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
with: with:
artifacts: "output/full-firmware.bin,output/full-firmware.sha256,.pio/build/lolin_s3_mini_qr/*.bin" artifacts: "**/*.bin,**/*.sha256"
allowUpdates: true allowUpdates: true
removeArtifacts: true removeArtifacts: true
makeLatest: true makeLatest: true
# - name: Create release
# uses: ncipollo/release-action@v1
# with:
# artifacts: "output/full-firmware.bin,output/full-firmware.sha256,.pio/build/lolin_s3_mini_qr/*.bin"
# allowUpdates: true
# removeArtifacts: true
# makeLatest: true
- name: Pushes full-firmware.bin to web flasher - name: Pushes full-firmware.bin to web flasher
id: push_directory id: push_directory
uses: cpina/github-action-push-to-another-repository@main uses: cpina/github-action-push-to-another-repository@main
env: env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with: with:
source-directory: output/ source-directory: lolin_s3_mini_213epd/
target-directory: firmware_v3/ target-directory: firmware_v3/
destination-github-username: 'btclock' destination-github-username: 'btclock'
destination-repository-name: 'web-flasher' destination-repository-name: 'web-flasher'

View file

@ -9,6 +9,7 @@
; https://docs.platformio.org/page/projectconf.html ; https://docs.platformio.org/page/projectconf.html
[platformio] [platformio]
data_dir = data/build_gz data_dir = data/build_gz
default_envs = lolin_s3_mini_213epd, lolin_s3_mini_29epd
[env] [env]
@ -55,12 +56,21 @@ build_flags =
build_unflags = build_unflags =
${btclock_base.build_unflags} ${btclock_base.build_unflags}
[env:lolin_s3_mini_qr] [env:lolin_s3_mini_213epd]
extends = env:lolin_s3_mini extends = env:lolin_s3_mini
test_framework = unity test_framework = unity
build_flags = build_flags =
${env:lolin_s3_mini.build_flags} ${env:lolin_s3_mini.build_flags}
-D USE_QR -D USE_QR
-D VERSION_EPD_2_13
[env:lolin_s3_mini_29epd]
extends = env:lolin_s3_mini
test_framework = unity
build_flags =
${env:lolin_s3_mini.build_flags}
-D USE_QR
-D VERSION_EPD_2_9
[env:btclock_s3] [env:btclock_s3]
extends = btclock_base extends = btclock_base

View file

@ -67,16 +67,16 @@ MCP23X17_Pin EPD_RESET_MPD[NUM_SCREENS] = {
#endif #endif
GxEPD2_BW<GxEPD2_213_B74, GxEPD2_213_B74::HEIGHT> displays[NUM_SCREENS] = { GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> displays[NUM_SCREENS] = {
GxEPD2_213_B74(&EPD_CS[0], &EPD_DC, &EPD_RESET_MPD[0], &EPD_BUSY[0]), EPD_CLASS(&EPD_CS[0], &EPD_DC, &EPD_RESET_MPD[0], &EPD_BUSY[0]),
GxEPD2_213_B74(&EPD_CS[1], &EPD_DC, &EPD_RESET_MPD[1], &EPD_BUSY[1]), EPD_CLASS(&EPD_CS[1], &EPD_DC, &EPD_RESET_MPD[1], &EPD_BUSY[1]),
GxEPD2_213_B74(&EPD_CS[2], &EPD_DC, &EPD_RESET_MPD[2], &EPD_BUSY[2]), EPD_CLASS(&EPD_CS[2], &EPD_DC, &EPD_RESET_MPD[2], &EPD_BUSY[2]),
GxEPD2_213_B74(&EPD_CS[3], &EPD_DC, &EPD_RESET_MPD[3], &EPD_BUSY[3]), EPD_CLASS(&EPD_CS[3], &EPD_DC, &EPD_RESET_MPD[3], &EPD_BUSY[3]),
GxEPD2_213_B74(&EPD_CS[4], &EPD_DC, &EPD_RESET_MPD[4], &EPD_BUSY[4]), EPD_CLASS(&EPD_CS[4], &EPD_DC, &EPD_RESET_MPD[4], &EPD_BUSY[4]),
GxEPD2_213_B74(&EPD_CS[5], &EPD_DC, &EPD_RESET_MPD[5], &EPD_BUSY[5]), EPD_CLASS(&EPD_CS[5], &EPD_DC, &EPD_RESET_MPD[5], &EPD_BUSY[5]),
GxEPD2_213_B74(&EPD_CS[6], &EPD_DC, &EPD_RESET_MPD[6], &EPD_BUSY[6]), EPD_CLASS(&EPD_CS[6], &EPD_DC, &EPD_RESET_MPD[6], &EPD_BUSY[6]),
#ifdef IS_BTCLOCK_S3 #ifdef IS_BTCLOCK_S3
GxEPD2_213_B74(&EPD_CS[7], &EPD_DC, &EPD_RESET_MPD[6], &EPD_BUSY[7]), EPD_CLASS(&EPD_CS[7], &EPD_DC, &EPD_RESET_MPD[6], &EPD_BUSY[7]),
#endif #endif
}; };

View file

@ -5,6 +5,8 @@
#include <Preferences.h> #include <Preferences.h>
#include <freertos/FreeRTOS.h> #include <freertos/FreeRTOS.h>
#include <freertos/task.h> #include <freertos/task.h>
#include <GxEPD2.h>
#include <GxEPD2_BW.h>
#include <mutex> #include <mutex>
#include <utils.hpp> #include <utils.hpp>
@ -16,6 +18,14 @@ extern Adafruit_MCP23X17 mcp2;
extern Preferences preferences; extern Preferences preferences;
extern std::mutex mcpMutex; extern std::mutex mcpMutex;
#ifdef VERSION_EPD_2_13
#define EPD_CLASS GxEPD2_213_B74
#endif
#ifdef VERSION_EPD_2_9
#define EPD_CLASS GxEPD2_290_T94
#endif
const PROGMEM int SCREEN_BLOCK_HEIGHT = 0; const PROGMEM int SCREEN_BLOCK_HEIGHT = 0;
const PROGMEM int SCREEN_MSCW_TIME = 1; const PROGMEM int SCREEN_MSCW_TIME = 1;
const PROGMEM int SCREEN_BTC_TICKER = 2; const PROGMEM int SCREEN_BTC_TICKER = 2;