Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/platformio-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build Arduino examples

on:
push:
paths:
- 'src/**'
- 'examples/**'
- 'library.properties'
- '.github/workflows/platformio-examples.yml'
pull_request:
paths:
- 'src/**'
- 'examples/**'
- 'library.properties'
- '.github/workflows/platformio-examples.yml'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: platformio-${{ runner.os }}-${{ hashFiles('library.properties') }}
restore-keys: |
platformio-${{ runner.os }}-

- name: Install PlatformIO Core
run: pip install --upgrade platformio

- name: Build examples
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
sketches=(examples/*/*.ino)

if [ ${#sketches[@]} -eq 0 ]; then
echo "No examples found"
exit 1
fi

for sketch in "${sketches[@]}"; do
sketch_dir=$(dirname "$sketch")
sketch_name=$(basename "$sketch_dir")
echo "::group::Building ${sketch_name}"
pio ci \
--board esp32dev \
--lib="." \
"$sketch"
echo "::endgroup::"
done
13 changes: 12 additions & 1 deletion examples/NimBLE_Scan_Continuous/NimBLE_Scan_Continuous.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* This example will scan forever while consuming as few resources as possible
* and report all advertisments on the serial monitor.
*
* The scan callback prints the primary advertising channel for each
* advertisement when available, demonstrating the use of
* NimBLEAdvertisedDevice::getChannel().
*
* Created: on January 31 2021
* Author: H2zero
*
Expand All @@ -13,7 +17,14 @@ NimBLEScan* pBLEScan;

class MyAdvertisedDeviceCallbacks: public NimBLEAdvertisedDeviceCallbacks {
void onResult(NimBLEAdvertisedDevice* advertisedDevice) {
Serial.printf("Advertised Device: %s \n", advertisedDevice->toString().c_str());
uint8_t channel = advertisedDevice->getChannel();
if (channel != 0xFF) {
Serial.printf("Advertised Device on channel %u: %s \n",
channel, advertisedDevice->toString().c_str());
} else {
Serial.printf("Advertised Device on unknown channel: %s \n",
advertisedDevice->toString().c_str());
}
}
};

Expand Down
Loading