From 92badcdfcd4998ab81466d769a0a1af7da5e9a35 Mon Sep 17 00:00:00 2001 From: hathach Date: Sun, 8 Jun 2025 22:10:19 +0700 Subject: [PATCH 1/3] replace cardSize() with sectorCount() include SdFat_Adafruit_Fork.h --- Adafruit_PyCamera.cpp | 4 ++-- Adafruit_PyCamera.h | 2 +- tjpgd.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Adafruit_PyCamera.cpp b/Adafruit_PyCamera.cpp index a674d0a..791d82b 100644 --- a/Adafruit_PyCamera.cpp +++ b/Adafruit_PyCamera.cpp @@ -169,7 +169,7 @@ bool Adafruit_PyCamera::initSD(void) { } Serial.println("Card successfully initialized"); - uint32_t size = sd.card()->cardSize(); + uint32_t size = sd.card()->sectorCount(); if (size == 0) { Serial.println("Can't determine the card size"); } else { @@ -494,7 +494,7 @@ bool Adafruit_PyCamera::takePhoto(const char *filename_base, return false; } - if (!sd.card() || (sd.card()->cardSize() == 0)) { + if (!sd.card() || (sd.card()->sectorCount() == 0)) { Serial.println("No SD card found"); // try to initialize? if (!initSD()) diff --git a/Adafruit_PyCamera.h b/Adafruit_PyCamera.h index 5d8c940..21b7cad 100644 --- a/Adafruit_PyCamera.h +++ b/Adafruit_PyCamera.h @@ -3,7 +3,7 @@ #include #include #include // Hardware-specific library for ST7789 -#include +#include #ifndef TAG #define TAG "PYCAM" diff --git a/tjpgd.c b/tjpgd.c index bd8a445..4890335 100644 --- a/tjpgd.c +++ b/tjpgd.c @@ -87,7 +87,7 @@ static const uint16_t Ipsf[64] = #if JD_TBLCLIP -#define BYTECLIP(v) Clip8[(unsigned int)(v)&0x3FF] +#define BYTECLIP(v) Clip8[(unsigned int)(v) & 0x3FF] static const uint8_t Clip8[1024] = { /* 0..255 */ From 349cba5d986b1b209e51d286dcc3bec579534791 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 9 Jun 2025 11:11:30 +0700 Subject: [PATCH 2/3] add pre-commit, run pre-commit before build --- .github/workflows/githubci.yml | 45 ++++++++++++++++++++-------------- .pre-commit-config.yaml | 11 +++++++++ tjpgd.c | 2 +- 3 files changed, 39 insertions(+), 19 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/githubci.yml b/.github/workflows/githubci.yml index 21e9999..3ddc9b5 100644 --- a/.github/workflows/githubci.yml +++ b/.github/workflows/githubci.yml @@ -3,15 +3,33 @@ name: Arduino Library CI on: [pull_request, push, repository_dispatch] jobs: - build: + pre-commit: runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run pre-commit + uses: pre-commit/action@v3.0.1 + + - uses: actions/checkout@v4 + with: + repository: adafruit/ci-arduino + path: ci + + - name: pre-install + run: bash ci/actions_install.sh + + - name: doxygen + env: + GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }} + PRETTYNAME : "Adafruit Arcada Library" + run: bash ci/doxy_gen_and_deploy.sh + build: + runs-on: ubuntu-latest + needs: pre-commit steps: - - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - uses: actions/checkout@v3 - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - uses: actions/checkout@v4 with: repository: adafruit/ci-arduino path: ci @@ -24,21 +42,12 @@ jobs: - name: list run: | - ls - ls examples/*/build/ + ls + ls examples/*/build/ - name: Upload build artifacts uses: actions/upload-artifact@v4 with: name: example_uf2s path: | - examples/*/build/*/*.uf2 - - - name: clang - run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r . - - - name: doxygen - env: - GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }} - PRETTYNAME : "Adafruit PyCamera Library" - run: bash ci/doxy_gen_and_deploy.sh + examples/*/build/*/*.uf2 \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..5ea4342 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò +# +# SPDX-License-Identifier: Unlicense + +repos: +- repo: https://github.com/pre-commit/mirrors-clang-format + rev: v15.0.7 + hooks: + - id: clang-format + types_or: [c++, c, header] + exclude: \.ino$ diff --git a/tjpgd.c b/tjpgd.c index 4890335..bd8a445 100644 --- a/tjpgd.c +++ b/tjpgd.c @@ -87,7 +87,7 @@ static const uint16_t Ipsf[64] = #if JD_TBLCLIP -#define BYTECLIP(v) Clip8[(unsigned int)(v) & 0x3FF] +#define BYTECLIP(v) Clip8[(unsigned int)(v)&0x3FF] static const uint8_t Clip8[1024] = { /* 0..255 */ From 4d42341699d051d776487667835b54946db3794c Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 9 Jun 2025 11:19:47 +0700 Subject: [PATCH 3/3] bump up version to 1.0.8 --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 899f443..37f99b4 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit PyCamera Library -version=1.0.7 +version=1.0.8 author=Adafruit maintainer=Adafruit sentence=Arduino library for the MEMENTO ESP32-S3 camera