diff --git a/.github/workflows/tagging.yml b/.github/workflows/tagging.yml index 825d100..13e2a3c 100644 --- a/.github/workflows/tagging.yml +++ b/.github/workflows/tagging.yml @@ -1,9 +1,9 @@ name: BTClock CI -on: +on: push: tags: - - '*' + - "*" jobs: build: @@ -40,10 +40,14 @@ jobs: version: esp32s3 - name: btclock_rev_b version: esp32s3 + - name: btclock_v8 + version: esp32s3 epd_variant: [213epd, 29epd] exclude: - - chip: btclock_rev_b - epd_variant: 29epd + - chip: btclock_rev_b + epd_variant: 29epd + - chip: btclock_v8 + epd_variant: 29epd steps: - uses: actions/download-artifact@v4 with: @@ -51,13 +55,37 @@ jobs: path: .pio - name: Install esptools.py 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 - 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 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 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 - name: Write commit hash to file run: echo $GITHUB_SHA > commit.txt - + - name: Write build date to file run: echo "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" > date.txt - + - name: Create release uses: ncipollo/release-action@v1 with: @@ -117,8 +145,8 @@ jobs: with: source-directory: . target-directory: firmware_v3/ - destination-github-username: 'btclock' - destination-repository-name: 'web-flasher' + destination-github-username: "btclock" + destination-repository-name: "web-flasher" target-branch: main user-name: ${{github.actor}} - user-email: ${{github.actor}}@users.noreply.github.com \ No newline at end of file + user-email: ${{github.actor}}@users.noreply.github.com diff --git a/boards/btclock.json b/boards/btclock_v8.json similarity index 92% rename from boards/btclock.json rename to boards/btclock_v8.json index bee4064..b30bd19 100644 --- a/boards/btclock.json +++ b/boards/btclock_v8.json @@ -10,7 +10,7 @@ "-DBOARD_HAS_PSRAM", "-DARDUINO_BTCLOCK", "-DARDUINO_ESP32S3_DEV", - "-DIS_BTCLOCK_S3", + "-DIS_BTCLOCK_V8", "-DARDUINO_USB_MODE=1", "-DARDUINO_RUNNING_CORE=1", "-DARDUINO_EVENT_RUNNING_CORE=1", @@ -20,8 +20,8 @@ "f_flash": "80000000L", "flash_mode": "qio", "psram_type": "opi", - "espidf": { - "sdkconfig_path": "boards" + "esp-idf": { + "sdkconfig_path": "boards/sdkconfig.btclock_v8" }, "hwids": [ [ diff --git a/data b/data index 7d82b1e..95aa9d6 160000 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 7d82b1e1a9014e80f725478333774f4d53e22134 +Subproject commit 95aa9d67d17dde32dab3216810e7b4e4086feb03 diff --git a/partition_16mb.csv b/partition_16mb.csv index 80df02b..a32b7ca 100644 --- a/partition_16mb.csv +++ b/partition_16mb.csv @@ -3,5 +3,5 @@ nvs, data, nvs, 36K, 20K, otadata, data, ota, 56K, 8K, app0, app, ota_0, 64K, 4096K, app1, app, ota_1, , 4096K, -spiffs, data, spiffs, , 3072K, +spiffs, data, spiffs, , 400K, coredump, data, coredump,, 64K, diff --git a/platformio.ini b/platformio.ini index 13b8e5f..30e03ec 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,7 +9,7 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] 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] @@ -120,10 +120,11 @@ build_flags = -D VERSION_EPD_2_9 -D HW_REV=\"REV_B_EPD_2_9\" -[env:btclock_s3] +[env:btclock_v8] extends = btclock_base -board = btclock +board = btclock_v8 board_build.partitions = partition_16mb.csv +board_build.flash_mode = qio test_framework = unity build_flags = ${btclock_base.build_flags} @@ -145,6 +146,15 @@ build_flags = 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] platform = native test_framework = unity diff --git a/src/lib/button_handler.cpp b/src/lib/button_handler.cpp index 7b27a64..437090d 100644 --- a/src/lib/button_handler.cpp +++ b/src/lib/button_handler.cpp @@ -4,6 +4,18 @@ TaskHandle_t buttonTaskHandle = NULL; const TickType_t debounceDelay = pdMS_TO_TICKS(50); 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) { while (1) { ulTaskNotifyTake(pdTRUE, portMAX_DELAY); @@ -17,16 +29,16 @@ void buttonTask(void *parameter) { uint pin = mcp1.getLastInterruptPin(); switch (pin) { - case 3: + case BTN_1: toggleTimerActive(); break; - case 2: + case BTN_2: nextScreen(); break; - case 1: + case BTN_3: previousScreen(); break; - case 0: + case BTN_4: showSystemStatusScreen(); break; } diff --git a/src/lib/config.cpp b/src/lib/config.cpp index 2898a31..17805c0 100644 --- a/src/lib/config.cpp +++ b/src/lib/config.cpp @@ -4,7 +4,7 @@ Preferences preferences; Adafruit_MCP23X17 mcp1; -#ifdef IS_BTCLOCK_S3 +#ifdef IS_BTCLOCK_V8 Adafruit_MCP23X17 mcp2; #endif @@ -439,12 +439,12 @@ std::vector getScreenNameMap() { return screenMappings; } void setupMcp() { -#ifdef IS_BTCLOCK_S3 +#ifdef IS_BTCLOCK_V8 const int mcp1AddrPins[] = {MCP1_A0_PIN, MCP1_A1_PIN, MCP1_A2_PIN}; const int mcp1AddrValues[] = {LOW, LOW, LOW}; 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); digitalWrite(MCP_RESET_PIN, HIGH); @@ -505,7 +505,7 @@ void setupHardware() if (!mcp1.begin_I2C(0x20)) { - Serial.println(F("Error MCP23017")); + Serial.println(F("Error MCP23017 1")); // while (1) // ; @@ -520,7 +520,7 @@ void setupHardware() mcp1.pinMode(i, INPUT_PULLUP); mcp1.setupInterruptPin(i, LOW); } -#ifndef IS_BTCLOCK_S3 +#ifndef IS_BTCLOCK_V8 for (int i = 8; i <= 14; i++) { mcp1.pinMode(i, OUTPUT); @@ -533,10 +533,10 @@ void setupHardware() #endif -#ifdef IS_BTCLOCK_S3 +#ifdef IS_BTCLOCK_V8 if (!mcp2.begin_I2C(0x21)) { - Serial.println(F("Error MCP23017")); + Serial.println(F("Error MCP23017 2")); // while (1) // ; diff --git a/src/lib/epd.cpp b/src/lib/epd.cpp index cc44c7e..7688fc8 100644 --- a/src/lib/epd.cpp +++ b/src/lib/epd.cpp @@ -30,7 +30,7 @@ MCP23X17_Pin EPD_RESET_MPD[NUM_SCREENS] = { }; Native_Pin EPD_DC = Native_Pin(14); -#elif IS_BTCLOCK_S3 +#elif IS_BTCLOCK_V8 Native_Pin EPD_DC = Native_Pin(38); MCP23X17_Pin EPD_BUSY[NUM_SCREENS] = { @@ -104,8 +104,8 @@ GxEPD2_BW displays[NUM_SCREENS] = { 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[6], &EPD_DC, &EPD_RESET_MPD[6], &EPD_BUSY[6]), -#ifdef IS_BTCLOCK_S3 - EPD_CLASS(&EPD_CS[7], &EPD_DC, &EPD_RESET_MPD[6], &EPD_BUSY[7]), +#ifdef IS_BTCLOCK_V8 + EPD_CLASS(&EPD_CS[7], &EPD_DC, &EPD_RESET_MPD[7], &EPD_BUSY[7]), #endif }; @@ -170,7 +170,7 @@ void setupDisplays() 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++) { @@ -180,7 +180,7 @@ void setupDisplays() int *taskParam = new int; *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 } @@ -194,8 +194,11 @@ void setupDisplays() } else { - + #ifdef IS_BTCLOCK_V8 + epdContent = {"B", "T", "C", "L", "O", "C", "K", "v8"}; + #else epdContent = {"B", "T", "C", "L", "O", "C", "K"}; + #endif } setEpdContent(epdContent); diff --git a/src/lib/shared.hpp b/src/lib/shared.hpp index 68a64b6..a381c7f 100644 --- a/src/lib/shared.hpp +++ b/src/lib/shared.hpp @@ -17,7 +17,7 @@ #include "defaults.hpp" extern Adafruit_MCP23X17 mcp1; -#ifdef IS_BTCLOCK_S3 +#ifdef IS_BTCLOCK_V8 extern Adafruit_MCP23X17 mcp2; #endif extern Preferences preferences;