Make BTClock v8 board working again

This commit is contained in:
Djuri Baars 2024-09-21 15:58:07 +02:00
parent 41bf2480ce
commit ff0d8f5a0a
9 changed files with 91 additions and 38 deletions

View File

@ -1,9 +1,9 @@
name: BTClock CI name: BTClock CI
on: on:
push: push:
tags: tags:
- '*' - "*"
jobs: jobs:
build: build:
@ -40,10 +40,14 @@ jobs:
version: esp32s3 version: esp32s3
- name: btclock_rev_b - name: btclock_rev_b
version: esp32s3 version: esp32s3
- name: btclock_v8
version: esp32s3
epd_variant: [213epd, 29epd] epd_variant: [213epd, 29epd]
exclude: exclude:
- chip: btclock_rev_b - chip: btclock_rev_b
epd_variant: 29epd epd_variant: 29epd
- chip: btclock_v8
epd_variant: 29epd
steps: steps:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
@ -51,13 +55,37 @@ jobs:
path: .pio 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
# 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 merged firmware binary - name: Create merged firmware binary
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 run: |
if [ "${{ matrix.chip.name }}" == "btclock_v8" ]; then
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 qio \
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 \
0x810000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin;
else
# Original command for other cases
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
# Adjust the offset for littlefs or other files as needed for the original case
fi
- name: Create checksum for firmware - name: Create checksum for firmware
run: shasum -a 256 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin | awk '{print $1}' > ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}_firmware.bin.sha256 run: shasum -a 256 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin | awk '{print $1}' > ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}_firmware.bin.sha256
- name: Create checksum for merged binary - name: Create checksum for merged binary
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 }}.bin.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 }}.bin.sha256
@ -91,10 +119,10 @@ jobs:
merge-multiple: false merge-multiple: false
- name: Write commit hash to file - name: Write commit hash to file
run: echo $GITHUB_SHA > commit.txt run: echo $GITHUB_SHA > commit.txt
- name: Write build date to file - name: Write build date to file
run: echo "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" > date.txt run: echo "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" > date.txt
- name: Create release - name: Create release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
with: with:
@ -117,8 +145,8 @@ jobs:
with: with:
source-directory: . source-directory: .
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"
target-branch: main target-branch: main
user-name: ${{github.actor}} user-name: ${{github.actor}}
user-email: ${{github.actor}}@users.noreply.github.com user-email: ${{github.actor}}@users.noreply.github.com

View File

