Skip to content

Commit ff0d8f5

Browse files
committed
Make BTClock v8 board working again
1 parent 41bf248 commit ff0d8f5

File tree

9 files changed

+91
-38
lines changed

9 files changed

+91
-38
lines changed

.github/workflows/tagging.yml

+40-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: BTClock CI
22

3-
on:
3+
on:
44
push:
55
tags:
6-
- '*'
6+
- "*"
77

88
jobs:
99
build:
@@ -40,24 +40,52 @@ jobs:
4040
version: esp32s3
4141
- name: btclock_rev_b
4242
version: esp32s3
43+
- name: btclock_v8
44+
version: esp32s3
4345
epd_variant: [213epd, 29epd]
4446
exclude:
45-
- chip: btclock_rev_b
46-
epd_variant: 29epd
47+
- chip: btclock_rev_b
48+
epd_variant: 29epd
49+
- chip: btclock_v8
50+
epd_variant: 29epd
4751
steps:
4852
- uses: actions/download-artifact@v4
4953
with:
5054
name: prepared-outputs
5155
path: .pio
5256
- name: Install esptools.py
5357
run: pip install --upgrade esptool
54-
58+
# - name: Create merged firmware binary
59+
# 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
5560
- name: Create merged firmware binary
56-
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
61+
run: |
62+
if [ "${{ matrix.chip.name }}" == "btclock_v8" ]; then
63+
mkdir -p ${{ matrix.chip.name }}_${{ matrix.epd_variant }} && \
64+
esptool.py --chip ${{ matrix.chip.version }} merge_bin \
65+
-o ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin \
66+
--flash_mode qio \
67+
0x0000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/bootloader.bin \
68+
0x8000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/partitions.bin \
69+
0xe000 .pio/boot_app0.bin \
70+
0x10000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin \
71+
0x810000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin;
72+
else
73+
# Original command for other cases
74+
mkdir -p ${{ matrix.chip.name }}_${{ matrix.epd_variant }} && \
75+
esptool.py --chip ${{ matrix.chip.version }} merge_bin \
76+
-o ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin \
77+
--flash_mode dio \
78+
0x0000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/bootloader.bin \
79+
0x8000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/partitions.bin \
80+
0xe000 .pio/boot_app0.bin \
81+
0x10000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin \
82+
0x369000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin
83+
# Adjust the offset for littlefs or other files as needed for the original case
84+
fi
5785
5886
- name: Create checksum for firmware
5987
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
60-
88+
6189
- name: Create checksum for merged binary
6290
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
6391

@@ -91,10 +119,10 @@ jobs:
91119
merge-multiple: false
92120
- name: Write commit hash to file
93121
run: echo $GITHUB_SHA > commit.txt
94-
122+
95123
- name: Write build date to file
96124
run: echo "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" > date.txt
97-
125+
98126
- name: Create release
99127
uses: ncipollo/release-action@v1
100128
with:
@@ -117,8 +145,8 @@ jobs:
117145
with:
118146
source-directory: .
119147
target-directory: firmware_v3/
120-
destination-github-username: 'btclock'
121-
destination-repository-name: 'web-flasher'
148+
destination-github-username: "btclock"
149+
destination-repository-name: "web-flasher"
122150
target-branch: main
123151
user-name: ${{github.actor}}
124-
user-email: ${{github.actor}}@users.noreply.github.com
152+
user-email: ${{github.actor}}@users.noreply.github.com

