Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moves CI to github #3

Merged
merged 4 commits into from
Mar 1, 2024
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
21 changes: 21 additions & 0 deletions .github/workflows/arduino.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Arduino Lib

on:
pull_request:
branches:
- master

jobs:
arduino-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/arduino-lint-action@v1

arduino-ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Arduino-CI/[email protected]
env:
EXPECT_EXAMPLES: true
39 changes: 39 additions & 0 deletions .github/workflows/platformio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: PIO Lib

on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- "[0-9]+.[0-9]+.[0-9]+"

jobs:
PlatformIO-Check:
uses: sensirion/.github/.github/workflows/platformio_check.yml@main
with:
pio-environment-list: '["GetLiveValues"]'

PlatformIO-Build:
uses: sensirion/.github/.github/workflows/platformio_build.yml@main
needs: PlatformIO-Check
with:
pio-environment-list: '["GetLiveValues"]'

PlatformIO-Package:
if: ${{ (github.ref_type != 'tag') && (github.ref_name == 'main') }}
needs: PlatformIO-Build
uses: sensirion/.github/.github/workflows/platformio_publish.yml@main
with:
should-publish: false

PlatformIO-Publish:
uses: sensirion/.github/.github/workflows/platformio_publish.yml@main
if: github.ref_type == 'tag'
needs: PlatformIO-Build
with:
should-publish: true
secrets:
pio-registry-token: ${{ secrets.PIO_MKTSW_TOKEN }}
42 changes: 0 additions & 42 deletions .gitlab-ci.yml

This file was deleted.

30 changes: 20 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
# Arduino Sensirion UPT BLE Auto Detection

This library enables you to retrieve live measurements form your own Do-It-Yourself BLE enabled sensor gadget or most Sensirion Gadgets on the ESP32 platform.
This library enables you to retrieve live measurements form your own Do-It-Yourself BLE enabled sensor gadget or most Sensirion Gadgets on the ESP32 platform.

## Supported Gadgets
* AQ Minion
* MyCO2
* SHT3X Gadget
* SHT40 Gadget
* SHT43 Gadget
* [DIY BLE Gadget](https://github.com/Sensirion/arduino-ble-gadget)

- AQ Minion
- MyCO2
- SHT3X Gadget
- SHT40 Gadget
- SHT43 Gadget
- [DIY BLE Gadget](https://github.com/Sensirion/arduino-ble-gadget)

### Key features are

**Please see [the example provided as reference](examples/GetLiveValues/GetLiveValues.ino) on how to use this library.**

## How to use

### Recommended Hardware

This project was developed and tested on Espressif [ESP32 DevKitC](https://www.espressif.com/en/products/devkits/esp32-devkitc) hardware (see e.g. [ESP32-DevKitC-32D](https://www.digikey.com/en/products/detail/espressif-systems/ESP32-DEVKITC-32D/9356990)).
This library requires standard library compatibility. Some boards such as Arduino AVR Uno do not ship with this functionnality.

### Arduino

Install the software from the [official website](https://www.arduino.cc/en/software) and read [this short tutorial](https://docs.arduino.cc/software/ide-v2/tutorials/getting-started-ide-v2/) to get an introduction to the IDE.
Next, select your board and port in the Board Manager by following [these instructions](https://support.arduino.cc/hc/en-us/articles/4406856349970-Select-board-and-port-in-Arduino-IDE).

Expand All @@ -30,8 +33,9 @@ Start the [Arduino IDE](http://www.arduino.cc/en/main/software) and open the Lib
Sketch => Include Library => Manage Libraries...

Search for the `Sensirion UPT BLE Auto Detection` library in the `Filter your search...` field and install it by clicking the `install` button. Make sure to click "Install All", lest you'll have to manually search for and install the dependencies:
* [NimBLE-Arduino](https://www.arduino.cc/reference/en/libraries/nimble-arduino/).
* [Sensirion UPT Core](https://www.arduino.cc/reference/en/libraries/sensirion-upt-core/)

- [NimBLE-Arduino](https://www.arduino.cc/reference/en/libraries/nimble-arduino/).
- [Sensirion UPT Core](https://www.arduino.cc/reference/en/libraries/sensirion-upt-core/)

Alternatively, the library can also be added manually. To do this, download the latest release from github as a .zip file via

Expand All @@ -44,6 +48,7 @@ and add it to the [Arduino IDE](http://www.arduino.cc/en/main/software) via
In this second case, you'll have to also add all dependencies the same way.

### PlatformIO

An often more straightforward alternative to the Arduino IDE is the PlatformIO framework, which is the recommended approach on Linux/Unix systems and is detailed in the following.

The most straight-forward way to use [PlatformIO](https://platformio.org/platformio-ide) is as an extension to Microsoft's [Visual Studio Code](https://code.visualstudio.com/), you'll find it easily among the extensions available for it. Please refer to the official installation instructions [here](https://platformio.org/install/ide?install=vscode).
Expand All @@ -54,18 +59,23 @@ To use the library, add the following dependencies to your `platformio.ini`'s `l
lib_deps =
Sensirion UPT BLE Auto Detection
```

PlatformIO will automatically fetch the latest version of the dependencies during the build process.

Alternatively, to install this library in your project environment execute the following command in a terminal:

```bash
pio pkg install --library "Sensirion UPT BLE Auto Detection"
```

To test the default example (`GetLiveValues`), use the following platformio command from the project's root directory (the one containing the `platformio.ini` file):

```bash
pio run -t upload
```

and start the Serial monitor with

```bash
pio device monitor
```
Expand All @@ -78,4 +88,4 @@ See [LICENSE](LICENSE).

## Credits

https://github.com/MBjoern/arduino-ble-sensiscan
This repository is based on the great work of @MBjoern called [arduino-ble-sensiscan](https://github.com/MBjoern/arduino-ble-sensiscan). Kudos to him !
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ maintainer=Sensirion AG <sensirion.com>
sentence=Automatically detects Sensirion Gadgets via Bluetooth and reads out measurement data.
paragraph=Automatically detects Sensirion Gadgets via Bluetooth and reads out measurement data.
category=Communication, Sensors
url=
url=https://github.com/Sensirion/arduino-upt-ble-auto-detection
architectures=esp32
depends=NimBLE-Arduino, Sensirion UPT Core
includes=Sensirion_upt_ble_auto_detection.h
13 changes: 12 additions & 1 deletion py_scripts/make_cpp_files.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import os
import shutil

ARDUINO_FILE_EXTENSION = ".ino"
TARGET_FILE_EXTENSION = ".cpp"
EXAMPLE_FOLDER = "examples"

# Create a .cpp file for all the .ino files in the examples dir (CAUTION: will overwrite existing)
print("PRE_SCRIPT: Copying .ino file contents to .cpp files.")
os.system(f'find examples -type f -name "*.ino" -exec bash -c \'for file; do cp "$file" "$(dirname "$file")/$(basename "$file" .ino).cpp"; done\' _ {{}} +')
for e in os.listdir(EXAMPLE_FOLDER):
if os.path.isdir(f"{EXAMPLE_FOLDER}/{e}") and os.path.isfile(f"{EXAMPLE_FOLDER}/{e}/{e}{ARDUINO_FILE_EXTENSION}"):
arduino_file =f"{EXAMPLE_FOLDER}/{e}/{e}{ARDUINO_FILE_EXTENSION}"
cpp_file = f"{EXAMPLE_FOLDER}/{e}/{e}{TARGET_FILE_EXTENSION}"
shutil.copyfile(arduino_file, cpp_file)
print(f'\tcopied {arduino_file} to {cpp_file}')
print("\t>> Done.")