Compare commits
6 commits
main
...
board-loca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8afd334f10 | ||
|
|
defabdc26f | ||
|
|
3cba79f86d | ||
|
|
5e94bfda8f | ||
|
|
93807eacd6 | ||
|
|
3cf70d2f71 |
27 changed files with 177 additions and 1233 deletions
122
.github/workflows/build-clang-doxy.yml
vendored
122
.github/workflows/build-clang-doxy.yml
vendored
|
|
@ -55,20 +55,9 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- name: Get WipperSnapper version
|
||||
run: |
|
||||
git remote add adafruit https://github.com/adafruit/Adafruit_Wippersnapper_Arduino.git || true
|
||||
git fetch --prune --unshallow --all --tags
|
||||
WS_VERSION="unknown"
|
||||
if git describe --dirty --tags >/dev/null 2>&1; then
|
||||
WS_VERSION=$(git describe --dirty --tags)
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
else
|
||||
# Fallback for forks: 1.0.0-{owner}-{short-sha}
|
||||
REPO_OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
WS_VERSION="1.0.0-${REPO_OWNER}-${SHORT_SHA}"
|
||||
echo >>$GITHUB_ENV WS_VERSION="1.0.0-${REPO_OWNER}-${SHORT_SHA}"
|
||||
fi
|
||||
echo "WS_VERSION: $WS_VERSION"
|
||||
git fetch --prune --unshallow --tags
|
||||
git describe --dirty --tags
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
|
|
@ -79,6 +68,7 @@ jobs:
|
|||
with:
|
||||
repository: adafruit/Wippersnapper_Boards
|
||||
path: ws-boards
|
||||
ref: migrate-4mb-to-esptool
|
||||
- name: Install CI-Arduino
|
||||
run: bash ci/actions_install.sh
|
||||
- name: Install extra Arduino libraries
|
||||
|
|
@ -283,17 +273,9 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- name: Get WipperSnapper version
|
||||
run: |
|
||||
git remote add adafruit https://github.com/adafruit/Adafruit_Wippersnapper_Arduino.git || true
|
||||
git fetch --prune --unshallow --all --tags
|
||||
if git describe --dirty --tags >/dev/null 2>&1; then
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
else
|
||||
# Fallback for forks: 1.0.0-{owner}-{short-sha}
|
||||
REPO_OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
echo >>$GITHUB_ENV WS_VERSION="1.0.0-${REPO_OWNER}-${SHORT_SHA}"
|
||||
fi
|
||||
echo "WS_VERSION: $WS_VERSION"
|
||||
git fetch --prune --unshallow --tags
|
||||
git describe --dirty --tags
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
|
|
@ -407,21 +389,13 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- name: Get WipperSnapper version
|
||||
run: |
|
||||
git remote add adafruit https://github.com/adafruit/Adafruit_Wippersnapper_Arduino.git || true
|
||||
git fetch --prune --unshallow --all --tags
|
||||
if git describe --dirty --tags >/dev/null 2>&1; then
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
else
|
||||
# Fallback for forks: 1.0.0-{owner}-{short-sha}
|
||||
REPO_OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
echo >>$GITHUB_ENV WS_VERSION="1.0.0-${REPO_OWNER}-${SHORT_SHA}"
|
||||
fi
|
||||
echo "WS_VERSION: $WS_VERSION"
|
||||
git fetch --prune --unshallow --tags
|
||||
git describe --dirty --tags
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
ref: ci-wippersnapper
|
||||
ref: ci-wippersnapper-boards-local-txt
|
||||
path: ci
|
||||
- name: Checkout Board Definitions
|
||||
uses: actions/checkout@v4
|
||||
|
|
@ -467,7 +441,7 @@ jobs:
|
|||
run: |
|
||||
pip install esptool
|
||||
- name: build ESP32 platforms
|
||||
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000
|
||||
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 --boards-local-txt
|
||||
- name: Check artifacts
|
||||
run: |
|
||||
ls examples/Wippersnapper_demo/build/*
|
||||
|
|
@ -553,17 +527,9 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- name: Get WipperSnapper version
|
||||
run: |
|
||||
git remote add adafruit https://github.com/adafruit/Adafruit_Wippersnapper_Arduino.git || true
|
||||
git fetch --prune --unshallow --all --tags
|
||||
if git describe --dirty --tags >/dev/null 2>&1; then
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
else
|
||||
# Fallback for forks: 1.0.0-{owner}-{short-sha}
|
||||
REPO_OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
echo >>$GITHUB_ENV WS_VERSION="1.0.0-${REPO_OWNER}-${SHORT_SHA}"
|
||||
fi
|
||||
echo "WS_VERSION: $WS_VERSION"
|
||||
git fetch --prune --unshallow --tags
|
||||
git describe --dirty --tags
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
|
|
@ -627,7 +593,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arduino-platform: ["picow_rp2040_tinyusb", "picow_rp2350_tinyusb", "fruit_jam_tinyusb"]
|
||||
arduino-platform: ["picow_rp2040_tinyusb", "picow_rp2350_tinyusb"]
|
||||
steps:
|
||||
- name: "skip if unwanted"
|
||||
continue-on-error: true
|
||||
|
|
@ -643,17 +609,9 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- name: Get WipperSnapper version
|
||||
run: |
|
||||
git remote add adafruit https://github.com/adafruit/Adafruit_Wippersnapper_Arduino.git || true
|
||||
git fetch --prune --unshallow --all --tags
|
||||
if git describe --dirty --tags >/dev/null 2>&1; then
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
else
|
||||
# Fallback for forks: 1.0.0-{owner}-{short-sha}
|
||||
REPO_OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
echo >>$GITHUB_ENV WS_VERSION="1.0.0-${REPO_OWNER}-${SHORT_SHA}"
|
||||
fi
|
||||
echo "WS_VERSION: $WS_VERSION"
|
||||
git fetch --prune --unshallow --tags
|
||||
git describe --dirty --tags
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
|
|
@ -730,17 +688,9 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- name: Get WipperSnapper version
|
||||
run: |
|
||||
git remote add adafruit https://github.com/adafruit/Adafruit_Wippersnapper_Arduino.git || true
|
||||
git fetch --prune --unshallow --all --tags
|
||||
if git describe --dirty --tags >/dev/null 2>&1; then
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
else
|
||||
# Fallback for forks: 1.0.0-{owner}-{short-sha}
|
||||
REPO_OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
echo >>$GITHUB_ENV WS_VERSION="1.0.0-${REPO_OWNER}-${SHORT_SHA}"
|
||||
fi
|
||||
echo "WS_VERSION: $WS_VERSION"
|
||||
git fetch --prune --unshallow --tags
|
||||
git describe --dirty --tags
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
|
|
@ -835,17 +785,9 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- name: Get WipperSnapper version
|
||||
run: |
|
||||
git remote add adafruit https://github.com/adafruit/Adafruit_Wippersnapper_Arduino.git || true
|
||||
git fetch --prune --unshallow --all --tags
|
||||
if git describe --dirty --tags >/dev/null 2>&1; then
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
else
|
||||
# Fallback for forks: 1.0.0-{owner}-{short-sha}
|
||||
REPO_OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
echo >>$GITHUB_ENV WS_VERSION="1.0.0-${REPO_OWNER}-${SHORT_SHA}"
|
||||
fi
|
||||
echo "WS_VERSION: $WS_VERSION"
|
||||
git fetch --prune --unshallow --tags
|
||||
git describe --dirty --tags
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
|
|
@ -947,17 +889,9 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- name: Get WipperSnapper version
|
||||
run: |
|
||||
git remote add adafruit https://github.com/adafruit/Adafruit_Wippersnapper_Arduino.git || true
|
||||
git fetch --prune --unshallow --all --tags
|
||||
if git describe --dirty --tags >/dev/null 2>&1; then
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
else
|
||||
# Fallback for forks: 1.0.0-{owner}-{short-sha}
|
||||
REPO_OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
echo >>$GITHUB_ENV WS_VERSION="1.0.0-${REPO_OWNER}-${SHORT_SHA}"
|
||||
fi
|
||||
echo "WS_VERSION: $WS_VERSION"
|
||||
git fetch --prune --unshallow --tags
|
||||
git describe --dirty --tags
|
||||
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
|
|
|
|||
17
boards.local.txt
Normal file
17
boards.local.txt
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# This is to allow providing extra defines like WS_MY_BOARD_NAME for any boards using generic module board definitions.
|
||||
# Instead of the MY_BOARD_NAME suffix, it should match the unique Board ID in Wippersnapper_Boards.h, but
|
||||
# uppercase with underscores for dashes. e.g. "dfrobot-beetle-esp32c3" becomes WS_DFROBOT_BEETLE_ESP32C3 with -D for define.
|
||||
#
|
||||
# See if the board.txt already has extra board.defines= in any menu entries, or only the basic empty board.defines=
|
||||
# so for example this existing one dfrobot_romeo_esp32s3.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM
|
||||
# then you would add a replacement entry with the existing plus additionally the new -DWS_UNIQUE_BOARD_NAME define:
|
||||
# dfrobot_romeo_esp32s3.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -DWS_DFROBOT_UNIQUE_BOARD_ID
|
||||
#
|
||||
# Do the same for the board entry in the platformio.ini file: build_flags = -DWS_YOUR_UNIQUE_BOARD_ID
|
||||
#
|
||||
# Note: If needed we can do a version of this file for each board build target in case boards don't have a
|
||||
# unique definition in boards.txt to add an override. Then in CI pass filename with --boards-local-txt file
|
||||
|
||||
|
||||
# DF Robot ESP32-C3 shares define with Espressif ESP32_C3 Devkit/Module, so needs unique define:
|
||||
dfrobot_beetle_esp32c3.build.defines=-DWS_DFROBOT_BEETLE_ESP32C3
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
|
||||
|
||||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
|
||||
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
name=Adafruit WipperSnapper
|
||||
version=1.0.0-beta.111
|
||||
version=1.0.0-beta.109
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <adafruitio@adafruit.com>
|
||||
sentence=Arduino application for Adafruit.io WipperSnapper
|
||||
|
|
@ -7,4 +7,4 @@ paragraph=Arduino application for Adafruit.io WipperSnapper
|
|||
category=Communication
|
||||
url=https://github.com/adafruit/Adafruit_Wippersnapper_Arduino
|
||||
architectures=*
|
||||
depends=OmronD6T - Community Fork, SdFat - Adafruit Fork, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA260 Library, Adafruit INA237 and INA238 Library, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit MLX90632 Library, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit AS5600 Library, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, Sensirion I2C SEN66, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VCNL4200 Library, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS28, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork, Adafruit BusIO, Adafruit Unified Sensor, Sensirion Core, Adafruit GFX Library, Adafruit LED Backpack Library, Adafruit LiquidCrystal, Adafruit SH110X, Adafruit SSD1306
|
||||
depends=OmronD6T - Community Fork, SdFat - Adafruit Fork, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA260 Library, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, Sensirion I2C SEN66, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VCNL4200 Library, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS28, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork, Adafruit BusIO, Adafruit Unified Sensor, Sensirion Core, Adafruit GFX Library, Adafruit LED Backpack Library, Adafruit LiquidCrystal, Adafruit SH110X, Adafruit SSD1306
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ lib_deps =
|
|||
adafruit/ENS160 - Adafruit Fork
|
||||
adafruit/Adafruit SleepyDog Library
|
||||
adafruit/Adafruit AHTX0
|
||||
adafruit/Adafruit AS5600 Library
|
||||
adafruit/Adafruit BME280 Library
|
||||
adafruit/Adafruit BMP280 Library
|
||||
adafruit/Adafruit BMP3XX Library
|
||||
|
|
@ -40,7 +39,6 @@ lib_deps =
|
|||
adafruit/Adafruit DS248x
|
||||
adafruit/Adafruit INA219
|
||||
adafruit/Adafruit INA260 Library
|
||||
adafruit/Adafruit INA237 and INA238 Library
|
||||
adafruit/Adafruit HDC302x
|
||||
adafruit/Adafruit HTS221
|
||||
adafruit/Adafruit HTU21DF Library
|
||||
|
|
@ -58,7 +56,6 @@ lib_deps =
|
|||
adafruit/Adafruit MCP3421
|
||||
adafruit/Adafruit MCP9808 Library
|
||||
adafruit/Adafruit MCP9600 Library
|
||||
adafruit/Adafruit MLX90632 Library
|
||||
adafruit/Adafruit MPL115A2
|
||||
adafruit/Adafruit MPRLS Library
|
||||
adafruit/Adafruit MS8607
|
||||
|
|
@ -91,10 +88,7 @@ lib_deps =
|
|||
adafruit/Adafruit SSD1306
|
||||
https://github.com/tyeth/omron-devhub_d6t-arduino.git
|
||||
https://github.com/pstolarz/OneWireNg.git
|
||||
; COMMENT OUT FOR RP2040/RP2350 BOARDS
|
||||
https://github.com/milesburton/Arduino-Temperature-Control-Library.git
|
||||
; AND UNCOMMENT FOR RP2040/RP2350 BOARDS
|
||||
; https://github.com/pstolarz/Arduino-Temperature-Control-Library.git
|
||||
https://github.com/Sensirion/arduino-sht.git
|
||||
https://github.com/Sensirion/arduino-i2c-scd4x.git
|
||||
https://github.com/Sensirion/arduino-i2c-sen5x.git
|
||||
|
|
@ -131,15 +125,19 @@ lib_compat_mode = strict
|
|||
lib_archive = no ; debug timer issues see https://community.platformio.org/t/choose-usb-stack-as-tiny-usb/22451/5
|
||||
lib_ignore = OneWire, USBHost
|
||||
|
||||
; Common build environment for Arduino-Pico platforms
|
||||
[common:arduinopico]
|
||||
[common:rp2040]
|
||||
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#develop
|
||||
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
|
||||
; platform_packages =
|
||||
; framework-arduinopico @ symlink:///Users/tyeth/Projects/arduino-pico
|
||||
; framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#master
|
||||
board = rpipicow
|
||||
framework = arduino
|
||||
board_build.core = earlephilhower
|
||||
board_build.filesystem_size = 0.5m
|
||||
build_flags = -DUSE_TINYUSB
|
||||
; Once https://github.com/platformio/platformio-core > 6.1.11 these can be removed
|
||||
lib_ignore = WiFiNINA, WiFi101, Adafruit Zero DMA Library, OneWire
|
||||
lib_compat_mode = soft ; can be stricter once pio detects SleepyDog on RP2040
|
||||
lib_compat_mode = soft ; can be strict once pio detects SleepyDog on RP2040
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Individual Board Definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
@ -205,8 +203,7 @@ board_build.partitions = min_spiffs.csv
|
|||
extends = common:esp32
|
||||
board = featheresp32-s2
|
||||
build_flags = -DARDUINO_ADAFRUIT_FEATHER_ESP32S2 -DBOARD_HAS_PSRAM
|
||||
;set partition to tinyuf2-partitions-4MB-noota.csv as of CPY 10
|
||||
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
|
||||
board_build.partitions = tinyuf2-partitions-4MB.csv
|
||||
extra_scripts = pre:rename_usb_config.py
|
||||
|
||||
; Adafruit Feather ESP32-S2 TFT
|
||||
|
|
@ -214,8 +211,7 @@ extra_scripts = pre:rename_usb_config.py
|
|||
extends = common:esp32
|
||||
board = adafruit_feather_esp32s2_tft
|
||||
build_flags = -DARDUINO_ADAFRUIT_FEATHER_ESP32S2_TFT -DBOARD_HAS_PSRAM
|
||||
;set partition to tinyuf2-partitions-4MB-noota.csv as of CPY 10
|
||||
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
|
||||
board_build.partitions = tinyuf2-partitions-4MB.csv
|
||||
extra_scripts = pre:rename_usb_config.py
|
||||
|
||||
; Adafruit Feather ESP32-S2 Reverse TFT
|
||||
|
|
@ -223,8 +219,7 @@ extra_scripts = pre:rename_usb_config.py
|
|||
extends = common:esp32
|
||||
board = adafruit_feather_esp32s2_reversetft
|
||||
build_flags = -DARDUINO_ADAFRUIT_FEATHER_ESP32S2_REVTFT -DBOARD_HAS_PSRAM
|
||||
;set partition to tinyuf2-partitions-4MB-noota.csv as of CPY 10
|
||||
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
|
||||
board_build.partitions = tinyuf2-partitions-4MB.csv
|
||||
extra_scripts = pre:rename_usb_config.py
|
||||
|
||||
; Adafruit Feather ESP32-S3 2MB PSRAM
|
||||
|
|
@ -232,8 +227,8 @@ extra_scripts = pre:rename_usb_config.py
|
|||
extends = common:esp32
|
||||
board = adafruit_feather_esp32s3
|
||||
build_flags = -DARDUINO_ADAFRUIT_FEATHER_ESP32S3 -DBOARD_HAS_PSRAM
|
||||
;set partition to tinyuf2-partitions-4MB-noota.csv as of CPY 10
|
||||
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
|
||||
;set partition to tinyuf2-partitions-4MB.csv as of idf 5.1
|
||||
board_build.partitions = tinyuf2-partitions-4MB.csv
|
||||
extra_scripts = pre:rename_usb_config.py
|
||||
|
||||
; Adafruit Feather ESP32-S3 NO PSRAM
|
||||
|
|
@ -251,8 +246,8 @@ build_type = debug
|
|||
debug_tool = esp-builtin
|
||||
board = adafruit_feather_esp32s3_tft
|
||||
build_flags = -DARDUINO_ADAFRUIT_FEATHER_ESP32S3_TFT -DBOARD_HAS_PSRAM
|
||||
;set partition to tinyuf2-partitions-4MB-noota.csv as of CPY 10
|
||||
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
|
||||
;set partition to tinyuf2-partitions-4MB.csv as of idf 5.1
|
||||
board_build.partitions = tinyuf2-partitions-4MB.csv
|
||||
extra_scripts = pre:rename_usb_config.py
|
||||
|
||||
; Adafruit Feather ESP32-S3 Reverse TFT
|
||||
|
|
@ -260,8 +255,8 @@ extra_scripts = pre:rename_usb_config.py
|
|||
extends = common:esp32
|
||||
board = adafruit_feather_esp32s3_reversetft
|
||||
build_flags = -DARDUINO_ADAFRUIT_FEATHER_ESP32S3_REVTFT -DBOARD_HAS_PSRAM
|
||||
;set partition to tinyuf2-partitions-4MB-noota.csv as of CPY 10
|
||||
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
|
||||
;set partition to tinyuf2-partitions-4MB.csv as of idf 5.1
|
||||
board_build.partitions = tinyuf2-partitions-4MB.csv
|
||||
extra_scripts = pre:rename_usb_config.py
|
||||
|
||||
; Adafruit Magtag ESP32-S2
|
||||
|
|
@ -269,8 +264,8 @@ extra_scripts = pre:rename_usb_config.py
|
|||
extends = common:esp32
|
||||
board = adafruit_magtag29_esp32s2
|
||||
build_flags = -DARDUINO_MAGTAG29_ESP32S2 -DBOARD_HAS_PSRAM
|
||||
;set partition to tinyuf2-partitions-4MB-noota.csv as of CPY 10
|
||||
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
|
||||
;set partition to tinyuf2-partitions-4MB.csv as of idf 5.1
|
||||
board_build.partitions = tinyuf2-partitions-4MB.csv
|
||||
extra_scripts = pre:rename_usb_config.py
|
||||
|
||||
; Adafruit Metro ESP32-S2
|
||||
|
|
@ -278,12 +273,9 @@ extra_scripts = pre:rename_usb_config.py
|
|||
extends = common:esp32
|
||||
board = adafruit_metro_esp32s2
|
||||
build_flags = -DARDUINO_METRO_ESP32S2 -DBOARD_HAS_PSRAM
|
||||
;set partition to tinyuf2-partitions-4MB-noota.csv as of CPY 10
|
||||
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
|
||||
;set partition to tinyuf2-partitions-4MB.csv as of idf 5.1
|
||||
board_build.partitions = tinyuf2-partitions-4MB.csv
|
||||
extra_scripts = pre:rename_usb_config.py
|
||||
; debug_tool = jlink
|
||||
; upload_protocol = jlink
|
||||
; debug_init_break = tbreak WipperSnapper_I2C_Driver_MLX90632D
|
||||
|
||||
; Adafruit Metro ESP32-S3
|
||||
[env:adafruit_metro_esp32s3]
|
||||
|
|
@ -293,14 +285,13 @@ build_flags = -DARDUINO_METRO_ESP32S3 -DBOARD_HAS_PSRAM
|
|||
;set partition to tinyuf2-partitions-16MB.csv as of idf 5.1
|
||||
board_build.partitions = tinyuf2-partitions-16MB.csv
|
||||
extra_scripts = pre:rename_usb_config.py
|
||||
debug_tool = jlink
|
||||
|
||||
; Adafruit Funhouse ESP32-S2
|
||||
[env:adafruit_funhouse_esp32s2]
|
||||
extends = common:esp32
|
||||
board = adafruit_funhouse_esp32s2
|
||||
build_flags = -DARDUINO_FUNHOUSE -DBOARD_HAS_PSRAM
|
||||
;set partition to tinyuf2-partitions-4MB-noota.csv as of CPY 10
|
||||
;set partition to tinyuf2-partitions-4MB.csv as of idf 5.1
|
||||
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
|
||||
extra_scripts = pre:rename_usb_config.py
|
||||
|
||||
|
|
@ -329,7 +320,7 @@ build_flags =
|
|||
-DLV_LOG_PRINTF=1
|
||||
-DLV_LOG_COLOR=1
|
||||
-DLV_LOG_LEVEL=LV_LOG_LEVEL_TRACE
|
||||
;set partition to tinyuf2-partitions-4MB-noota.csv as of CPY 10
|
||||
;set partition to tinyuf2-partitions-4MB.csv as of idf 5.1
|
||||
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
|
||||
extra_scripts = pre:rename_usb_config.py
|
||||
|
||||
|
|
@ -371,8 +362,8 @@ board_build.partitions = min_spiffs.csv
|
|||
extends = common:esp32
|
||||
board = adafruit_qtpy_esp32s2
|
||||
build_flags = -DARDUINO_ADAFRUIT_QTPY_ESP32S2 -DBOARD_HAS_PSRAM
|
||||
;set partition to tinyuf2-partitions-4MB-noota.csv as of CPY 10
|
||||
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
|
||||
;set partition to tinyuf2-partitions-4MB.csv as of idf 5.1
|
||||
board_build.partitions = tinyuf2-partitions-4MB.csv
|
||||
extra_scripts = pre:rename_usb_config.py
|
||||
|
||||
; Adafruit QT Py ESP32-S3 NO PSRAM
|
||||
|
|
@ -388,14 +379,12 @@ extra_scripts = pre:rename_usb_config.py
|
|||
extends = common:esp32
|
||||
board = adafruit_qtpy_esp32s3_n4r2
|
||||
build_flags = -DARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2 -DBOARD_HAS_PSRAM
|
||||
;set partition to tinyuf2-partitions-4MB-noota.csv as of CPY 10
|
||||
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
|
||||
extra_scripts = pre:rename_usb_config.py
|
||||
|
||||
[env:adafruit_qtpy_esp32s3_with_psram_debug]
|
||||
extends = common:esp32
|
||||
board = adafruit_qtpy_esp32s3_n4r2
|
||||
;set partition to tinyuf2-partitions-4MB-noota.csv as of CPY 10
|
||||
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
|
||||
build_type = debug
|
||||
build_flags =
|
||||
|
|
@ -550,26 +539,22 @@ board = dfrobot_beetle_esp32c3
|
|||
; Note: this board reuses a generic preprocessor define
|
||||
; espressif/arduino-esp32@fcd4799c6de6eb5a5a8eba94818adf770238ecc0
|
||||
; rather than creating one unique to the device.
|
||||
build_flags = -DARDUINO_ESP32C3_DEV
|
||||
build_flags = -DARDUINO_ESP32C3_DEV -DWS_DFROBOT_BEETLE_ESP32C3
|
||||
board_build.filesystem = littlefs
|
||||
board_build.partitions = min_spiffs.csv
|
||||
|
||||
|
||||
[env:raspberypi_picow]
|
||||
extends = common:arduinopico
|
||||
board = rpipicow
|
||||
build_flags =
|
||||
-DUSE_TINYUSB
|
||||
extends = common:rp2040
|
||||
|
||||
[env:raspberypi_picow_debug_port_only]
|
||||
extends = common:arduinopico
|
||||
board = rpipicow
|
||||
extends = common:rp2040
|
||||
build_flags =
|
||||
-DUSE_TINYUSB
|
||||
-DDEBUG_RP2040_PORT=Serial
|
||||
|
||||
[env:raspberypi_picow_debug]
|
||||
extends = common:arduinopico
|
||||
extends = common:rp2040
|
||||
; platform = https://github.com/maxgerhardt/platform-raspberrypi.git
|
||||
; platform_packages =
|
||||
; framework-arduinopico @ symlink:///Users/tyeth/Projects/arduino-pico
|
||||
|
|
@ -611,7 +596,7 @@ build_flags =
|
|||
|
||||
|
||||
[env:raspberypi_pico2w]
|
||||
extends = common:arduinopico
|
||||
extends = common:rp2040
|
||||
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#develop
|
||||
platform_packages =
|
||||
framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
|
||||
|
|
@ -624,7 +609,11 @@ build_flags =
|
|||
; -DPICO_CYW43_SUPPORTED=1
|
||||
|
||||
[env:raspberypi_pico2w_debug]
|
||||
extends = common:arduinopico
|
||||
extends = common:rp2040
|
||||
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#develop
|
||||
platform_packages =
|
||||
framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
|
||||
; ; framework-arduinopico @ symlink:///Users/tyeth/Projects/arduino-pico
|
||||
board = rpipico2w
|
||||
build_type = debug
|
||||
framework = arduino
|
||||
|
|
@ -664,8 +653,3 @@ build_flags =
|
|||
; ; No USB stack
|
||||
; build_flags = -DPIO_FRAMEWORK_ARDUINO_NO_USB
|
||||
; -DPIO_FRAMEWORK_ARDUINO_ENABLE_IPV6
|
||||
|
||||
[env:adafruit_fruitjam]
|
||||
board = adafruit_fruitjam
|
||||
lib_ignore = WiFi, WiFi101, Adafruit Zero DMA Library
|
||||
build_flags = -DUSE_TINYUSB -DADAFRUIT_FRUITJAM_RP2350
|
||||
|
|
@ -176,7 +176,7 @@ void Wippersnapper::_disconnect() {
|
|||
|
||||
/****************************************************************************/
|
||||
/*!
|
||||
@brief Sets the network interface's unique identifier, typically the
|
||||
@brief Sets the network interface's unique identifer, typically the
|
||||
MAC address.
|
||||
*/
|
||||
/****************************************************************************/
|
||||
|
|
@ -256,7 +256,7 @@ bool Wippersnapper::check_valid_ssid() {
|
|||
/*!
|
||||
@brief Configures the device's Adafruit IO credentials. This method
|
||||
should be used only if filesystem-backed provisioning is
|
||||
not available.
|
||||
not avaliable.
|
||||
*/
|
||||
/****************************************************************************/
|
||||
void Wippersnapper::set_user_key() {
|
||||
|
|
@ -493,7 +493,7 @@ bool cbSignalMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) {
|
|||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Decodes a signal buffer protobuf message.
|
||||
NOTE: Should be executed in-order after a new _buffer is received.
|
||||
NOTE: Should be executed in-order after a new _buffer is recieved.
|
||||
@param encodedSignalMsg
|
||||
Encoded signal message.
|
||||
@return true if successfully decoded signal message, false otherwise.
|
||||
|
|
@ -1089,7 +1089,7 @@ bool cbDecodeServoMsg(pb_istream_t *stream, const pb_field_t *field,
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Called when the device receives a new message from the
|
||||
@brief Called when the device recieves a new message from the
|
||||
/servo/ topic.
|
||||
@param data
|
||||
Incoming data from MQTT broker.
|
||||
|
|
@ -1215,7 +1215,7 @@ bool cbPWMDecodeMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) {
|
|||
#endif
|
||||
return false; // fail out if we can't decode the request
|
||||
}
|
||||
// execute PWM pin detach request
|
||||
// execute PWM pin detatch request
|
||||
char *pwmPin = msgPWMDetachRequest.pin + 1;
|
||||
WS._pwmComponent->detach(atoi(pwmPin));
|
||||
|
||||
|
|
@ -1298,7 +1298,7 @@ bool cbPWMDecodeMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) {
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Called when the device receives a new message from the
|
||||
@brief Called when the device recieves a new message from the
|
||||
/pwm/ topic.
|
||||
@param data
|
||||
Incoming data from MQTT broker.
|
||||
|
|
@ -1501,7 +1501,7 @@ bool cbDecodePixelsMsg(pb_istream_t *stream, const pb_field_t *field,
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Called when the device receives a new message from the
|
||||
@brief Called when the device recieves a new message from the
|
||||
/pixels/ topic.
|
||||
@param data
|
||||
Incoming data from MQTT broker.
|
||||
|
|
@ -2736,7 +2736,7 @@ void print_reset_reason(int reason) {
|
|||
break; /**<13, RTC Watch dog Reset CPU*/
|
||||
case 14:
|
||||
WS_DEBUG_PRINTLN("EXT_CPU_RESET");
|
||||
break; /**<14, for APP CPU, reset by PRO CPU*/
|
||||
break; /**<14, for APP CPU, reseted by PRO CPU*/
|
||||
case 15:
|
||||
WS_DEBUG_PRINTLN("RTCWDT_BROWN_OUT_RESET");
|
||||
break; /**<15, Reset when the vdd voltage is not stable*/
|
||||
|
|
@ -2796,7 +2796,7 @@ void Wippersnapper::connect() {
|
|||
haltError("Unable to generate Device UID");
|
||||
}
|
||||
|
||||
// Initialize MQTT client with device identifier
|
||||
// Initialize MQTT client with device identifer
|
||||
setupMQTTClient(_device_uid);
|
||||
|
||||
WS_DEBUG_PRINTLN("Generating device's MQTT topics...");
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@
|
|||
#endif
|
||||
|
||||
#define WS_VERSION \
|
||||
"1.0.0-beta.111" ///< WipperSnapper app. version (semver-formatted)
|
||||
"1.0.0-beta.109" ///< WipperSnapper app. version (semver-formatted)
|
||||
|
||||
// Reserved Adafruit IO MQTT topics
|
||||
#define TOPIC_IO_THROTTLE "/throttle" ///< Adafruit IO Throttle MQTT Topic
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@
|
|||
#define STATUS_NEOPIXEL_PIN PIN_NEOPIXEL
|
||||
#define STATUS_NEOPIXEL_NUM 1
|
||||
#define USE_PSRAM ///< Board has PSRAM, use it for dynamic memory allocation
|
||||
#elif defined(ARDUINO_ESP32C3_DEV)
|
||||
#elif defined(WS_DFROBOT_BEETLE_ESP32C3)
|
||||
// Note: this board reuses a generic preprocessor define
|
||||
// espressif/arduino-esp32@fcd4799c6de6eb5a5a8eba94818adf770238ecc0
|
||||
// rather than creating one unique to the device.
|
||||
|
|
@ -194,6 +194,11 @@
|
|||
#define USE_LITTLEFS
|
||||
#define USE_STATUS_LED
|
||||
#define STATUS_LED_PIN LED_BUILTIN
|
||||
#elif defined(ARDUINO_ESP32C3_DEV)
|
||||
#define BOARD_ID "dfrobot-beetle-esp32c3"
|
||||
#define USE_LITTLEFS
|
||||
#define USE_STATUS_LED
|
||||
#define STATUS_LED_PIN LED_BUILTIN
|
||||
#elif defined(ARDUINO_SPARKLEMOTIONMINI_ESP32)
|
||||
#define BOARD_ID "sparklemotionmini-esp32"
|
||||
#define USE_LITTLEFS
|
||||
|
|
@ -223,12 +228,6 @@
|
|||
#define USE_TINYUSB
|
||||
#define USE_STATUS_LED
|
||||
#define STATUS_LED_PIN LED_BUILTIN
|
||||
#elif defined(ARDUINO_ADAFRUIT_FRUITJAM_RP2350)
|
||||
#define BOARD_ID "fruitjam"
|
||||
#define USE_TINYUSB
|
||||
#define USE_STATUS_NEOPIXEL
|
||||
#define STATUS_NEOPIXEL_PIN PIN_NEOPIXEL
|
||||
#define STATUS_NEOPIXEL_NUM 5
|
||||
#else
|
||||
#warning "Board type not identified within Wippersnapper_Boards.h!"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,8 +23,7 @@
|
|||
|
||||
#if defined(ADAFRUIT_METRO_M4_EXPRESS) || \
|
||||
defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE) || defined(ADAFRUIT_PYPORTAL) || \
|
||||
defined(ADAFRUIT_PYPORTAL_M4_TITANO) || defined(USE_AIRLIFT) || \
|
||||
defined(ADAFRUIT_FRUITJAM_RP2350)
|
||||
defined(ADAFRUIT_PYPORTAL_M4_TITANO) || defined(USE_AIRLIFT)
|
||||
#include "network_interfaces/Wippersnapper_AIRLIFT.h"
|
||||
/** Nina-FW (adafruit fork) networking class */
|
||||
typedef Wippersnapper_AIRLIFT Wippersnapper_WiFi;
|
||||
|
|
|
|||
|
|
@ -181,14 +181,14 @@ WipperSnapper_Component_I2C::scanAddresses() {
|
|||
continue;
|
||||
} else if (endTransmissionRC == 4) {
|
||||
WS_DEBUG_PRINTLN(
|
||||
"[i2c] Did not find device: Unspecified bus error occurred!");
|
||||
"[i2c] Did not find device: Unspecified bus error occured!");
|
||||
continue;
|
||||
} else if (endTransmissionRC == 5) {
|
||||
WS_DEBUG_PRINTLN("[i2c] Did not find device: Bus timed out!");
|
||||
continue;
|
||||
} else {
|
||||
WS_DEBUG_PRINTLN(
|
||||
"[i2c] Did not find device: Unknown bus error has occurred!");
|
||||
"[i2c] Did not find device: Unknown bus error has occured!");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -236,16 +236,6 @@ bool WipperSnapper_Component_I2C::initI2CDevice(
|
|||
}
|
||||
_ahtx0->configureDriver(msgDeviceInitReq);
|
||||
drivers.push_back(_ahtx0);
|
||||
} else if (strcmp("as5600", msgDeviceInitReq->i2c_device_name) == 0) {
|
||||
_as5600 = new WipperSnapper_I2C_Driver_AS5600(this->_i2c, i2cAddress);
|
||||
if (!_as5600->begin()) {
|
||||
WS_DEBUG_PRINTLN("ERROR: Failed to initialize AS5600 chip!");
|
||||
_busStatusResponse =
|
||||
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
|
||||
return false;
|
||||
}
|
||||
_as5600->configureDriver(msgDeviceInitReq);
|
||||
drivers.push_back(_as5600);
|
||||
} else if (strcmp("bh1750", msgDeviceInitReq->i2c_device_name) == 0) {
|
||||
_bh1750 = new WipperSnapper_I2C_Driver_BH1750(this->_i2c, i2cAddress);
|
||||
if (!_bh1750->begin()) {
|
||||
|
|
@ -401,39 +391,6 @@ bool WipperSnapper_Component_I2C::initI2CDevice(
|
|||
_scd30->configureDriver(msgDeviceInitReq);
|
||||
drivers.push_back(_scd30);
|
||||
WS_DEBUG_PRINTLN("SCD30 Initialized Successfully!");
|
||||
} else if (strcmp("ina237", msgDeviceInitReq->i2c_device_name) == 0) {
|
||||
_ina237 = new WipperSnapper_I2C_Driver_INA237(this->_i2c, i2cAddress);
|
||||
if (!_ina237->begin()) {
|
||||
WS_DEBUG_PRINTLN("ERROR: Failed to initialize INA237");
|
||||
_busStatusResponse =
|
||||
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
|
||||
return false;
|
||||
}
|
||||
_ina237->configureDriver(msgDeviceInitReq);
|
||||
drivers.push_back(_ina237);
|
||||
WS_DEBUG_PRINTLN("INA237 Initialized Successfully!");
|
||||
} else if (strcmp("ina238", msgDeviceInitReq->i2c_device_name) == 0) {
|
||||
_ina238 = new WipperSnapper_I2C_Driver_INA238(this->_i2c, i2cAddress);
|
||||
if (!_ina238->begin()) {
|
||||
WS_DEBUG_PRINTLN("ERROR: Failed to initialize INA238");
|
||||
_busStatusResponse =
|
||||
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
|
||||
return false;
|
||||
}
|
||||
_ina238->configureDriver(msgDeviceInitReq);
|
||||
drivers.push_back(_ina238);
|
||||
WS_DEBUG_PRINTLN("INA238 Initialized Successfully!");
|
||||
} else if (strcmp("ina228", msgDeviceInitReq->i2c_device_name) == 0) {
|
||||
_ina228 = new WipperSnapper_I2C_Driver_INA228(this->_i2c, i2cAddress);
|
||||
if (!_ina228->begin()) {
|
||||
WS_DEBUG_PRINTLN("ERROR: Failed to initialize INA228");
|
||||
_busStatusResponse =
|
||||
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
|
||||
return false;
|
||||
}
|
||||
_ina228->configureDriver(msgDeviceInitReq);
|
||||
drivers.push_back(_ina228);
|
||||
WS_DEBUG_PRINTLN("INA228 Initialized Successfully!");
|
||||
} else if (strcmp("ina219", msgDeviceInitReq->i2c_device_name) == 0) {
|
||||
_ina219 = new WipperSnapper_I2C_Driver_INA219(this->_i2c, i2cAddress);
|
||||
if (!_ina219->begin()) {
|
||||
|
|
@ -547,33 +504,6 @@ bool WipperSnapper_Component_I2C::initI2CDevice(
|
|||
_mcp9808->configureDriver(msgDeviceInitReq);
|
||||
drivers.push_back(_mcp9808);
|
||||
WS_DEBUG_PRINTLN("MCP9808 Initialized Successfully!");
|
||||
} else if (strcmp("mlx90632b", msgDeviceInitReq->i2c_device_name) == 0 ||
|
||||
strcmp("mlx90632d_med", msgDeviceInitReq->i2c_device_name) == 0) {
|
||||
_mlx90632d = new WipperSnapper_I2C_Driver_MLX90632D(this->_i2c, i2cAddress);
|
||||
if (!_mlx90632d->begin()) {
|
||||
WS_DEBUG_PRINTLN("ERROR: Failed to initialize MLX90632!");
|
||||
_busStatusResponse =
|
||||
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
|
||||
return false;
|
||||
}
|
||||
_mlx90632d->configureDriver(msgDeviceInitReq);
|
||||
drivers.push_back(_mlx90632d);
|
||||
WS_DEBUG_PRINTLN("MLX90632 Initialized Successfully!");
|
||||
} else if (strcmp("mlx90632d_ext", msgDeviceInitReq->i2c_device_name) == 0) {
|
||||
_mlx90632d_ext =
|
||||
new WipperSnapper_I2C_Driver_MLX90632D(this->_i2c, i2cAddress);
|
||||
// set extended range
|
||||
if (!_mlx90632d_ext->begin() ||
|
||||
!_mlx90632d_ext->ConfigureAndPrintSensorInfo(true)) {
|
||||
WS_DEBUG_PRINTLN(
|
||||
"ERROR: Failed to initialize MLX90632D with extended range!");
|
||||
_busStatusResponse =
|
||||
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
|
||||
return false;
|
||||
}
|
||||
_mlx90632d_ext->configureDriver(msgDeviceInitReq);
|
||||
drivers.push_back(_mlx90632d_ext);
|
||||
WS_DEBUG_PRINTLN("MLX90632D_EXT Initialized Successfully!");
|
||||
} else if (strcmp("mpl115a2", msgDeviceInitReq->i2c_device_name) == 0) {
|
||||
_mpl115a2 = new WipperSnapper_I2C_Driver_MPL115A2(this->_i2c, i2cAddress);
|
||||
if (!_mpl115a2->begin()) {
|
||||
|
|
@ -1344,7 +1274,7 @@ void WipperSnapper_Component_I2C::update() {
|
|||
|
||||
std::vector<WipperSnapper_I2C_Driver *>::iterator iter, end;
|
||||
for (iter = drivers.begin(), end = drivers.end(); iter != end; ++iter) {
|
||||
// Number of events which occurred for this driver
|
||||
// Number of events which occured for this driver
|
||||
msgi2cResponse.payload.resp_i2c_device_event.sensor_event_count = 0;
|
||||
|
||||
// Event struct - zero-initialise on each iteration
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include "drivers/WipperSnapper_I2C_Driver.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_ADT7410.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_AHTX0.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_AS5600.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_BH1750.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_BME280.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_BME680.h"
|
||||
|
|
@ -37,9 +36,6 @@
|
|||
#include "drivers/WipperSnapper_I2C_Driver_HTU21D.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_HTU31D.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_INA219.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_INA228.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_INA237.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_INA238.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_INA260.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_LC709203F.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_LPS22HB.h"
|
||||
|
|
@ -51,7 +47,6 @@
|
|||
#include "drivers/WipperSnapper_I2C_Driver_MAX17048.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_MCP3421.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_MCP9808.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_MLX90632D.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_MPL115A2.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_MPRLS.h"
|
||||
#include "drivers/WipperSnapper_I2C_Driver_MS8607.h"
|
||||
|
|
@ -91,10 +86,6 @@
|
|||
|
||||
// forward decl.
|
||||
class Wippersnapper;
|
||||
class WipperSnapper_I2C_Driver_INA260;
|
||||
class WipperSnapper_I2C_Driver_INA237;
|
||||
class WipperSnapper_I2C_Driver_INA238;
|
||||
class WipperSnapper_I2C_Driver_INA228;
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
|
|
@ -159,7 +150,6 @@ private:
|
|||
_drivers_out; ///< List of i2c output drivers
|
||||
// Sensor driver objects
|
||||
WipperSnapper_I2C_Driver_AHTX0 *_ahtx0 = nullptr;
|
||||
WipperSnapper_I2C_Driver_AS5600 *_as5600 = nullptr;
|
||||
WipperSnapper_I2C_Driver_D6T1A *_d6t1a = nullptr;
|
||||
WipperSnapper_I2C_Driver_DPS310 *_dps310 = nullptr;
|
||||
WipperSnapper_I2C_Driver_DS2484 *_ds2484 = nullptr;
|
||||
|
|
@ -175,16 +165,11 @@ private:
|
|||
WipperSnapper_I2C_Driver_HTU21D *_htu21d = nullptr;
|
||||
WipperSnapper_I2C_Driver_HTU31D *_htu31d = nullptr;
|
||||
WipperSnapper_I2C_Driver_INA219 *_ina219 = nullptr;
|
||||
WipperSnapper_I2C_Driver_INA237 *_ina237 = nullptr;
|
||||
WipperSnapper_I2C_Driver_INA238 *_ina238 = nullptr;
|
||||
WipperSnapper_I2C_Driver_INA228 *_ina228 = nullptr;
|
||||
WipperSnapper_I2C_Driver_INA260 *_ina260 = nullptr;
|
||||
WipperSnapper_I2C_Driver_LTR329_LTR303 *_ltr329 = nullptr;
|
||||
WipperSnapper_I2C_Driver_LTR390 *_ltr390 = nullptr;
|
||||
WipperSnapper_I2C_Driver_MCP3421 *_mcp3421 = nullptr;
|
||||
WipperSnapper_I2C_Driver_MCP9808 *_mcp9808 = nullptr;
|
||||
WipperSnapper_I2C_Driver_MLX90632D *_mlx90632d = nullptr;
|
||||
WipperSnapper_I2C_Driver_MLX90632D *_mlx90632d_ext = nullptr;
|
||||
WipperSnapper_I2C_Driver_MPL115A2 *_mpl115a2 = nullptr;
|
||||
WipperSnapper_I2C_Driver_MPRLS *_mprls = nullptr;
|
||||
WipperSnapper_I2C_Driver_MS8607 *_ms8607 = nullptr;
|
||||
|
|
|
|||
|
|
@ -16,10 +16,8 @@
|
|||
#ifndef WipperSnapper_I2C_Driver_H
|
||||
#define WipperSnapper_I2C_Driver_H
|
||||
|
||||
#include "wippersnapper/i2c/v1/i2c.pb.h"
|
||||
#include <Adafruit_Sensor.h>
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
|
||||
#define PERIOD_24HRS_AGO_MILLIS (millis() - (24 * 60 * 60 * 1000))
|
||||
///< Used for last sensor read time, initially set 24hrs ago (max period)
|
||||
|
|
|
|||
|
|
@ -1,155 +0,0 @@
|
|||
/*!
|
||||
* @file WipperSnapper_I2C_Driver_AS5600.h
|
||||
*
|
||||
* Device driver for the AS5600 Magnetic Angle sensor.
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Copyright (c) Tyeth Gundry 2024 for Adafruit Industries.
|
||||
*
|
||||
* MIT license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
#ifndef WipperSnapper_I2C_Driver_AS5600_H
|
||||
#define WipperSnapper_I2C_Driver_AS5600_H
|
||||
|
||||
#include <Adafruit_AS5600.h>
|
||||
|
||||
#include "WipperSnapper_I2C_Driver.h"
|
||||
#include "Wippersnapper.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Class that provides a driver interface for a AS5600 sensor.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
class WipperSnapper_I2C_Driver_AS5600 : public WipperSnapper_I2C_Driver {
|
||||
public:
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Constructor for the AS5600 sensor.
|
||||
@param i2c
|
||||
The I2C interface.
|
||||
@param sensorAddress
|
||||
7-bit device address.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
WipperSnapper_I2C_Driver_AS5600(TwoWire *i2c, uint16_t sensorAddress)
|
||||
: WipperSnapper_I2C_Driver(i2c, sensorAddress) {
|
||||
_as5600 = nullptr;
|
||||
_angle = 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Destructor for an AS5600 sensor.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
~WipperSnapper_I2C_Driver_AS5600() {
|
||||
if (_as5600) {
|
||||
delete _as5600;
|
||||
_as5600 = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Initializes the AS5600 sensor and begins I2C.
|
||||
@returns True if initialized successfully, False otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool begin() {
|
||||
_as5600 = new Adafruit_AS5600();
|
||||
if (!_as5600->begin((uint8_t)_sensorAddress, _i2c)) {
|
||||
WS_DEBUG_PRINTLN("Failed to find AS5600 chip");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!configureSensor()) {
|
||||
WS_DEBUG_PRINTLN("Failed to configure AS5600 sensor");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Configures the AS5600 sensor.
|
||||
@returns True if the sensor was configured successfully, False otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool configureSensor() {
|
||||
return _as5600->enableWatchdog(false) &&
|
||||
// Normal (high) power mode
|
||||
_as5600->setPowerMode(AS5600_POWER_MODE_NOM) &&
|
||||
// No Hysteresis
|
||||
_as5600->setHysteresis(AS5600_HYSTERESIS_OFF) &&
|
||||
// analog output (0-VCC for 0-360 degrees)
|
||||
_as5600->setOutputStage(AS5600_OUTPUT_STAGE_ANALOG_FULL) &&
|
||||
// setup filters
|
||||
_as5600->setSlowFilter(AS5600_SLOW_FILTER_16X) &&
|
||||
_as5600->setFastFilterThresh(AS5600_FAST_FILTER_THRESH_SLOW_ONLY) &&
|
||||
// Reset position settings to defaults
|
||||
_as5600->setZPosition(0) && _as5600->setMPosition(4095) &&
|
||||
_as5600->setMaxAngle(4095);
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Reads the Angle sensor.
|
||||
@returns True if the sensor was read successfully, False otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool readSensor() {
|
||||
if (!_as5600->isMagnetDetected()) {
|
||||
WS_DEBUG_PRINTLN("Magnet not detected!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Continuously read and display angle values
|
||||
uint16_t rawAngle = _as5600->getRawAngle();
|
||||
uint16_t angle = _as5600->getAngle();
|
||||
|
||||
WS_DEBUG_PRINT("AS5600 Raw: ");
|
||||
WS_DEBUG_PRINT(rawAngle);
|
||||
WS_DEBUG_PRINT(" | Scaled: ");
|
||||
WS_DEBUG_PRINT(angle);
|
||||
|
||||
// Check status conditions
|
||||
if (_as5600->isAGCminGainOverflow()) {
|
||||
WS_DEBUG_PRINTLN(" | MH: magnet too strong");
|
||||
return false;
|
||||
}
|
||||
if (_as5600->isAGCmaxGainOverflow()) {
|
||||
WS_DEBUG_PRINTLN(" | ML: magnet too weak");
|
||||
return false;
|
||||
}
|
||||
_angle = ((float)angle / 4095.0) * 360.0;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Reads the Angle sensor with short wait for data.
|
||||
@param rawEvent
|
||||
Angle sensor reading
|
||||
@returns True if the sensor event was obtained successfully, False
|
||||
otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool getEventRaw(sensors_event_t *rawEvent) {
|
||||
if (!readSensor()) {
|
||||
return false;
|
||||
}
|
||||
rawEvent->data[0] = _angle;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
float _angle; ///< Current angle reading from the AS5600 sensor
|
||||
Adafruit_AS5600 *_as5600; ///< Pointer to AS5600 sensor object
|
||||
};
|
||||
|
||||
#endif // WipperSnapper_I2C_Driver_AS5600
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
/*!
|
||||
* @file WipperSnapper_I2C_Driver_INA228.cpp
|
||||
*
|
||||
* Device driver implementation for the INA228 High Precision DC Current and
|
||||
* Voltage Monitor (Avoids import conflict with INA260 typedef enum _mode etc)
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Copyright (c) Tyeth Gundry 2025 for Adafruit Industries.
|
||||
*
|
||||
* MIT license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "WipperSnapper_I2C_Driver_INA228.h"
|
||||
#include "Wippersnapper.h"
|
||||
#include <Adafruit_INA228.h>
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Constructor for a INA228 sensor.
|
||||
@param i2c
|
||||
The I2C interface.
|
||||
@param sensorAddress
|
||||
The 7-bit I2C address of the sensor.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
WipperSnapper_I2C_Driver_INA228::WipperSnapper_I2C_Driver_INA228(
|
||||
TwoWire *i2c, uint16_t sensorAddress)
|
||||
: WipperSnapper_I2C_Driver(i2c, sensorAddress), _ina228(nullptr) {
|
||||
_i2c = i2c;
|
||||
_sensorAddress = sensorAddress;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Destructor for an INA228 sensor.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
WipperSnapper_I2C_Driver_INA228::~WipperSnapper_I2C_Driver_INA228() {
|
||||
delete _ina228;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Initializes the INA228 sensor and begins I2C.
|
||||
@returns True if initialized successfully, False otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool WipperSnapper_I2C_Driver_INA228::begin() {
|
||||
_ina228 = new Adafruit_INA228();
|
||||
if (!_ina228->begin(_sensorAddress, _i2c)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Default shunt: 0.015 ohm, 10A max current
|
||||
_ina228->setShunt(0.015, 10.0);
|
||||
|
||||
_ina228->setAveragingCount(INA228_COUNT_16);
|
||||
_ina228->setVoltageConversionTime(INA228_TIME_150_us);
|
||||
_ina228->setCurrentConversionTime(INA228_TIME_280_us);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Reads a voltage sensor and converts the
|
||||
reading into the expected SI unit.
|
||||
@param voltageEvent
|
||||
voltage sensor reading, in volts.
|
||||
@returns True if the sensor event was obtained successfully, False
|
||||
otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool WipperSnapper_I2C_Driver_INA228::getEventVoltage(
|
||||
sensors_event_t *voltageEvent) {
|
||||
voltageEvent->voltage = _ina228->getBusVoltage_V();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current sensor event.
|
||||
*
|
||||
* @param currentEvent Pointer to the current sensor event.
|
||||
*
|
||||
* @returns True if the sensor event was obtained successfully, False
|
||||
* otherwise.
|
||||
*/
|
||||
bool WipperSnapper_I2C_Driver_INA228::getEventCurrent(
|
||||
sensors_event_t *currentEvent) {
|
||||
currentEvent->current = _ina228->getCurrent_mA();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the raw (power) sensor event.
|
||||
*
|
||||
* @param powerEvent Pointer to the power sensor event.
|
||||
*
|
||||
* @returns True if the sensor event was obtained successfully, False
|
||||
* otherwise.
|
||||
*/
|
||||
bool WipperSnapper_I2C_Driver_INA228::getEventRaw(sensors_event_t *powerEvent) {
|
||||
powerEvent->data[0] = _ina228->getPower_mW();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/*!
|
||||
* @file WipperSnapper_I2C_Driver_INA228.h
|
||||
*
|
||||
* Device driver for the INA228 High Precision DC Current and Voltage Monitor
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Copyright (c) Tyeth Gundry 2025 for Adafruit Industries.
|
||||
*
|
||||
* MIT license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
#ifndef WipperSnapper_I2C_Driver_INA228_H
|
||||
#define WipperSnapper_I2C_Driver_INA228_H
|
||||
|
||||
#include "WipperSnapper_I2C_Driver.h"
|
||||
#include "Wippersnapper.h"
|
||||
|
||||
// Forward declaration
|
||||
class Adafruit_INA228;
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Class that provides a driver interface for a INA228 sensor.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
class WipperSnapper_I2C_Driver_INA228 : public WipperSnapper_I2C_Driver {
|
||||
public:
|
||||
WipperSnapper_I2C_Driver_INA228(TwoWire *i2c, uint16_t sensorAddress);
|
||||
~WipperSnapper_I2C_Driver_INA228();
|
||||
|
||||
bool begin();
|
||||
bool getEventVoltage(sensors_event_t *voltageEvent);
|
||||
bool getEventCurrent(sensors_event_t *currentEvent);
|
||||
bool getEventRaw(sensors_event_t *powerEvent);
|
||||
|
||||
protected:
|
||||
Adafruit_INA228 *_ina228; ///< Pointer to INA228 sensor object
|
||||
};
|
||||
|
||||
#endif // WipperSnapper_I2C_Driver_INA228_H
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
/*!
|
||||
* @file WipperSnapper_I2C_Driver_INA237.cpp
|
||||
*
|
||||
* Device driver implementation for the INA237 DC Current and Voltage Monitor
|
||||
* (Avoids import conflict with INA260 typedef enum _mode etc)
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Copyright (c) Tyeth Gundry 2025 for Adafruit Industries.
|
||||
*
|
||||
* MIT license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "WipperSnapper_I2C_Driver_INA237.h"
|
||||
#include "Wippersnapper.h"
|
||||
#include <Adafruit_INA237.h>
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Constructor for a INA237 sensor.
|
||||
@param i2c
|
||||
The I2C interface.
|
||||
@param sensorAddress
|
||||
The 7-bit I2C address of the sensor.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
WipperSnapper_I2C_Driver_INA237::WipperSnapper_I2C_Driver_INA237(
|
||||
TwoWire *i2c, uint16_t sensorAddress)
|
||||
: WipperSnapper_I2C_Driver(i2c, sensorAddress), _ina237(nullptr) {
|
||||
_i2c = i2c;
|
||||
_sensorAddress = sensorAddress;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Destructor for an INA237 sensor.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
WipperSnapper_I2C_Driver_INA237::~WipperSnapper_I2C_Driver_INA237() {
|
||||
delete _ina237;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Initializes the INA237 sensor and begins I2C.
|
||||
@returns True if initialized successfully, False otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool WipperSnapper_I2C_Driver_INA237::begin() {
|
||||
_ina237 = new Adafruit_INA237();
|
||||
if (!_ina237->begin(_sensorAddress, _i2c)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Configuration based on INA237 example sketch
|
||||
// Set default shunt resistance and maximum current
|
||||
// Default 0.015 ohm shunt, 10A max current
|
||||
_ina237->setShunt(0.015, 10.0);
|
||||
|
||||
// Set averaging for better accuracy (16 samples)
|
||||
_ina237->setAveragingCount(INA2XX_COUNT_16);
|
||||
|
||||
// Set conversion times as per example
|
||||
_ina237->setVoltageConversionTime(INA2XX_TIME_150_us);
|
||||
_ina237->setCurrentConversionTime(INA2XX_TIME_280_us);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Reads a voltage sensor and converts the
|
||||
reading into the expected SI unit.
|
||||
@param voltageEvent
|
||||
voltage sensor reading, in volts.
|
||||
@returns True if the sensor event was obtained successfully, False
|
||||
otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool WipperSnapper_I2C_Driver_INA237::getEventVoltage(
|
||||
sensors_event_t *voltageEvent) {
|
||||
voltageEvent->voltage = _ina237->getBusVoltage_V();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current sensor event.
|
||||
*
|
||||
* @param currentEvent Pointer to the current sensor event.
|
||||
*
|
||||
* @returns True if the sensor event was obtained successfully, False
|
||||
* otherwise.
|
||||
*/
|
||||
bool WipperSnapper_I2C_Driver_INA237::getEventCurrent(
|
||||
sensors_event_t *currentEvent) {
|
||||
currentEvent->current = _ina237->getCurrent_mA();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the raw (power) sensor event.
|
||||
*
|
||||
* @param powerEvent Pointer to the power sensor event.
|
||||
*
|
||||
* @returns True if the sensor event was obtained successfully, False
|
||||
* otherwise.
|
||||
*/
|
||||
bool WipperSnapper_I2C_Driver_INA237::getEventRaw(sensors_event_t *powerEvent) {
|
||||
powerEvent->data[0] = _ina237->getPower_mW();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/*!
|
||||
* @file WipperSnapper_I2C_Driver_INA237.h
|
||||
*
|
||||
* Device driver for the INA237 DC Current and Voltage Monitor
|
||||
* 16-bit ADC with ±0.3% gain error, ±50µV offset voltage
|
||||
* Cost-effective version, lower precision than INA238
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Copyright (c) Tyeth Gundry 2025 for Adafruit Industries.
|
||||
*
|
||||
* MIT license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
#ifndef WipperSnapper_I2C_Driver_INA237_H
|
||||
#define WipperSnapper_I2C_Driver_INA237_H
|
||||
|
||||
#include "WipperSnapper_I2C_Driver.h"
|
||||
#include "Wippersnapper.h"
|
||||
|
||||
// Forward declaration
|
||||
class Adafruit_INA237;
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Class that provides a driver interface for a INA237 sensor.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
class WipperSnapper_I2C_Driver_INA237 : public WipperSnapper_I2C_Driver {
|
||||
public:
|
||||
WipperSnapper_I2C_Driver_INA237(TwoWire *i2c, uint16_t sensorAddress);
|
||||
~WipperSnapper_I2C_Driver_INA237();
|
||||
|
||||
bool begin();
|
||||
bool getEventVoltage(sensors_event_t *voltageEvent);
|
||||
bool getEventCurrent(sensors_event_t *currentEvent);
|
||||
bool getEventRaw(sensors_event_t *powerEvent);
|
||||
|
||||
protected:
|
||||
Adafruit_INA237 *_ina237; ///< Pointer to INA237 sensor object
|
||||
};
|
||||
|
||||
#endif // WipperSnapper_I2C_Driver_INA237
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
/*!
|
||||
* @file WipperSnapper_I2C_Driver_INA238.cpp
|
||||
*
|
||||
* Device driver implementation for the INA238 High-precision DC Current and
|
||||
* Voltage Monitor (Avoids import conflict with INA260 typedef enum _mode etc)
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Copyright (c) Tyeth Gundry 2025 for Adafruit Industries.
|
||||
*
|
||||
* MIT license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "WipperSnapper_I2C_Driver_INA238.h"
|
||||
#include "Wippersnapper.h"
|
||||
#include <Adafruit_INA238.h>
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Constructor for a INA238 sensor.
|
||||
@param i2c
|
||||
The I2C interface.
|
||||
@param sensorAddress
|
||||
The 7-bit I2C address of the sensor.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
WipperSnapper_I2C_Driver_INA238::WipperSnapper_I2C_Driver_INA238(
|
||||
TwoWire *i2c, uint16_t sensorAddress)
|
||||
: WipperSnapper_I2C_Driver(i2c, sensorAddress), _ina238(nullptr) {
|
||||
_i2c = i2c;
|
||||
_sensorAddress = sensorAddress;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Destructor for an INA238 sensor.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
WipperSnapper_I2C_Driver_INA238::~WipperSnapper_I2C_Driver_INA238() {
|
||||
delete _ina238;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Initializes the INA238 sensor and begins I2C.
|
||||
@returns True if initialized successfully, False otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool WipperSnapper_I2C_Driver_INA238::begin() {
|
||||
_ina238 = new Adafruit_INA238();
|
||||
if (!_ina238->begin(_sensorAddress, _i2c)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Configuration based on INA238 example sketch
|
||||
// Set default shunt resistance and maximum current
|
||||
// Default 0.015 ohm shunt, 10A max current
|
||||
_ina238->setShunt(0.015, 10.0);
|
||||
|
||||
// Set averaging for better accuracy (16 samples)
|
||||
_ina238->setAveragingCount(INA2XX_COUNT_16);
|
||||
|
||||
// Set conversion times as per example
|
||||
_ina238->setVoltageConversionTime(INA2XX_TIME_150_us);
|
||||
_ina238->setCurrentConversionTime(INA2XX_TIME_280_us);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Reads a voltage sensor and converts the
|
||||
reading into the expected SI unit.
|
||||
@param voltageEvent
|
||||
voltage sensor reading, in volts.
|
||||
@returns True if the sensor event was obtained successfully, False
|
||||
otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool WipperSnapper_I2C_Driver_INA238::getEventVoltage(
|
||||
sensors_event_t *voltageEvent) {
|
||||
voltageEvent->voltage = _ina238->getBusVoltage_V();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current sensor event.
|
||||
*
|
||||
* @param currentEvent Pointer to the current sensor event.
|
||||
*
|
||||
* @returns True if the sensor event was obtained successfully, False
|
||||
* otherwise.
|
||||
*/
|
||||
bool WipperSnapper_I2C_Driver_INA238::getEventCurrent(
|
||||
sensors_event_t *currentEvent) {
|
||||
currentEvent->current = _ina238->getCurrent_mA();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the Raw (power) sensor event.
|
||||
*
|
||||
* @param powerEvent Pointer to the power sensor event.
|
||||
*
|
||||
* @returns True if the sensor event was obtained successfully, False
|
||||
* otherwise.
|
||||
*/
|
||||
bool WipperSnapper_I2C_Driver_INA238::getEventRaw(sensors_event_t *powerEvent) {
|
||||
powerEvent->data[0] = _ina238->getPower_mW();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
/*!
|
||||
* @file WipperSnapper_I2C_Driver_INA238.h
|
||||
*
|
||||
* Device driver for the INA238 High-precision DC Current and Voltage Monitor
|
||||
* 16-bit ADC with ±0.1% gain error, ±5µV offset voltage
|
||||
* Higher precision version compared to INA237
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Copyright (c) Tyeth Gundry 2025 for Adafruit Industries.
|
||||
*
|
||||
* MIT license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
#ifndef WipperSnapper_I2C_Driver_INA238_H
|
||||
#define WipperSnapper_I2C_Driver_INA238_H
|
||||
|
||||
#include "WipperSnapper_I2C_Driver.h"
|
||||
|
||||
// Forward declaration
|
||||
class Adafruit_INA238;
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Class that provides a driver interface for a INA238 sensor.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
class WipperSnapper_I2C_Driver_INA238 : public WipperSnapper_I2C_Driver {
|
||||
public:
|
||||
WipperSnapper_I2C_Driver_INA238(TwoWire *i2c, uint16_t sensorAddress);
|
||||
~WipperSnapper_I2C_Driver_INA238();
|
||||
|
||||
bool begin();
|
||||
bool getEventVoltage(sensors_event_t *voltageEvent);
|
||||
bool getEventCurrent(sensors_event_t *currentEvent);
|
||||
bool getEventRaw(sensors_event_t *powerEvent);
|
||||
|
||||
protected:
|
||||
Adafruit_INA238 *_ina238; ///< Pointer to INA238 sensor object
|
||||
};
|
||||
|
||||
#endif // WipperSnapper_I2C_Driver_INA238
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
/*!
|
||||
* @file WipperSnapper_I2C_Driver_INA260.cpp
|
||||
*
|
||||
* Device driver implementation for the INA260 DC Current and Voltage Monitor
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Copyright (c) Tyeth Gundry 2025 for Adafruit Industries.
|
||||
*
|
||||
* MIT license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "WipperSnapper_I2C_Driver_INA260.h"
|
||||
#include "Wippersnapper.h"
|
||||
#include <Adafruit_INA260.h>
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Constructor for a INA260 sensor.
|
||||
@param i2c
|
||||
The I2C interface.
|
||||
@param sensorAddress
|
||||
The 7-bit I2C address of the sensor.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
WipperSnapper_I2C_Driver_INA260::WipperSnapper_I2C_Driver_INA260(
|
||||
TwoWire *i2c, uint16_t sensorAddress)
|
||||
: WipperSnapper_I2C_Driver(i2c, sensorAddress), _ina260(nullptr) {
|
||||
_i2c = i2c;
|
||||
_sensorAddress = sensorAddress;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Destructor for an INA260 sensor.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
WipperSnapper_I2C_Driver_INA260::~WipperSnapper_I2C_Driver_INA260() {
|
||||
delete _ina260;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Initializes the INA260 sensor and begins I2C.
|
||||
@returns True if initialized successfully, False otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool WipperSnapper_I2C_Driver_INA260::begin() {
|
||||
_ina260 = new Adafruit_INA260();
|
||||
if (!_ina260->begin(_sensorAddress, _i2c)) {
|
||||
return false;
|
||||
}
|
||||
// TODO: use setCalibration()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Reads a voltage sensor and converts the
|
||||
reading into the expected SI unit.
|
||||
@param voltageEvent
|
||||
voltage sensor reading, in volts.
|
||||
@returns True if the sensor event was obtained successfully, False
|
||||
otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool WipperSnapper_I2C_Driver_INA260::getEventVoltage(
|
||||
sensors_event_t *voltageEvent) {
|
||||
voltageEvent->voltage = _ina260->readBusVoltage() / 1000.0f;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current sensor event.
|
||||
*
|
||||
* @param currentEvent Pointer to the current sensor event.
|
||||
*
|
||||
* @returns True if the sensor event was obtained successfully, False
|
||||
* otherwise.
|
||||
*/
|
||||
bool WipperSnapper_I2C_Driver_INA260::getEventCurrent(
|
||||
sensors_event_t *currentEvent) {
|
||||
currentEvent->current = _ina260->readCurrent();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -16,9 +16,7 @@
|
|||
#define WipperSnapper_I2C_Driver_INA260_H
|
||||
|
||||
#include "WipperSnapper_I2C_Driver.h"
|
||||
|
||||
// Forward declaration
|
||||
class Adafruit_INA260;
|
||||
#include <Adafruit_INA260.h>
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
|
|
@ -27,15 +25,75 @@ class Adafruit_INA260;
|
|||
/**************************************************************************/
|
||||
class WipperSnapper_I2C_Driver_INA260 : public WipperSnapper_I2C_Driver {
|
||||
public:
|
||||
WipperSnapper_I2C_Driver_INA260(TwoWire *i2c, uint16_t sensorAddress);
|
||||
~WipperSnapper_I2C_Driver_INA260();
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Constructor for a INA260 sensor.
|
||||
@param i2c
|
||||
The I2C interface.
|
||||
@param sensorAddress
|
||||
The 7-bit I2C address of the sensor.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
WipperSnapper_I2C_Driver_INA260(TwoWire *i2c, uint16_t sensorAddress)
|
||||
: WipperSnapper_I2C_Driver(i2c, sensorAddress) {
|
||||
_i2c = i2c;
|
||||
_sensorAddress = sensorAddress;
|
||||
}
|
||||
|
||||
bool begin();
|
||||
bool getEventVoltage(sensors_event_t *voltageEvent);
|
||||
bool getEventCurrent(sensors_event_t *currentEvent);
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Destructor for an INA260 sensor.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
~WipperSnapper_I2C_Driver_INA260() { delete _ina260; }
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Initializes the INA260 sensor and begins I2C.
|
||||
@returns True if initialized successfully, False otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool begin() {
|
||||
_ina260 = new Adafruit_INA260();
|
||||
if (!_ina260->begin(_sensorAddress, _i2c)) {
|
||||
WS_DEBUG_PRINTLN("INA260 failed to initialise!");
|
||||
return false;
|
||||
}
|
||||
// TODO: use setCalibration()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Reads a voltage sensor and converts the
|
||||
reading into the expected SI unit.
|
||||
@param voltageEvent
|
||||
voltage sensor reading, in volts.
|
||||
@returns True if the sensor event was obtained successfully, False
|
||||
otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool getEventVoltage(sensors_event_t *voltageEvent) {
|
||||
voltageEvent->voltage = _ina260->readBusVoltage();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current sensor event.
|
||||
*
|
||||
* @param currentEvent Pointer to the current sensor event.
|
||||
*
|
||||
* @returns True if the sensor event was obtained successfully, False
|
||||
* otherwise.
|
||||
*/
|
||||
bool getEventCurrent(sensors_event_t *currentEvent) {
|
||||
currentEvent->current = _ina260->readCurrent();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
Adafruit_INA260 *_ina260 = nullptr; ///< Pointer to INA260 sensor object
|
||||
Adafruit_INA260 *_ina260; ///< Pointer to INA260 sensor object
|
||||
};
|
||||
|
||||
#endif // WipperSnapper_I2C_Driver_INA260
|
||||
|
|
@ -1,233 +0,0 @@
|
|||
/*!
|
||||
* @file WipperSnapper_I2C_Driver_MLX90632D.h
|
||||
*
|
||||
* Device driver for a Melexis MLX90632-D (medical) thermal FIR sensor.
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Copyright (c) Tyeth Gundry 2025 for Adafruit Industries.
|
||||
*
|
||||
* MIT license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef WipperSnapper_I2C_Driver_MLX90632D_H
|
||||
#define WipperSnapper_I2C_Driver_MLX90632D_H
|
||||
|
||||
#include <Adafruit_MLX90632.h>
|
||||
|
||||
#include "WipperSnapper_I2C_Driver.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Sensor driver for the Melexis MLX90632-D temperature sensor.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
class WipperSnapper_I2C_Driver_MLX90632D : public WipperSnapper_I2C_Driver {
|
||||
public:
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Constructor for an MLX90632 sensor.
|
||||
@param i2c
|
||||
The I2C interface.
|
||||
@param sensorAddress
|
||||
7-bit device address.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
WipperSnapper_I2C_Driver_MLX90632D(TwoWire *i2c, uint16_t sensorAddress)
|
||||
: WipperSnapper_I2C_Driver(i2c, sensorAddress) {
|
||||
_i2c = i2c;
|
||||
_sensorAddress = sensorAddress;
|
||||
_mlx90632 = nullptr;
|
||||
_deviceTemp = NAN;
|
||||
_objectTemp = NAN;
|
||||
_lastRead = 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Destructor for an MLX90632 sensor.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
~WipperSnapper_I2C_Driver_MLX90632D() {
|
||||
if (_mlx90632) {
|
||||
delete _mlx90632;
|
||||
_mlx90632 = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Initializes the MLX90632 sensor and begins I2C.
|
||||
@returns True if initialized successfully, False otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool begin() {
|
||||
if (_mlx90632) {
|
||||
delete _mlx90632;
|
||||
_mlx90632 = nullptr;
|
||||
}
|
||||
_mlx90632 = new Adafruit_MLX90632();
|
||||
// attempt to initialize MLX90632
|
||||
if (!_mlx90632->begin(_sensorAddress, _i2c))
|
||||
return false;
|
||||
|
||||
return ConfigureAndPrintSensorInfo();
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Configures the MLX90632 sensor and prints its information.
|
||||
@param extendedInsteadOfMedicalRange
|
||||
If true, configures the sensor for extended temperature
|
||||
range/acc.
|
||||
@returns True if configuration fetching and setting were successful.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool ConfigureAndPrintSensorInfo(bool extendedInsteadOfMedicalRange = false) {
|
||||
// Reset the device
|
||||
if (!_mlx90632->reset()) {
|
||||
WS_DEBUG_PRINTLN(F("Device reset failed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t productCode = _mlx90632->getProductCode();
|
||||
// Decode product code bits
|
||||
uint8_t fov = (productCode >> 8) & 0x3;
|
||||
uint8_t package = (productCode >> 5) & 0x7;
|
||||
uint8_t accuracy = productCode & 0x1F;
|
||||
|
||||
if (!_mlx90632->setMode(MLX90632_MODE_CONTINUOUS)) {
|
||||
WS_DEBUG_PRINTLN(F("Failed to set mode"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// set accuracy mode based on medical if detected
|
||||
if (accuracy == 1) {
|
||||
// Set and get measurement select (medical)
|
||||
if (!extendedInsteadOfMedicalRange &&
|
||||
!_mlx90632->setMeasurementSelect(MLX90632_MEAS_MEDICAL)) {
|
||||
WS_DEBUG_PRINTLN(F("Failed to set measurement select to Medical"));
|
||||
return false;
|
||||
} else if (extendedInsteadOfMedicalRange &&
|
||||
!_mlx90632->setMeasurementSelect(
|
||||
MLX90632_MEAS_EXTENDED_RANGE)) {
|
||||
WS_DEBUG_PRINTLN(
|
||||
F("Failed to set measurement select to Extended Range"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Set and get refresh rate (default to 2Hz)
|
||||
if (!_mlx90632->setRefreshRate(MLX90632_REFRESH_2HZ)) {
|
||||
WS_DEBUG_PRINTLN(F("Failed to set refresh rate to 2Hz"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_mlx90632->resetNewData()) {
|
||||
WS_DEBUG_PRINTLN(F("Failed to reset new data flag"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Checks if sensor was read within last 1s, or is the first read.
|
||||
@returns True if the sensor was recently read, False otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool HasBeenReadInLast200ms() {
|
||||
return _lastRead != 0 && millis() - _lastRead < 200;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Reads the sensor.
|
||||
@returns True if the sensor was read successfully, False otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool ReadSensorData() {
|
||||
bool result = false;
|
||||
if (HasBeenReadInLast200ms()) {
|
||||
WS_DEBUG_PRINTLN(F("Sensor was read recently, using cached data"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if we need to trigger a new measurement for step modes
|
||||
mlx90632_mode_t currentMode = _mlx90632->getMode();
|
||||
if (currentMode == MLX90632_MODE_STEP ||
|
||||
currentMode == MLX90632_MODE_SLEEPING_STEP) {
|
||||
// Trigger single measurement (SOC bit) for step modes
|
||||
if (!_mlx90632->startSingleMeasurement()) {
|
||||
WS_DEBUG_PRINTLN(F("Failed to start single measurement"));
|
||||
return false;
|
||||
}
|
||||
delay(510); // Wait for measurement to complete @ 2Hz
|
||||
}
|
||||
|
||||
// Only check new data flag - much more efficient for continuous mode
|
||||
if (_mlx90632->isNewData()) {
|
||||
_deviceTemp = _mlx90632->getAmbientTemperature();
|
||||
_objectTemp = _mlx90632->getObjectTemperature();
|
||||
if (isnan(_objectTemp)) {
|
||||
WS_DEBUG_PRINTLN(F("NaN (invalid cycle position)"));
|
||||
return false;
|
||||
}
|
||||
result = true;
|
||||
_lastRead = millis();
|
||||
// Reset new data flag after reading
|
||||
if (!_mlx90632->resetNewData()) {
|
||||
WS_DEBUG_PRINTLN(F("Failed to reset new data flag"));
|
||||
}
|
||||
} else {
|
||||
WS_DEBUG_PRINTLN(F("No new data available, skipping read"));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Gets the MLX90632's current temperature.
|
||||
@param tempEvent
|
||||
Pointer to an Adafruit_Sensor event.
|
||||
@returns True if the temperature was obtained successfully, False
|
||||
otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool getEventAmbientTemp(sensors_event_t *tempEvent) {
|
||||
if (ReadSensorData() && _deviceTemp != NAN) {
|
||||
tempEvent->temperature = _deviceTemp;
|
||||
return true;
|
||||
}
|
||||
return false; // sensor not read recently, return false
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
@brief Gets the MLX90632's object temperature.
|
||||
@param tempEvent
|
||||
Pointer to an Adafruit_Sensor event.
|
||||
@returns True if the temperature was obtained successfully, False
|
||||
otherwise.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
bool getEventObjectTemp(sensors_event_t *tempEvent) {
|
||||
if (ReadSensorData() && _objectTemp != NAN) {
|
||||
tempEvent->temperature = _objectTemp;
|
||||
return true;
|
||||
}
|
||||
return false; // sensor not read recently, return false
|
||||
}
|
||||
|
||||
protected:
|
||||
double _deviceTemp; ///< Device temperature in Celsius
|
||||
double _objectTemp; ///< Object temperature in Celsius
|
||||
uint32_t _lastRead; ///< Last time the sensor was read in milliseconds
|
||||
Adafruit_MLX90632 *_mlx90632 = nullptr; ///< MLX90632 object
|
||||
};
|
||||
|
||||
#endif // WipperSnapper_I2C_Driver_MLX90632D_H
|
||||
|
|
@ -55,7 +55,7 @@ bool Wippersnapper::encodePubRegistrationReq() {
|
|||
if (!_status)
|
||||
return _status;
|
||||
|
||||
// publish message
|
||||
// pubish message
|
||||
WS.publish(WS._topic_description, _message_buffer, _message_len, 1);
|
||||
WS_DEBUG_PRINTLN("Published!");
|
||||
WS._boardStatus = WS_BOARD_DEF_SENT;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ bool ws_servo::servo_attach(int pin, int minPulseWidth, int maxPulseWidth,
|
|||
#ifdef ARDUINO_ARCH_ESP32
|
||||
rc = servo->attach(pin, minPulseWidth, maxPulseWidth, freq);
|
||||
#else
|
||||
(void)freq; // suppress warning when we don't use the frequency parameter
|
||||
(void)freq; // supress warning when we don't use the frequency parameter
|
||||
rc = servo->attach(pin, minPulseWidth, maxPulseWidth);
|
||||
#endif
|
||||
if (rc == ERR_SERVO_ATTACH)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Copyright (c) Brent Rubell 2020-2025 for Adafruit Industries.
|
||||
* Copyright (c) Brent Rubell 2020-2021 for Adafruit Industries.
|
||||
*
|
||||
* MIT license, all text here must be included in any redistribution.
|
||||
*
|
||||
|
|
@ -32,9 +32,7 @@
|
|||
#define AIRLIFT_CONNECT_TIMEOUT_MS 20000 /*!< Connection timeout (in ms) */
|
||||
#define AIRLIFT_CONNECT_RETRY_DELAY_MS 200 /*!< delay time between retries. */
|
||||
|
||||
#ifndef SPIWIFI
|
||||
#define SPIWIFI SPI /*!< Instance of SPI interface used by an AirLift. */
|
||||
#endif
|
||||
|
||||
extern Wippersnapper WS;
|
||||
/****************************************************************************/
|
||||
|
|
@ -51,13 +49,9 @@ public:
|
|||
*/
|
||||
/**************************************************************************/
|
||||
Wippersnapper_AIRLIFT() : Wippersnapper() {
|
||||
_ssPin = SPIWIFI_SS;
|
||||
_ackPin = SPIWIFI_ACK;
|
||||
#ifdef ESP32_RESETN
|
||||
_rstPin = ESP32_RESETN; // FruitJam
|
||||
#else
|
||||
_rstPin = SPIWIFI_RESET;
|
||||
#endif // ESP32_RESETN
|
||||
_ssPin = SPIWIFI_SS; // 10;
|
||||
_ackPin = SPIWIFI_ACK; // 7;
|
||||
_rstPin = SPIWIFI_RESET; // 5; // should be 7 on PyPortals
|
||||
#ifdef ESP32_GPIO0
|
||||
_gpio0Pin = ESP32_GPIO0;
|
||||
#else
|
||||
|
|
@ -242,7 +236,7 @@ public:
|
|||
*/
|
||||
/********************************************************/
|
||||
void getMacAddr() {
|
||||
byte mac[6] = {0};
|
||||
uint8_t mac[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
WiFi.macAddress(mac);
|
||||
memcpy(WS._macAddr, mac, sizeof(mac));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,9 +28,7 @@
|
|||
defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S3_REVTFT) || \
|
||||
defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2_REVTFT) || \
|
||||
defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2) || \
|
||||
defined(ARDUINO_XIAO_ESP32S3) || \
|
||||
defined(ADAFRUIT_FRUITJAM_RP2350)
|
||||
|
||||
defined(ARDUINO_XIAO_ESP32S3)
|
||||
#include "Wippersnapper_FS.h"
|
||||
#include "print_dependencies.h"
|
||||
// On-board external flash (QSPI or SPI) macros should already
|
||||
|
|
|
|||
Loading…
Reference in a new issue