Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
974eccf
Remove final SPI Flash forked copy from CI
tyeth Apr 4, 2025
c67ea20
Closes #724 - Add SGP30 to offline mode
tyeth Apr 4, 2025
bb1e440
Adds HTU31D
tyeth Apr 25, 2025
1617c18
BSP 3.20
tyeth Apr 25, 2025
7fd0d1a
Attempt to fix the config.json file getting rm'd
brentru Apr 29, 2025
11cee82
More intelligent approach for the config file rm issue
brentru Apr 29, 2025
d1285cb
Remove final SPI Flash forked copy from CI
tyeth Apr 4, 2025
b93f131
Closes #724 - Add SGP30 to offline mode
tyeth Apr 4, 2025
aec7371
Adds HTU31D
tyeth Apr 25, 2025
57a0b89
BSP 3.20
tyeth Apr 25, 2025
19b58a8
Add HDC302x
tyeth Apr 29, 2025
602bbd6
Add LPS28DFW
tyeth Apr 29, 2025
e547559
Add VCNL4200
tyeth Apr 29, 2025
943b717
Add INA260
tyeth Apr 29, 2025
2c6713d
Add SEN6x
tyeth Apr 29, 2025
45da7d3
Mention RP2350
tyeth Apr 29, 2025
922653c
clang
tyeth Apr 29, 2025
e602c71
Fix RTC issue
brentru May 2, 2025
59bb1e5
Use fix for Wire1, too
brentru May 2, 2025
7494b5a
Remove prints/delays for debugging
brentru May 2, 2025
0e6de25
CI run
brentru May 2, 2025
11e2116
Clang
brentru May 2, 2025
0887141
Remove requirement for secrets.json config default for offline mode
brentru May 2, 2025
2a75f7a
Merge branch 'add-offline-drivers-2025-04-04' into latest-fixes-20250506
tyeth May 6, 2025
edfde81
clang format i2c/controller.cpp
tyeth May 6, 2025
34e4db4
Clang reorder imports controller.h
tyeth May 6, 2025
0addc4f
ESP32 BSP 3.20 -> 3.13
tyeth May 6, 2025
5d1f489
Merge remote-tracking branch 'upstream/offline-mode-add-missing-drive…
tyeth May 12, 2025
69f2659
Back to BSP 3.13
tyeth May 12, 2025
6e592fb
Drop NDEBUG flags
tyeth May 12, 2025
09a925b
Add SEN66 auto detection addresses
tyeth May 12, 2025
a1dd63d
Add INA260 autodetection
tyeth May 12, 2025
799d422
Add VCNL4200 autodetection
tyeth May 12, 2025
4aaa036
Add LPS28DFW autodetection
tyeth May 12, 2025
9355d04
Add HDC302x autodetection
tyeth May 12, 2025
92ecd21
Add HTU31D autodetection
tyeth May 12, 2025
5b55fd5
Merge branch 'offline-mode-add-missing-drivers-2025-04-04' into offli…
tyeth May 12, 2025
6ace339
clang format autodetection list
tyeth May 12, 2025
f5c2c93
Print I2C driver info
tyeth May 12, 2025
20c4784
Wait 2.5seconds after reconnect before printing
tyeth May 12, 2025
91c2ee8
Remove USB_CDC. Don't refresh host on host write
tyeth May 12, 2025
b86cfc1
haltErrorV2 reattach MSC by default
tyeth May 12, 2025
a923c22
Set PlatformIO sketch to use offline adapter if needed
tyeth May 13, 2025
10f0a20
Default to PiCowbell SD CS pins on Pico boards
tyeth May 13, 2025
bf2e43c
Report SD CS Pin in event of failure
tyeth May 13, 2025
087e5bd
SGP30 auto address
tyeth May 13, 2025
8cc7335
Add missing default sensor types
tyeth May 13, 2025
3499a32
Add LPS33HW + LPS35HW auto address
tyeth May 13, 2025
c6e8722
Merge branch 'offline-mode-20250506-with-drivers' of https://github.c…
tyeth May 13, 2025
a68913f
Use SEN55 as auto default instead of SEN50
tyeth May 13, 2025
3be34a3
Remove extra boards file and clang format
tyeth May 13, 2025
43c9cda
set WsV2.pin_sd_cs on InitSdCard(pin_cs) call
tyeth May 13, 2025
45989bf
Drivers as drvBase not auto
tyeth May 13, 2025
74eab4c
Remove null driver check + \n after drv->printSensorInfo()
tyeth May 13, 2025
dab54bb
Remove redundant commented out code
tyeth May 13, 2025
1b4b617
Update file headers with Licence etc
tyeth May 13, 2025
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
1 change: 0 additions & 1 deletion .github/workflows/build-clang-doxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ jobs:
run: |
git clone --quiet https://github.com/pstolarz/OneWireNg.git /home/runner/Arduino/libraries/OneWireNg
git clone --quiet https://github.com/pstolarz/Arduino-Temperature-Control-Library.git /home/runner/Arduino/libraries/Arduino-Temperature-Control-Library
git clone --quiet https://github.com/brentru/Adafruit_SPIFlash.git /home/runner/Arduino/libraries/Adafruit_SPIFlash
git clone --quiet https://github.com/adafruit/Adafruit_TinyUSB_Arduino /home/runner/Arduino/libraries/Adafruit_TinyUSB_Arduino
- name: Download stable Nanopb
id: download-nanopb
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release-offline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
branches:
- offline-mode
- offline-mode-*
pull_request:
branches:
- offline-mode
release:
types: [published]
branches:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Pre-compiled binaries and UF2 files for supported hardware are provided on the [
|--|--|
|[ESP32-x](https://github.com/espressif/arduino-esp32)| ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 |
|[ESP8266](https://github.com/esp8266/Arduino)| ESP8266 |
|[RP2040](https://github.com/earlephilhower/arduino-pico)| RP2040 MCU w/WiFi (i.e: Pico W) |
|[RP2](https://github.com/earlephilhower/arduino-pico)| RP2040/RP2350 MCU w/WiFi (i.e: Pico W) |
|[ATSAMD](https://github.com/adafruit/ArduinoCore-samd/)| SAMD51 MCU w/separate WiFi Co-Processor (i.e: Adafruit "AirLift")|

## Contributing to Adafruit.io and WipperSnapper
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ paragraph=Arduino application for Adafruit.io WipperSnapper
category=Communication
url=https://github.com/adafruit/Adafruit_Wippersnapper_Arduino
architectures=*
depends=SdFat - Adafruit Fork, Adafruit SPIFlash, Adafruit NeoPixel, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, 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, RTClib, StreamUtils, Adafruit SHT4x Library
depends=SdFat - Adafruit Fork, Adafruit SPIFlash, Adafruit NeoPixel, 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, RTClib, StreamUtils, Adafruit SHT4x Library
12 changes: 6 additions & 6 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ lib_deps =
adafruit/Adafruit DPS310
adafruit/Adafruit DS248x
adafruit/Adafruit INA219
adafruit/Adafruit INA260 Library
adafruit/Adafruit HTS221
adafruit/Adafruit HTU21DF Library
adafruit/Adafruit HTU31D Library
adafruit/Adafruit HDC302x
adafruit/Adafruit LTR390 Library
adafruit/Adafruit LTR329 and LTR303
adafruit/Adafruit PCT2075
Expand All @@ -43,6 +45,7 @@ lib_deps =
adafruit/Adafruit Si7021 Library
adafruit/Adafruit VCNL4020 Library
adafruit/Adafruit VCNL4040
adafruit/Adafruit VCNL4200 Library
adafruit/Adafruit MCP3421
adafruit/Adafruit MCP9808 Library
adafruit/Adafruit MCP9600 Library
Expand All @@ -61,6 +64,7 @@ lib_deps =
adafruit/Adafruit VEML7700 Library
adafruit/Adafruit LC709203F
adafruit/Adafruit LPS2X
adafruit/Adafruit LPS28
adafruit/Adafruit LPS35HW
adafruit/Adafruit seesaw Library
adafruit/Adafruit BME680 Library
Expand All @@ -76,6 +80,7 @@ lib_deps =
https://github.com/pstolarz/OneWireNg.git
https://github.com/Sensirion/arduino-sht.git
https://github.com/Sensirion/arduino-i2c-sen5x.git
https://github.com/Sensirion/arduino-i2c-sen66.git
https://github.com/adafruit/WiFiNINA.git
https://github.com/Starmbi/hp_BH1750.git
https://github.com/adafruit/RTClib.git
Expand All @@ -84,9 +89,7 @@ lib_deps =

; Common build environment for ESP32 platform
[common:esp32]
; platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.03/platform-espressif32.zip
; platform = https://github.com/pioarduino/platform-espressif32#develop
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.07/platform-espressif32.zip
platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.13/platform-espressif32.zip
lib_ignore = WiFiNINA, WiFi101
monitor_filters = esp32_exception_decoder, time
; upload_speed = 921600
Expand Down Expand Up @@ -333,7 +336,6 @@ build_type = debug
build_flags =
-DUSE_TINYUSB=1
-DARDUINO_ESPRESSIF_ESP32S3_DEVKITC_1_N8
-DNDEBUG=1
-DDEBUG=1
-DESP_LOG_LEVEL=5
-DARDUINO_CORE_DEBUG_LEVEL=5
Expand Down Expand Up @@ -391,7 +393,6 @@ build_flags = -DUSE_TINYUSB
-DARDUINO_USB_CDC_ON_BOOT=1
-DCFG_TUSB_DEBUG=1
-DDEBUG=1
-DNDEBUG=1
-DUSE_AIRLIFT=1
-g
; -DUSBCON
Expand Down Expand Up @@ -472,7 +473,6 @@ build_flags =
-DDEBUG_RP2040_SPI
-DDEBUG_RP2040_CORE
-DDEBUG_RP2040_WIFI
-DNDEBUG
-DLWIP_DEBUG
-DDEBUG_RP2040_PORT=Serial1
-DDEBUG_RP2040_UART_1
Expand Down
6 changes: 3 additions & 3 deletions src/Wippersnapper_Boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,19 +218,19 @@
#define USE_TINYUSB
#define USE_STATUS_LED
#define STATUS_LED_PIN 32
#define SD_CS_PIN 33
#define SD_CS_PIN 17
#elif defined(ARDUINO_RASPBERRY_PI_PICO)
#define BOARD_ID "rpi-pico"
#define USE_TINYUSB
#define USE_STATUS_LED
#define STATUS_LED_PIN LED_BUILTIN
#define SD_CS_PIN 33
#define SD_CS_PIN 17
#elif defined(ARDUINO_RASPBERRY_PI_PICO_2)
#define BOARD_ID "rpi-pico-2"
#define USE_TINYUSB
#define USE_STATUS_LED
#define STATUS_LED_PIN LED_BUILTIN
#define SD_CS_PIN 33
#define SD_CS_PIN 17
#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040_ADALOGGER)
#define BOARD_ID "feather-rp2040-adalogger"
#define USE_TINYUSB
Expand Down
12 changes: 9 additions & 3 deletions src/Wippersnapper_V2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ void Wippersnapper_V2::provision() {
} else {
haltErrorV2("SD initialization failed.\nDo not reformat the card!\nIs the "
"card correctly inserted?\nIs there a wiring/soldering "
"problem\nIs the config.json file malformed?");
// SD card not initialized, so just continue with online-mode provisioning
"problem\nIs the config.json file malformed?\nSD CS Pin: " +
String(WsV2.pin_sd_cs));
}

#ifdef USE_DISPLAY
Expand Down Expand Up @@ -882,7 +882,13 @@ void Wippersnapper_V2::runNetFSMV2() {
*/
/**************************************************************************/
void Wippersnapper_V2::haltErrorV2(String error, ws_led_status_t ledStatusColor,
bool reboot) {
bool reboot, bool reattach_usb_filesystem) {
#ifdef USE_TINYUSB
if (reattach_usb_filesystem) {
WsV2._fileSystemV2->InitUsbMsc();
delay(1500);
}
#endif
WS_DEBUG_PRINT("ERROR ");
if (reboot) {
WS_DEBUG_PRINT("[RESET]: ");
Expand Down
2 changes: 1 addition & 1 deletion src/Wippersnapper_V2.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class Wippersnapper_V2 {
// Error handling helpers
void haltErrorV2(String error,
ws_led_status_t ledStatusColor = WS_LED_STATUS_ERROR_RUNTIME,
bool reboot = true);
bool reboot = true, bool reattach_usb_filesystem = true);
void errorWriteHangV2(String error);

bool _is_offline_mode; ///< Global flag for if the device is in offline mode
Expand Down
7 changes: 7 additions & 0 deletions src/Wippersnapper_demo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
// All text above must be included in any redistribution.

#include "ws_adapters.h"
#if defined(ARDUINO_RASPBERRY_PI_PICO_2) || \
defined(ARDUINO_RASPBERRY_PI_PICO) || \
defined(ARDUINO_ADAFRUIT_FEATHER_RP2040_ADALOGGER) || \
defined(ARDUINO_ADAFRUIT_METRO_RP2350)
ws_adapter_offline wipper;
#else
ws_adapter_wifi wipper;
#endif

#define WS_DEBUG // Enable debug output!

Expand Down
123 changes: 113 additions & 10 deletions src/components/i2c/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,26 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
const char *driver_name) -> drvBase * {
return new drvHtu21d(i2c, addr, mux_channel, driver_name);
}},
{"htu31d",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvHtu31d(i2c, addr, mux_channel, driver_name);
}},
{"hdc302x",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvHdc302x(i2c, addr, mux_channel, driver_name);
}},
{"ina219",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvIna219(i2c, addr, mux_channel, driver_name);
}},
{"ina260",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvIna260(i2c, addr, mux_channel, driver_name);
}},
{"lc709203f",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
Expand All @@ -148,6 +163,11 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
const char *driver_name) -> drvBase * {
return new drvLps25hb(i2c, addr, mux_channel, driver_name);
}},
{"lps28dfw",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvLps28dfw(i2c, addr, mux_channel, driver_name);
}},
{"ltr329",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
Expand Down Expand Up @@ -223,6 +243,11 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
const char *driver_name) -> drvBase * {
return new drvScd30(i2c, addr, mux_channel, driver_name);
}},
{"sgp30",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSgp30(i2c, addr, mux_channel, driver_name);
}},
{"sgp40",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
Expand Down Expand Up @@ -278,6 +303,36 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
const char *driver_name) -> drvBase * {
return new drvSen5x(i2c, addr, mux_channel, driver_name);
}},
{"sen60",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSen6x(i2c, addr, mux_channel, driver_name);
}},
{"sen63c",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSen6x(i2c, addr, mux_channel, driver_name);
}},
{"sen65",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSen6x(i2c, addr, mux_channel, driver_name);
}},
{"sen66",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSen6x(i2c, addr, mux_channel, driver_name);
}},
{"sen68",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSen6x(i2c, addr, mux_channel, driver_name);
}},
{"sen6x",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSen6x(i2c, addr, mux_channel, driver_name);
}},
{"shtc3",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
Expand Down Expand Up @@ -318,6 +373,11 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
const char *driver_name) -> drvBase * {
return new drvVncl4040(i2c, addr, mux_channel, driver_name);
}},
{"vncl4200",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvVncl4200(i2c, addr, mux_channel, driver_name);
}},
{"vl53l0x",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
Expand Down Expand Up @@ -365,10 +425,14 @@ static const std::unordered_map<uint16_t, std::vector<const char *>>
{0x2A, {"nau7802"}},
{0x38, {"aht20", "max17048"}},
{0x39, {"tsl2591"}},
{0x40, {"htu21d", "ina219", "ms8607", "si7021", "stemma_soil"}},
{0x41, {"ina219"}},
{0x44, {"sht3x", "sht4x"}},
{0x45, {"sht3x"}},
{0x40,
{"htu21d", "htu31d", "ina219", "ina260", "ms8607", "si7021",
"stemma_soil"}},
{0x41, {"htu31d", "ina219", "ina260"}},
{0x44, {"hdc302x", "ina260", "sht3x", "sht4x"}},
{0x45, {"hdc302x", "ina260", "sht3x"}},
{0x46, {"hdc302x"}},
{0x47, {"hdc302x"}},
{0x48, {"adt7410", "pct2075", "tmp117"}},
{0x49, {"adt7410", "pct2075", "tmp117", "tsl2591"}},
{0x4A, {"adt7410", "pct2075", "tmp117"}},
Expand All @@ -377,17 +441,21 @@ static const std::unordered_map<uint16_t, std::vector<const char *>>
{0x4D, {"pct2075"}},
{0x4E, {"pct2075"}},
{0x4F, {"pct2075"}},
{0x51, {"vcnl4200"}},
{0x52, {"ens160"}},
{0x53, {"ens160", "ltr390"}},
{0x58, {"sgp30"}},
{0x59, {"sgp40"}},
{0x5C, {"bh1750", "lps22hb", "lps25hb"}},
{0x5D, {"lps22hb", "lps25hb"}},
{0x5C,
{"bh1750", "lps22hb", "lps25hb", "lps28dfw", "lps33hw", "lps35hw"}},
{0x5D, {"lps22hb", "lps25hb", "lps28dfw", "lps33hw", "lps35hw"}},
{0x5F, {"hts2221"}},
{0x60, {"mpl115a2", "vncl4040"}},
{0x61, {"scd30"}},
{0x62, {"scd40"}},
{0x68, {"mcp3421"}},
{0x69, {"sen50"}},
{0x69, {"sen55"}},
{0x6B, {"sen66"}},
{0x70, {"pct2075", "shtc3"}},
{0x71, {"pct2075"}},
{0x72, {"pct2075"}},
Expand Down Expand Up @@ -862,11 +930,39 @@ bool I2cController::Handle_I2cDeviceAddOrReplace(pb_istream_t *stream) {
*/
/***********************************************************************/
bool I2cController::ScanI2cBus(bool default_bus = true) {
_i2c_bus_default->InitBus(default_bus);
// zero-out the scan I2cBusScanned message before attempting a scan
_scan_results = wippersnapper_i2c_I2cBusScanned_init_zero;
if (!default_bus)

// Scan the desired i2c bus
if (default_bus) {
if (_i2c_bus_default->GetBusStatus() !=
wippersnapper_i2c_I2cBusStatus_I2C_BUS_STATUS_SUCCESS) {
_i2c_bus_default->InitBus(default_bus);
}
return _i2c_bus_default->ScanBus(&_scan_results);
} else {
if (_i2c_bus_alt->GetBusStatus() !=
wippersnapper_i2c_I2cBusStatus_I2C_BUS_STATUS_SUCCESS) {
_i2c_bus_alt->InitBus(default_bus);
}
return _i2c_bus_alt->ScanBus(&_scan_results);
return _i2c_bus_default->ScanBus(&_scan_results);
}
}

/***********************************************************************/
/*!
@brief Returns the I2C bus object.
@param is_alt_bus
True if the alternative I2C bus is being used, False
otherwise.
@returns A pointer to the I2C bus object.
*/
/***********************************************************************/
TwoWire *I2cController::GetI2cBus(bool is_alt_bus) {
if (is_alt_bus) {
return _i2c_bus_alt->GetBus();
}
return _i2c_bus_default->GetBus();
}

/***********************************************************************/
Expand Down Expand Up @@ -934,6 +1030,13 @@ void I2cController::ConfigureMuxChannel(uint32_t mux_channel, bool is_alt_bus) {
_i2c_bus_default->SelectMuxChannel(mux_channel);
}

void I2cController::PrintAllDrivers() {
WS_DEBUG_PRINTLN("[i2c] Printing all drivers...");
for (drvBase *drv : _i2c_drivers) {
drv->printSensorInfo();
}
}

/***********************************************************************/
/*!
@brief Handles polling, reading, and logger for i2c devices
Expand Down
Loading
Loading