Files
DS5Dongle-OLED-Edition-stea…/.github/workflows/build.yml
T
Thierry Perrautandawalol 63c62081eb feat: low-battery LED indicator (ENABLE_BATT_LED, default ON)
Blink the Pico onboard LED at 1 Hz when the connected DualSense
reports PowerPercent <= 1 (i.e. <= 10%) and PowerState == Discharging.
Source data is byte 52 of the BT 0x31 input report, already copied
into interrupt_in_data; no new BT parsing required.

The new module owns the LED only while it is actively blinking; it
detects controller disconnection via stale-report timeout and steps
out, so bt.cpp's existing connect/disconnect LED handling stays in
charge in all other states. Honors disable_pico_led.

Gated by -DENABLE_BATT_LED=ON (default). With the option off, the
source file is not compiled and behavior is identical to upstream.
CI gains a compile-only check for the OFF flavor.

(cherry picked from commit 2f8ea73c9fb695e24e7cc3329db7cb925e82e1c9)
2026-05-13 18:09:31 +08:00

118 lines
4.0 KiB
YAML

name: Build firmware
on:
push:
branches:
- "**"
workflow_dispatch:
env:
PICO_SDK_REF: 2.2.0
TINYUSB_REF: 0.20.0
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
APT_PACKAGES: >-
cmake
python3
build-essential
gcc-arm-none-eabi
libnewlib-arm-none-eabi
libstdc++-arm-none-eabi-newlib
ninja-build
jobs:
build:
name: Build UF2 artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Prepare build dependency cache
id: apt-cache
run: |
mkdir -p "$RUNNER_TEMP/apt-cache/partial"
. /etc/os-release
package_hash="$(printf '%s' "$APT_PACKAGES" | sha256sum | cut -d ' ' -f 1)"
echo "dir=$RUNNER_TEMP/apt-cache" >> "$GITHUB_OUTPUT"
echo "os=${ID}-${VERSION_ID}" >> "$GITHUB_OUTPUT"
echo "package-hash=$package_hash" >> "$GITHUB_OUTPUT"
- name: Cache build dependencies
uses: actions/cache@v4
with:
path: ${{ steps.apt-cache.outputs.dir }}
key: ${{ runner.os }}-${{ runner.arch }}-apt-${{ steps.apt-cache.outputs.os }}-${{ steps.apt-cache.outputs.package-hash }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-apt-${{ steps.apt-cache.outputs.os }}-
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get -o Dir::Cache::archives="${{ steps.apt-cache.outputs.dir }}" install --download-only -y $APT_PACKAGES
sudo apt-get -o Dir::Cache::archives="${{ steps.apt-cache.outputs.dir }}" install -y $APT_PACKAGES
sudo chmod -R a+rX "${{ steps.apt-cache.outputs.dir }}"
- name: Cache Pico SDK
id: cache-pico-sdk
uses: actions/cache@v4
with:
path: ${{ env.PICO_SDK_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pico-sdk-${{ env.PICO_SDK_REF }}-tinyusb-${{ env.TINYUSB_REF }}
- name: Download Pico SDK
if: steps.cache-pico-sdk.outputs.cache-hit != 'true'
run: |
git clone --depth 1 --branch "$PICO_SDK_REF" https://github.com/raspberrypi/pico-sdk.git "$PICO_SDK_PATH"
git -C "$PICO_SDK_PATH" submodule update --init --recursive
- name: Switch TinyUSB to configured tag
run: |
if ! git -C "$PICO_SDK_PATH/lib/tinyusb" rev-parse -q --verify "refs/tags/$TINYUSB_REF" >/dev/null; then
git -C "$PICO_SDK_PATH/lib/tinyusb" fetch --depth 1 origin "refs/tags/$TINYUSB_REF:refs/tags/$TINYUSB_REF"
fi
git -C "$PICO_SDK_PATH/lib/tinyusb" checkout --detach "$TINYUSB_REF"
- name: Build standard firmware
run: |
cmake -S . -B build/standard -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DPICO_SDK_PATH="$PICO_SDK_PATH"
cmake --build build/standard --target ds5-bridge
mkdir -p artifacts
cp build/standard/ds5-bridge.uf2 artifacts/ds5-bridge.uf2
- name: Build Debug firmware
run: |
cmake -S . -B build/debug -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DPICO_SDK_PATH="$PICO_SDK_PATH" \
-DENABLE_SERIAL=ON \
-DENABLE_VERBOSE=ON
cmake --build build/debug --target ds5-bridge
cp build/debug/ds5-bridge.uf2 artifacts/ds5-bridge-debug.uf2
- name: Build no-batt-led firmware (compile check only)
run: |
cmake -S . -B build/no-batt-led -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DPICO_SDK_PATH="$PICO_SDK_PATH" \
-DENABLE_BATT_LED=OFF
cmake --build build/no-batt-led --target ds5-bridge
- name: Upload standard UF2 artifact
uses: actions/upload-artifact@v7
with:
path: artifacts/ds5-bridge.uf2
archive: false
if-no-files-found: error
- name: Upload Debug UF2 artifact
uses: actions/upload-artifact@v7
with:
path: artifacts/ds5-bridge-debug.uf2
archive: false
if-no-files-found: error