From 2c460b59a25a273058d760b03391e2915de20357 Mon Sep 17 00:00:00 2001 From: "Arend-Jan van Hilten (TU)" Date: Mon, 9 Oct 2023 13:23:16 +0200 Subject: [PATCH 01/11] Fix digitalread not always sending a message from setup --- Telemetrix4RpiPico.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Telemetrix4RpiPico.c b/Telemetrix4RpiPico.c index f9772f1..f883309 100644 --- a/Telemetrix4RpiPico.c +++ b/Telemetrix4RpiPico.c @@ -247,6 +247,7 @@ void set_pin_mode() case DIGITAL_INPUT_PULL_DOWN: the_digital_pins[pin].pin_mode = mode; the_digital_pins[pin].reporting_enabled = command_buffer[SET_PIN_MODE_DIGITAL_IN_REPORTING_STATE]; + the_digital_pins[pin].last_value = 0xFF; gpio_init(pin); gpio_set_dir(pin, GPIO_IN); if (mode == DIGITAL_INPUT_PULL_UP) From bf238f51b478e4ea4680e300d460b9f2d64bb459 Mon Sep 17 00:00:00 2001 From: "Arend-Jan van Hilten (TU)" Date: Mon, 9 Oct 2023 14:27:01 +0200 Subject: [PATCH 02/11] Add building of uf2 to pipeline --- .github/workflows/deploy.yml | 69 ++++++++++++++++++++++++++++++++++++ Dockerfile | 33 +++++++++++++++++ build.sh | 9 +++++ 3 files changed, 111 insertions(+) create mode 100644 .github/workflows/deploy.yml create mode 100644 Dockerfile create mode 100755 build.sh diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..27b1762 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,69 @@ +name: Deploy new version + +# Only deploy when a new tag is pushed +on: [push, pull_request] + +# Must match the project() name in CMakeLists.txt +env: + APP_NAME: Telemetrix4RpiPico + +# Allow this workflow to write back to the repository +permissions: + contents: write + +# Build binary and send to releases +jobs: + build-deploy: + runs-on: ubuntu-latest + name: Build and deploy + steps: + + - name: Check out this repository + uses: actions/checkout@v3 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache register + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }} + + - name: Build Docker image + uses: docker/build-push-action@v2 + with: + context: ./ + file: ./Dockerfile + builder: ${{ steps.buildx.outputs.name }} + load: true + tags: pico-builder-container:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + - name: Build Docker image + run: docker build -t pico-builder-image . + + - name: Build + run: docker run -v ./:/project/src/ pico-builder-image + + # - name: Copy out .uf2 file + # run: docker cp pico-builder-container:/project/src/build/${APP_NAME}.uf2 ./${APP_NAME}.uf2 + - name: Copy uf2 file + run: cp ./build2/${APP_NAME}.uf2 ./ && rm -rf ./build2 + + - name: Put environment variable into the env context + run: echo "app_name=$APP_NAME" >> $GITHUB_ENV + - name: Archive production artifacts + uses: actions/upload-artifact@v3 + with: + name: dist + path: | + ${APP_NAME}.uf2 + + # - name: Push to release + # uses: softprops/action-gh-release@v1 + # if: startsWith(github.ref, 'refs/tags/') + # with: + # files: ${{ env.app_name }}.uf2 + # body_path: CHANGELOG.md \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c07ed18 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# Fetch ubuntu image +FROM ubuntu:22.04 + +# Install prerequisites +RUN \ + apt update && \ + apt install -y git python3 && \ + apt install -y cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential + +# Install Pico SDK +RUN \ + mkdir -p /project/src/ && \ + cd /project/ && \ + git clone https://github.com/raspberrypi/pico-sdk.git --branch master && \ + cd pico-sdk/ && \ + git submodule update --init && \ + cd / + +# Set the Pico SDK environment variable +ENV PICO_SDK_PATH=/project/pico-sdk/ + +# Copy in our source files +COPY build.sh /root/ +RUN chmod +x /root/build.sh +# Build project +# RUN \ +# mkdir -p /project/src/build && \ +# cd /project/src/build && \ +# cmake .. && \ +# make + +# Command that will be invoked when the container starts +ENTRYPOINT ["/root/build.sh"] \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..cef9f3e --- /dev/null +++ b/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash +cd /project/src/ +ls +ls .. +mkdir build2/ +ls +cd build2 +cmake -DCMAKE_BUILD_TYPE=Release .. +make \ No newline at end of file From 5bebfba9b1feac78939818a31dd7197ae79bdb79 Mon Sep 17 00:00:00 2001 From: "Arend-Jan van Hilten (TU)" Date: Mon, 9 Oct 2023 14:29:25 +0200 Subject: [PATCH 03/11] Test push --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cf9b62c..80f8180 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,5 @@ PC. A complete [User's Guide](https://mryslab.github.io/telemetrix-rpi-pico/) is install and use both the server and client. To install the server, follow these [installation instructions](https://mryslab.github.io/telemetrix-rpi-pico/install_pico_server/). + +Test push From 3c44fba29309a28d83e84421d30260be01883ca9 Mon Sep 17 00:00:00 2001 From: "Arend-Jan van Hilten (TU)" Date: Mon, 9 Oct 2023 14:34:21 +0200 Subject: [PATCH 04/11] Update components --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 27b1762..c72c3cc 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -25,13 +25,13 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Cache register - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: /tmp/.buildx-cache key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }} - name: Build Docker image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: ./ file: ./Dockerfile From e410587b1403f90faf670ad184953ce25815b96a Mon Sep 17 00:00:00 2001 From: "Arend-Jan van Hilten (TU)" Date: Mon, 9 Oct 2023 14:35:33 +0200 Subject: [PATCH 05/11] Remove extra build --- .github/workflows/deploy.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c72c3cc..eb3d34e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -40,12 +40,9 @@ jobs: tags: pico-builder-container:latest cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache - - - name: Build Docker image - run: docker build -t pico-builder-image . - name: Build - run: docker run -v ./:/project/src/ pico-builder-image + run: docker run -v ./:/project/src/ pico-builder-container # - name: Copy out .uf2 file # run: docker cp pico-builder-container:/project/src/build/${APP_NAME}.uf2 ./${APP_NAME}.uf2 From 93728e51619e2aaba7631e42dcd2c8bbdc30df90 Mon Sep 17 00:00:00 2001 From: "Arend-Jan van Hilten (TU)" Date: Mon, 9 Oct 2023 14:36:33 +0200 Subject: [PATCH 06/11] dont rm build folder --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index eb3d34e..910bca9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -47,7 +47,7 @@ jobs: # - name: Copy out .uf2 file # run: docker cp pico-builder-container:/project/src/build/${APP_NAME}.uf2 ./${APP_NAME}.uf2 - name: Copy uf2 file - run: cp ./build2/${APP_NAME}.uf2 ./ && rm -rf ./build2 + run: cp ./build2/${APP_NAME}.uf2 ./ - name: Put environment variable into the env context run: echo "app_name=$APP_NAME" >> $GITHUB_ENV From 2bd41d8663e8791163f48de5c9518ab9e2888868 Mon Sep 17 00:00:00 2001 From: "Arend-Jan van Hilten (TU)" Date: Mon, 9 Oct 2023 14:45:22 +0200 Subject: [PATCH 07/11] change app_name --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 910bca9..e293b62 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -56,7 +56,7 @@ jobs: with: name: dist path: | - ${APP_NAME}.uf2 + ${app_name}.uf2 # - name: Push to release # uses: softprops/action-gh-release@v1 From ebc9ae060405d93e7091649cffe2e52ae7d6414a Mon Sep 17 00:00:00 2001 From: "Arend-Jan van Hilten (TU)" Date: Mon, 9 Oct 2023 14:59:13 +0200 Subject: [PATCH 08/11] Fix app_name --- .github/workflows/deploy.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e293b62..77cd51b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -44,10 +44,8 @@ jobs: - name: Build run: docker run -v ./:/project/src/ pico-builder-container - # - name: Copy out .uf2 file - # run: docker cp pico-builder-container:/project/src/build/${APP_NAME}.uf2 ./${APP_NAME}.uf2 - name: Copy uf2 file - run: cp ./build2/${APP_NAME}.uf2 ./ + run: cp ./build2/Telemetrix4RpiPico.uf2 ./ - name: Put environment variable into the env context run: echo "app_name=$APP_NAME" >> $GITHUB_ENV @@ -56,7 +54,7 @@ jobs: with: name: dist path: | - ${app_name}.uf2 + Telemetrix4RpiPico.uf2 # - name: Push to release # uses: softprops/action-gh-release@v1 From 030a5aee00a46f51766fe9cd598f55ce005972f0 Mon Sep 17 00:00:00 2001 From: "Arend-Jan van Hilten (TU)" Date: Mon, 9 Oct 2023 15:17:21 +0200 Subject: [PATCH 09/11] Release test --- .github/workflows/deploy.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 77cd51b..2012dc3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -56,9 +56,8 @@ jobs: path: | Telemetrix4RpiPico.uf2 - # - name: Push to release - # uses: softprops/action-gh-release@v1 - # if: startsWith(github.ref, 'refs/tags/') - # with: - # files: ${{ env.app_name }}.uf2 - # body_path: CHANGELOG.md \ No newline at end of file + - name: Push to release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: Telemetrix4RpiPico.uf2 \ No newline at end of file From 15eaad40020d6ba83c205c40c111c21c396dbc96 Mon Sep 17 00:00:00 2001 From: "Arend-Jan van Hilten (TU)" Date: Mon, 9 Oct 2023 16:17:41 +0200 Subject: [PATCH 10/11] Remove edit from other branch --- Telemetrix4RpiPico.c | 1 - 1 file changed, 1 deletion(-) diff --git a/Telemetrix4RpiPico.c b/Telemetrix4RpiPico.c index f883309..f9772f1 100644 --- a/Telemetrix4RpiPico.c +++ b/Telemetrix4RpiPico.c @@ -247,7 +247,6 @@ void set_pin_mode() case DIGITAL_INPUT_PULL_DOWN: the_digital_pins[pin].pin_mode = mode; the_digital_pins[pin].reporting_enabled = command_buffer[SET_PIN_MODE_DIGITAL_IN_REPORTING_STATE]; - the_digital_pins[pin].last_value = 0xFF; gpio_init(pin); gpio_set_dir(pin, GPIO_IN); if (mode == DIGITAL_INPUT_PULL_UP) From ec544e2ef85c531e249535b57f443bcca4e9b3b0 Mon Sep 17 00:00:00 2001 From: "Arend-Jan van Hilten (TU)" Date: Mon, 9 Oct 2023 16:19:43 +0200 Subject: [PATCH 11/11] Remove edit from other branch --- Telemetrix4RpiPico.c | 1 - 1 file changed, 1 deletion(-) diff --git a/Telemetrix4RpiPico.c b/Telemetrix4RpiPico.c index f883309..f9772f1 100644 --- a/Telemetrix4RpiPico.c +++ b/Telemetrix4RpiPico.c @@ -247,7 +247,6 @@ void set_pin_mode() case DIGITAL_INPUT_PULL_DOWN: the_digital_pins[pin].pin_mode = mode; the_digital_pins[pin].reporting_enabled = command_buffer[SET_PIN_MODE_DIGITAL_IN_REPORTING_STATE]; - the_digital_pins[pin].last_value = 0xFF; gpio_init(pin); gpio_set_dir(pin, GPIO_IN); if (mode == DIGITAL_INPUT_PULL_UP)