diff --git a/.github/workflows/arduino.yml b/.github/workflows/arduino.yml new file mode 100644 index 0000000..19af482 --- /dev/null +++ b/.github/workflows/arduino.yml @@ -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/action@stable-1.x + env: + EXPECT_EXAMPLES: true diff --git a/.github/workflows/platformio.yml b/.github/workflows/platformio.yml new file mode 100644 index 0000000..3469936 --- /dev/null +++ b/.github/workflows/platformio.yml @@ -0,0 +1,39 @@ +name: PIO Lib + +on: + pull_request: + branches: + - master + push: + branches: + - master + tags: + - "[0-9]+.[0-9]+.[0-9]+" + +jobs: + PlatformIO-Check: + uses: sensirion/.github/.github/workflows/platformio_check.yml@main + with: + pio-environment-list: '["basicUsage", "advancedUsage", "hacksterExample"]' + + PlatformIO-Build: + uses: sensirion/.github/.github/workflows/platformio_build.yml@main + needs: PlatformIO-Check + with: + pio-environment-list: '["basicUsage", "advancedUsage", "hacksterExample"]' + + PlatformIO-Package: + if: ${{ (github.ref_type != 'tag') && (github.ref_name == 'master') }} + 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 }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 5135446..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,68 +0,0 @@ -stages: - - validate - - compile - -compile_pio: - stage: compile - image: - name: registry.gitlab.sensirion.lokal/sensirion/docker/docker-arduino:0.6.0 - tags: [docker, linux] - parallel: - matrix: - - env: [basicUsage, advancedUsage] - script: - - pio run --environment ${env} - -syntax_check: - stage: validate - image: - name: registry.gitlab.sensirion.lokal/sensirion/docker/docker-ubuntu:22.04-1.6.0 - tags: [linux, docker] - before_script: - - apt update - - apt-get install -yq clang-format-14 - script: - - find . -type f -iregex ".*\.\(c\|h\|cpp\|ino\)" -exec clang-format-14 -i -style=file {} \; && git diff --exit-code - -cppcheck: - stage: validate - image: - name: registry.gitlab.sensirion.lokal/mso-sw/drivers/docker-driver-generator:0.2.0 - tags: [linux, docker] - script: - - cppcheck --std=c++11 --language=c++ --error-exitcode=1 --enable=warning,style,performance,portability --suppress=unreadVariable src/* - -TODO_check: - stage: validate - image: - name: registry.gitlab.sensirion.lokal/mso-sw/drivers/docker-driver-generator:0.2.0 - tags: [linux, docker] - script: - - '! grep -rnw --exclude=.gitlab-ci.yml --exclude-dir=.git . -e "TODO"' - - -compile_arduino: - stage: compile - image: - name: registry.gitlab.sensirion.lokal/sensirion/docker/docker-arduino:0.6.0 - tags: [docker, linux] - needs: [] - before_script: - - arduino-cli update - - arduino-cli lib install "Sensirion Core@0.6.0" - - arduino-cli lib install "Sensirion UPT Core" - - arduino-cli lib install "Sensirion I2C SCD4x@0.4.0" - - arduino-cli lib install "Sensirion I2C SFA3x@0.1.0" - - arduino-cli lib install "Sensirion I2C SVM4x@0.2.0" - - arduino-cli lib install "Sensirion I2C SHT4x@0.1.0" - - arduino-cli lib install "Sensirion I2C SEN5X@0.3.0" - - arduino-cli lib install "Sensirion I2C SGP41@1.0.0" - - arduino-cli lib install "Sensirion I2C SCD30@0.1.0" - - arduino-cli lib install "Sensirion I2C STC3X@0.1.0" - - ln -s $PWD ~/Arduino/libraries/ - parallel: - matrix: - - boards: [esp32:esp32:esp32] - examples: [basicUsage, advancedUsage] - script: - - arduino-cli compile --warnings all --fqbn ${boards} examples/${examples} diff --git a/examples/advancedUsage/advancedUsage.ino b/examples/advancedUsage/advancedUsage.ino index d28877b..1f11b0b 100644 --- a/examples/advancedUsage/advancedUsage.ino +++ b/examples/advancedUsage/advancedUsage.ino @@ -17,9 +17,9 @@ perform commands. Thus, only use the driver to perform actions not handled by the sensor manager. */ -#include "Sensirion_upt_i2c_auto_detection.h" -#include "SensirionI2CScd4x.h" #include "Arduino.h" +#include "SensirionI2CScd4x.h" +#include "Sensirion_upt_i2c_auto_detection.h" #include I2CAutoDetector i2CAutoDetector(Wire); @@ -53,6 +53,12 @@ void setup() { AutoDetectorError error = sensorManager.getSensorDriver( pScd4xDriver, SensorType::SCD4X); + if (error != NO_ERROR) { + Serial.print("Encountered error while getting sensor driver (code "); + Serial.print(error); + Serial.println(")"); + } + // Set custom interval for sensor measurement update (default: 5s, lower // values are ignored) sensorManager.setInterval(7500, SensorType::SCD4X); diff --git a/library.properties b/library.properties index 603bcc1..49a7ad6 100644 --- a/library.properties +++ b/library.properties @@ -6,6 +6,6 @@ sentence=Automatically detects Sensirion Sensors on an I2C bus and reads out mea paragraph=Sensors can be read out collectively using a single method. The resulting data points include information about the sensor origin, units and the measurement timestamp. category=Sensors architectures=esp32 -url= +url=https://github.com/Sensirion/arduino-upt-i2c-auto-detection includes=Sensirion_upt_i2c_auto_detection.h depends=Sensirion Core, Sensirion UPT Core, Sensirion I2C SCD4x, Sensirion I2C SFA3x, Sensirion I2C SVM4x, Sensirion I2C SHT4x, Sensirion I2C SEN5X, Sensirion I2C SCD30, Sensirion I2C SGP41, Sensirion I2C STC3x