boards/btclock.json boards/btclock_v8.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"-DBOARD_HAS_PSRAM",
1111
"-DARDUINO_BTCLOCK",
1212
"-DARDUINO_ESP32S3_DEV",
13-
"-DIS_BTCLOCK_S3",
13+
"-DIS_BTCLOCK_V8",
1414
"-DARDUINO_USB_MODE=1",
1515
"-DARDUINO_RUNNING_CORE=1",
1616
"-DARDUINO_EVENT_RUNNING_CORE=1",
@@ -20,8 +20,8 @@
2020
"f_flash": "80000000L",
2121
"flash_mode": "qio",
2222
"psram_type": "opi",
23-
"espidf": {
24-
"sdkconfig_path": "boards"
23+
"esp-idf": {
24+
"sdkconfig_path": "boards/sdkconfig.btclock_v8"
2525
},
2626
"hwids": [
2727
[

data

Submodule data updated from 7d82b1e to 95aa9d6

partition_16mb.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ nvs, data, nvs, 36K, 20K,
33
otadata, data, ota, 56K, 8K,
44
app0, app, ota_0, 64K, 4096K,
55
app1, app, ota_1, , 4096K,
6-
spiffs, data, spiffs, , 3072K,
6+
spiffs, data, spiffs, , 400K,
77
coredump, data, coredump,, 64K,

platformio.ini

+13-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
; https://docs.platformio.org/page/projectconf.html
1010
[platformio]
1111
data_dir = data/build_gz
12-
default_envs = lolin_s3_mini_213epd, lolin_s3_mini_29epd, btclock_rev_b_213epd
12+
default_envs = lolin_s3_mini_213epd, lolin_s3_mini_29epd, btclock_rev_b_213epd, btclock_v8_213epd
1313

1414
[env]
1515

@@ -120,10 +120,11 @@ build_flags =
120120
-D VERSION_EPD_2_9
121121
-D HW_REV=\"REV_B_EPD_2_9\"
122122

123-
[env:btclock_s3]
123+
[env:btclock_v8]
124124
extends = btclock_base
125-
board = btclock
125+
board = btclock_v8
126126
board_build.partitions = partition_16mb.csv
127+
board_build.flash_mode = qio
127128
test_framework = unity
128129
build_flags =
129130
${btclock_base.build_flags}
@@ -145,6 +146,15 @@ build_flags =
145146
build_unflags =
146147
${btclock_base.build_unflags}
147148

149+
[env:btclock_v8_213epd]
150+
extends = env:btclock_v8
151+
test_framework = unity
152+
build_flags =
153+
${env:btclock_v8.build_flags}
154+
-D USE_QR
155+
-D VERSION_EPD_2_13
156+
-D HW_REV=\"REV_V8_EPD_2_13\"
157+
148158
[env:native_test_only]
149159
platform = native
150160
test_framework = unity

src/lib/button_handler.cpp

+16-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ TaskHandle_t buttonTaskHandle = NULL;
44
const TickType_t debounceDelay = pdMS_TO_TICKS(50);
55
TickType_t lastDebounceTime = 0;
66

7+
#ifdef IS_BTCLOCK_V8
8+
#define BTN_1 0
9+
#define BTN_2 1
10+
#define BTN_3 2
11+
#define BTN_4 3
12+
#else
13+
#define BTN_1 3
14+
#define BTN_2 2
15+
#define BTN_3 1
16+
#define BTN_4 0
17+
#endif
18+
719
void buttonTask(void *parameter) {
820
while (1) {
921
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
@@ -17,16 +29,16 @@ void buttonTask(void *parameter) {
1729
uint pin = mcp1.getLastInterruptPin();
1830

1931
switch (pin) {
20-
case 3:
32+
case BTN_1:
2133
toggleTimerActive();
2234
break;
23-
case 2:
35+
case BTN_2:
2436
nextScreen();
2537
break;
26-
case 1:
38+
case BTN_3:
2739
previousScreen();
2840
break;
29-
case 0:
41+
case BTN_4:
3042
showSystemStatusScreen();
3143
break;
3244
}

src/lib/config.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Preferences preferences;
66
Adafruit_MCP23X17 mcp1;
7-
#ifdef IS_BTCLOCK_S3
7+
#ifdef IS_BTCLOCK_V8
88
Adafruit_MCP23X17 mcp2;
99
#endif
1010

@@ -439,12 +439,12 @@ std::vector<ScreenMapping> getScreenNameMap() { return screenMappings; }
439439

440440
void setupMcp()
441441
{
442-
#ifdef IS_BTCLOCK_S3
442+
#ifdef IS_BTCLOCK_V8
443443
const int mcp1AddrPins[] = {MCP1_A0_PIN, MCP1_A1_PIN, MCP1_A2_PIN};
444444
const int mcp1AddrValues[] = {LOW, LOW, LOW};
445445

446446
const int mcp2AddrPins[] = {MCP2_A0_PIN, MCP2_A1_PIN, MCP2_A2_PIN};
447-
const int mcp2AddrValues[] = {LOW, LOW, HIGH};
447+
const int mcp2AddrValues[] = {HIGH, LOW, LOW};
448448

449449
pinMode(MCP_RESET_PIN, OUTPUT);
450450
digitalWrite(MCP_RESET_PIN, HIGH);
@@ -505,7 +505,7 @@ void setupHardware()
505505

506506
if (!mcp1.begin_I2C(0x20))
507507
{
508-
Serial.println(F("Error MCP23017"));
508+
Serial.println(F("Error MCP23017 1"));
509509

510510
// while (1)
511511
// ;
@@ -520,7 +520,7 @@ void setupHardware()
520520
mcp1.pinMode(i, INPUT_PULLUP);
521521
mcp1.setupInterruptPin(i, LOW);
522522
}
523-
#ifndef IS_BTCLOCK_S3
523+
#ifndef IS_BTCLOCK_V8
524524
for (int i = 8; i <= 14; i++)
525525
{
526526
mcp1.pinMode(i, OUTPUT);
@@ -533,10 +533,10 @@ void setupHardware()
533533

534534
#endif
535535

536-
#ifdef IS_BTCLOCK_S3
536+
#ifdef IS_BTCLOCK_V8
537537
if (!mcp2.begin_I2C(0x21))
538538
{
539-
Serial.println(F("Error MCP23017"));
539+
Serial.println(F("Error MCP23017 2"));
540540

541541
// while (1)
542542
// ;

src/lib/epd.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ MCP23X17_Pin EPD_RESET_MPD[NUM_SCREENS] = {
3030
};
3131

3232
Native_Pin EPD_DC = Native_Pin(14);
33-
#elif IS_BTCLOCK_S3
33+
#elif IS_BTCLOCK_V8
3434
Native_Pin EPD_DC = Native_Pin(38);
3535

3636
MCP23X17_Pin EPD_BUSY[NUM_SCREENS] = {
@@ -104,8 +104,8 @@ GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> displays[NUM_SCREENS] = {
104104
EPD_CLASS(&EPD_CS[4], &EPD_DC, &EPD_RESET_MPD[4], &EPD_BUSY[4]),
105105
EPD_CLASS(&EPD_CS[5], &EPD_DC, &EPD_RESET_MPD[5], &EPD_BUSY[5]),
106106
EPD_CLASS(&EPD_CS[6], &EPD_DC, &EPD_RESET_MPD[6], &EPD_BUSY[6]),
107-
#ifdef IS_BTCLOCK_S3
108-
EPD_CLASS(&EPD_CS[7], &EPD_DC, &EPD_RESET_MPD[6], &EPD_BUSY[7]),
107+
#ifdef IS_BTCLOCK_V8
108+
EPD_CLASS(&EPD_CS[7], &EPD_DC, &EPD_RESET_MPD[7], &EPD_BUSY[7]),
109109
#endif
110110
};
111111

@@ -170,7 +170,7 @@ void setupDisplays()
170170

171171
updateQueue = xQueueCreate(UPDATE_QUEUE_SIZE, sizeof(UpdateDisplayTaskItem));
172172

173-
xTaskCreate(prepareDisplayUpdateTask, "PrepareUpd", 2048, NULL, 11, NULL);
173+
xTaskCreate(prepareDisplayUpdateTask, "PrepareUpd", 4096, NULL, 11, NULL);
174174

175175
for (uint i = 0; i < NUM_SCREENS; i++)
176176
{
@@ -180,7 +180,7 @@ void setupDisplays()
180180
int *taskParam = new int;
181181
*taskParam = i;
182182

183-
xTaskCreate(updateDisplay, ("EpdUpd" + String(i)).c_str(), 2048, taskParam,
183+
xTaskCreate(updateDisplay, ("EpdUpd" + String(i)).c_str(), 4096, taskParam,
184184
11, &tasks[i]); // create task
185185
}
186186

@@ -194,8 +194,11 @@ void setupDisplays()
194194
}
195195
else
196196
{
197-
197+
#ifdef IS_BTCLOCK_V8
198+
epdContent = {"B", "T", "C", "L", "O", "C", "K", "v8"};
199+
#else
198200
epdContent = {"B", "T", "C", "L", "O", "C", "K"};
201+
#endif
199202
}
200203

201204
setEpdContent(epdContent);

src/lib/shared.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "defaults.hpp"
1818

1919
extern Adafruit_MCP23X17 mcp1;
20-
#ifdef IS_BTCLOCK_S3
20+
#ifdef IS_BTCLOCK_V8
2121
extern Adafruit_MCP23X17 mcp2;
2222
#endif
2323
extern Preferences preferences;

0 commit comments

Comments
 (0)