@ -10,7 +10,7 @@
"-DBOARD_HAS_PSRAM", "-DBOARD_HAS_PSRAM",
"-DARDUINO_BTCLOCK", "-DARDUINO_BTCLOCK",
"-DARDUINO_ESP32S3_DEV", "-DARDUINO_ESP32S3_DEV",
"-DIS_BTCLOCK_S3", "-DIS_BTCLOCK_V8",
"-DARDUINO_USB_MODE=1", "-DARDUINO_USB_MODE=1",
"-DARDUINO_RUNNING_CORE=1", "-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1", "-DARDUINO_EVENT_RUNNING_CORE=1",
@ -20,8 +20,8 @@
"f_flash": "80000000L", "f_flash": "80000000L",
"flash_mode": "qio", "flash_mode": "qio",
"psram_type": "opi", "psram_type": "opi",
"espidf": { "esp-idf": {
"sdkconfig_path": "boards" "sdkconfig_path": "boards/sdkconfig.btclock_v8"
}, },
"hwids": [ "hwids": [
[ [

2
data

@ -1 +1 @@
Subproject commit 7d82b1e1a9014e80f725478333774f4d53e22134 Subproject commit 95aa9d67d17dde32dab3216810e7b4e4086feb03

View File

@ -3,5 +3,5 @@ nvs, data, nvs, 36K, 20K,
otadata, data, ota, 56K, 8K, otadata, data, ota, 56K, 8K,
app0, app, ota_0, 64K, 4096K, app0, app, ota_0, 64K, 4096K,
app1, app, ota_1, , 4096K, app1, app, ota_1, , 4096K,
spiffs, data, spiffs, , 3072K, spiffs, data, spiffs, , 400K,
coredump, data, coredump,, 64K, coredump, data, coredump,, 64K,

1 # Name Type SubType Offset Size Flags
3 otadata data ota 56K 8K
4 app0 app ota_0 64K 4096K
5 app1 app ota_1 4096K
6 spiffs data spiffs 3072K 400K
7 coredump data coredump 64K

View File

@ -9,7 +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, btclock_rev_b_213epd default_envs = lolin_s3_mini_213epd, lolin_s3_mini_29epd, btclock_rev_b_213epd, btclock_v8_213epd
[env] [env]
@ -120,10 +120,11 @@ build_flags =
-D VERSION_EPD_2_9 -D VERSION_EPD_2_9
-D HW_REV=\"REV_B_EPD_2_9\" -D HW_REV=\"REV_B_EPD_2_9\"
[env:btclock_s3] [env:btclock_v8]
extends = btclock_base extends = btclock_base
board = btclock board = btclock_v8
board_build.partitions = partition_16mb.csv board_build.partitions = partition_16mb.csv
board_build.flash_mode = qio
test_framework = unity test_framework = unity
build_flags = build_flags =
${btclock_base.build_flags} ${btclock_base.build_flags}
@ -145,6 +146,15 @@ build_flags =
build_unflags = build_unflags =
${btclock_base.build_unflags} ${btclock_base.build_unflags}
[env:btclock_v8_213epd]
extends = env:btclock_v8
test_framework = unity
build_flags =
${env:btclock_v8.build_flags}
-D USE_QR
-D VERSION_EPD_2_13
-D HW_REV=\"REV_V8_EPD_2_13\"
[env:native_test_only] [env:native_test_only]
platform = native platform = native
test_framework = unity test_framework = unity

View File

@ -4,6 +4,18 @@ TaskHandle_t buttonTaskHandle = NULL;
const TickType_t debounceDelay = pdMS_TO_TICKS(50); const TickType_t debounceDelay = pdMS_TO_TICKS(50);
TickType_t lastDebounceTime = 0; TickType_t lastDebounceTime = 0;
#ifdef IS_BTCLOCK_V8
#define BTN_1 0
#define BTN_2 1
#define BTN_3 2
#define BTN_4 3
#else
#define BTN_1 3
#define BTN_2 2
#define BTN_3 1
#define BTN_4 0
#endif
void buttonTask(void *parameter) { void buttonTask(void *parameter) {
while (1) { while (1) {
ulTaskNotifyTake(pdTRUE, portMAX_DELAY); ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
@ -17,16 +29,16 @@ void buttonTask(void *parameter) {
uint pin = mcp1.getLastInterruptPin(); uint pin = mcp1.getLastInterruptPin();
switch (pin) { switch (pin) {
case 3: case BTN_1:
toggleTimerActive(); toggleTimerActive();
break; break;
case 2: case BTN_2:
nextScreen(); nextScreen();
break; break;
case 1: case BTN_3:
previousScreen(); previousScreen();
break; break;
case 0: case BTN_4:
showSystemStatusScreen(); showSystemStatusScreen();
break; break;
} }

View File

@ -4,7 +4,7 @@
Preferences preferences; Preferences preferences;
Adafruit_MCP23X17 mcp1; Adafruit_MCP23X17 mcp1;
#ifdef IS_BTCLOCK_S3 #ifdef IS_BTCLOCK_V8
Adafruit_MCP23X17 mcp2; Adafruit_MCP23X17 mcp2;
#endif #endif
@ -439,12 +439,12 @@ std::vector<ScreenMapping> getScreenNameMap() { return screenMappings; }
void setupMcp() void setupMcp()
{ {
#ifdef IS_BTCLOCK_S3 #ifdef IS_BTCLOCK_V8
const int mcp1AddrPins[] = {MCP1_A0_PIN, MCP1_A1_PIN, MCP1_A2_PIN}; const int mcp1AddrPins[] = {MCP1_A0_PIN, MCP1_A1_PIN, MCP1_A2_PIN};
const int mcp1AddrValues[] = {LOW, LOW, LOW}; const int mcp1AddrValues[] = {LOW, LOW, LOW};
const int mcp2AddrPins[] = {MCP2_A0_PIN, MCP2_A1_PIN, MCP2_A2_PIN}; const int mcp2AddrPins[] = {MCP2_A0_PIN, MCP2_A1_PIN, MCP2_A2_PIN};
const int mcp2AddrValues[] = {LOW, LOW, HIGH}; const int mcp2AddrValues[] = {HIGH, LOW, LOW};
pinMode(MCP_RESET_PIN, OUTPUT); pinMode(MCP_RESET_PIN, OUTPUT);
digitalWrite(MCP_RESET_PIN, HIGH); digitalWrite(MCP_RESET_PIN, HIGH);
@ -505,7 +505,7 @@ void setupHardware()
if (!mcp1.begin_I2C(0x20)) if (!mcp1.begin_I2C(0x20))
{ {
Serial.println(F("Error MCP23017")); Serial.println(F("Error MCP23017 1"));
// while (1) // while (1)
// ; // ;
@ -520,7 +520,7 @@ void setupHardware()
mcp1.pinMode(i, INPUT_PULLUP); mcp1.pinMode(i, INPUT_PULLUP);
mcp1.setupInterruptPin(i, LOW); mcp1.setupInterruptPin(i, LOW);
} }
#ifndef IS_BTCLOCK_S3 #ifndef IS_BTCLOCK_V8
for (int i = 8; i <= 14; i++) for (int i = 8; i <= 14; i++)
{ {
mcp1.pinMode(i, OUTPUT); mcp1.pinMode(i, OUTPUT);
@ -533,10 +533,10 @@ void setupHardware()
#endif #endif
#ifdef IS_BTCLOCK_S3 #ifdef IS_BTCLOCK_V8
if (!mcp2.begin_I2C(0x21)) if (!mcp2.begin_I2C(0x21))
{ {
Serial.println(F("Error MCP23017")); Serial.println(F("Error MCP23017 2"));
// while (1) // while (1)
// ; // ;

View File

@ -30,7 +30,7 @@ MCP23X17_Pin EPD_RESET_MPD[NUM_SCREENS] = {
}; };
Native_Pin EPD_DC = Native_Pin(14); Native_Pin EPD_DC = Native_Pin(14);
#elif IS_BTCLOCK_S3 #elif IS_BTCLOCK_V8
Native_Pin EPD_DC = Native_Pin(38); Native_Pin EPD_DC = Native_Pin(38);
MCP23X17_Pin EPD_BUSY[NUM_SCREENS] = { MCP23X17_Pin EPD_BUSY[NUM_SCREENS] = {
@ -104,8 +104,8 @@ GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> displays[NUM_SCREENS] = {
EPD_CLASS(&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]),
EPD_CLASS(&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]),
EPD_CLASS(&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_V8
EPD_CLASS(&EPD_CS[7], &EPD_DC, &EPD_RESET_MPD[6], &EPD_BUSY[7]), EPD_CLASS(&EPD_CS[7], &EPD_DC, &EPD_RESET_MPD[7], &EPD_BUSY[7]),
#endif #endif
}; };
@ -170,7 +170,7 @@ void setupDisplays()
updateQueue = xQueueCreate(UPDATE_QUEUE_SIZE, sizeof(UpdateDisplayTaskItem)); updateQueue = xQueueCreate(UPDATE_QUEUE_SIZE, sizeof(UpdateDisplayTaskItem));
xTaskCreate(prepareDisplayUpdateTask, "PrepareUpd", 2048, NULL, 11, NULL); xTaskCreate(prepareDisplayUpdateTask, "PrepareUpd", 4096, NULL, 11, NULL);
for (uint i = 0; i < NUM_SCREENS; i++) for (uint i = 0; i < NUM_SCREENS; i++)
{ {
@ -180,7 +180,7 @@ void setupDisplays()
int *taskParam = new int; int *taskParam = new int;
*taskParam = i; *taskParam = i;
xTaskCreate(updateDisplay, ("EpdUpd" + String(i)).c_str(), 2048, taskParam, xTaskCreate(updateDisplay, ("EpdUpd" + String(i)).c_str(), 4096, taskParam,
11, &tasks[i]); // create task 11, &tasks[i]); // create task
} }
@ -194,8 +194,11 @@ void setupDisplays()
} }
else else
{ {
#ifdef IS_BTCLOCK_V8
epdContent = {"B", "T", "C", "L", "O", "C", "K", "v8"};
#else
epdContent = {"B", "T", "C", "L", "O", "C", "K"}; epdContent = {"B", "T", "C", "L", "O", "C", "K"};
#endif
} }
setEpdContent(epdContent); setEpdContent(epdContent);

View File

@ -17,7 +17,7 @@
#include "defaults.hpp" #include "defaults.hpp"
extern Adafruit_MCP23X17 mcp1; extern Adafruit_MCP23X17 mcp1;
#ifdef IS_BTCLOCK_S3 #ifdef IS_BTCLOCK_V8
extern Adafruit_MCP23X17 mcp2; extern Adafruit_MCP23X17 mcp2;
#endif #endif
extern Preferences preferences; extern Preferences preferences;