Compare commits

...

5 commits

Author SHA1 Message Date
Tyeth Gundry
2723c39d84 fix(qmc883p): set range to 30G and log xyz until vector supported 2025-08-28 19:23:55 +01:00
Tyeth Gundry
e900680569 fix(huzzah): platformIO ram .text1 section size (iram1_0_seg) 2025-08-27 11:31:33 +01:00
Tyeth Gundry
2a2c2cf579 fix(qmc5883p): use continuous mode instead of normal 2025-08-26 20:50:43 +01:00
Tyeth Gundry
1ef9d169ec add(qmc5883p): initial vectorless result 2025-08-26 20:28:25 +01:00
Tyeth Gundry
a1b412cda4 fix(partitions): 4MB NoOTA in platformIO.ini 2025-08-26 19:21:36 +01:00
6 changed files with 153 additions and 19 deletions

View file

@ -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 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
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 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 QMC5883P Library, 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

View file

@ -47,6 +47,7 @@ lib_deps =
adafruit/Adafruit LTR390 Library
adafruit/Adafruit LTR329 and LTR303
adafruit/Adafruit PCT2075
adafruit/Adafruit QMC5883P Library
adafruit/Adafruit SCD30
adafruit/Adafruit SGP30 Sensor
adafruit/Adafruit SGP40 Sensor
@ -203,7 +204,8 @@ board_build.partitions = min_spiffs.csv
extends = common:esp32
board = featheresp32-s2
build_flags = -DARDUINO_ADAFRUIT_FEATHER_ESP32S2 -DBOARD_HAS_PSRAM
board_build.partitions = tinyuf2-partitions-4MB.csv
;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
; Adafruit Feather ESP32-S2 TFT
@ -211,7 +213,8 @@ 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
board_build.partitions = tinyuf2-partitions-4MB.csv
;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
; Adafruit Feather ESP32-S2 Reverse TFT
@ -219,7 +222,8 @@ 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
board_build.partitions = tinyuf2-partitions-4MB.csv
;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
; Adafruit Feather ESP32-S3 2MB PSRAM
@ -227,8 +231,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.csv as of idf 5.1
board_build.partitions = tinyuf2-partitions-4MB.csv
;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
; Adafruit Feather ESP32-S3 NO PSRAM
@ -246,8 +250,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.csv as of idf 5.1
board_build.partitions = tinyuf2-partitions-4MB.csv
;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
; Adafruit Feather ESP32-S3 Reverse TFT
@ -255,8 +259,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.csv as of idf 5.1
board_build.partitions = tinyuf2-partitions-4MB.csv
;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
; Adafruit Magtag ESP32-S2
@ -264,8 +268,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.csv as of idf 5.1
board_build.partitions = tinyuf2-partitions-4MB.csv
;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
; Adafruit Metro ESP32-S2
@ -273,9 +277,12 @@ 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.csv as of idf 5.1
board_build.partitions = tinyuf2-partitions-4MB.csv
;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
; debug_tool = jlink
; upload_protocol = jlink
; debug_init_break = tbreak WipperSnapper_I2C_Driver_MLX90632D
; Adafruit Metro ESP32-S3
[env:adafruit_metro_esp32s3]
@ -285,13 +292,14 @@ 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.csv as of idf 5.1
;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
@ -320,7 +328,7 @@ build_flags =
-DLV_LOG_PRINTF=1
-DLV_LOG_COLOR=1
-DLV_LOG_LEVEL=LV_LOG_LEVEL_TRACE
;set partition to tinyuf2-partitions-4MB.csv as of idf 5.1
;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
@ -362,8 +370,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.csv as of idf 5.1
board_build.partitions = tinyuf2-partitions-4MB.csv
;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
; Adafruit QT Py ESP32-S3 NO PSRAM
@ -379,12 +387,14 @@ 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 =
@ -471,9 +481,10 @@ build_flags =
-DNON32XFER_FAST
-DDEBUG_DISABLED
-DDEBUG_LEVEL_NONE
-DPIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48 ; avoid section `.text1' will not fit in region `iram1_0_seg'
board_build.eesz=4M2M
board_build.filesystem = littlefs
upload_port = /dev/cu.SLAB_USBtoUART
upload_port = COM19
; SAMD51 Boards ;

View file

@ -737,6 +737,17 @@ bool WipperSnapper_Component_I2C::initI2CDevice(
_pm25->configureDriver(msgDeviceInitReq);
drivers.push_back(_pm25);
WS_DEBUG_PRINTLN("PM2.5 AQI Sensor Initialized Successfully!");
} else if (strcmp("qmc5883p", msgDeviceInitReq->i2c_device_name) == 0) {
_qmc5883p = new WipperSnapper_I2C_Driver_QMC5883P(this->_i2c, i2cAddress);
if (!_qmc5883p->begin()) {
WS_DEBUG_PRINTLN("ERROR: Failed to initialize QMC5883P Sensor!");
_busStatusResponse =
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
return false;
}
_qmc5883p->configureDriver(msgDeviceInitReq);
drivers.push_back(_qmc5883p);
WS_DEBUG_PRINTLN("QMC5883P Sensor Initialized Successfully!");
} else if (strcmp("lc709203f", msgDeviceInitReq->i2c_device_name) == 0) {
_lc = new WipperSnapper_I2C_Driver_LC709203F(this->_i2c, i2cAddress);
if (!_lc->begin()) {

View file

@ -62,6 +62,7 @@
#include "drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h"
#include "drivers/WipperSnapper_I2C_Driver_PCT2075.h"
#include "drivers/WipperSnapper_I2C_Driver_PM25.h"
#include "drivers/WipperSnapper_I2C_Driver_QMC5883P.h"
#include "drivers/WipperSnapper_I2C_Driver_SCD30.h"
#include "drivers/WipperSnapper_I2C_Driver_SCD4X.h"
#include "drivers/WipperSnapper_I2C_Driver_SEN5X.h"
@ -93,6 +94,7 @@ class WipperSnapper_I2C_Driver_INA260;
class WipperSnapper_I2C_Driver_INA237;
class WipperSnapper_I2C_Driver_INA238;
class WipperSnapper_I2C_Driver_INA228;
class WipperSnapper_I2C_Driver_QMC5883P;
/**************************************************************************/
/*!
@ -197,6 +199,7 @@ private:
WipperSnapper_I2C_Driver_SGP40 *_sgp40 = nullptr;
WipperSnapper_I2C_Driver_PCT2075 *_pct2075 = nullptr;
WipperSnapper_I2C_Driver_PM25 *_pm25 = nullptr;
WipperSnapper_I2C_Driver_QMC5883P *_qmc5883p = nullptr;
WipperSnapper_I2C_Driver_SI7021 *_si7021 = nullptr;
WipperSnapper_I2C_Driver_SHT4X *_sht4x = nullptr;
WipperSnapper_I2C_Driver_SHT3X *_sht3x = nullptr;

View file

@ -0,0 +1,81 @@
/*!
* @file WipperSnapper_I2C_Driver_QMC5883P.cpp
*
* Implementation for the Adafruit QMC5883P magnetometer wrapper.
*/
#include "WipperSnapper_I2C_Driver_QMC5883P.h"
#include <Adafruit_QMC5883P.h>
#include <math.h>
WipperSnapper_I2C_Driver_QMC5883P::WipperSnapper_I2C_Driver_QMC5883P(
TwoWire *i2c, uint16_t sensorAddress)
: WipperSnapper_I2C_Driver(i2c, sensorAddress) {}
WipperSnapper_I2C_Driver_QMC5883P::~WipperSnapper_I2C_Driver_QMC5883P() {
if (_qmc) {
delete _qmc;
}
}
bool WipperSnapper_I2C_Driver_QMC5883P::begin() {
_qmc = new Adafruit_QMC5883P();
if (!_qmc->begin(_sensorAddress, _i2c)) {
return false;
}
// Set to continuous mode
_qmc->setMode(QMC5883P_MODE_CONTINUOUS);
// Set ODR (Output Data Rate) to 50Hz
_qmc->setODR(QMC5883P_ODR_50HZ);
// Set OSR (Over Sample Ratio) to 4
_qmc->setOSR(QMC5883P_OSR_4);
// Set DSR (Downsample Ratio) to 2
_qmc->setDSR(QMC5883P_DSR_2);
// Set Range to 30G
_qmc->setRange(QMC5883P_RANGE_30G);
// Set SetReset mode to On
_qmc->setSetResetMode(QMC5883P_SETRESET_ON);
return true;
}
bool WipperSnapper_I2C_Driver_QMC5883P::getEventRaw(sensors_event_t *magEvent) {
if (!_qmc->isDataReady()) {
return false;
}
int16_t x, y, z;
float gx, gy, gz;
// Get raw magnetic data
if (!_qmc->getRawMagnetic(&x, &y, &z)) {
WS_DEBUG_PRINTLN("Failed to read raw magnetic data");
return false;
}
// Get Gauss field data
if (!_qmc->getGaussField(&gx, &gy, &gz)) {
WS_DEBUG_PRINTLN("Failed to read Gauss field data");
WS_DEBUG_PRINT("Raw X: "); WS_DEBUG_PRINTLN(x);
WS_DEBUG_PRINT("Raw Y: "); WS_DEBUG_PRINTLN(y);
WS_DEBUG_PRINT("Raw Z: "); WS_DEBUG_PRINTLN(z);
return false;
} else {
WS_DEBUG_PRINT("Gauss X: "); WS_DEBUG_PRINTLN(gx);
WS_DEBUG_PRINT("Gauss Y: "); WS_DEBUG_PRINTLN(gy);
WS_DEBUG_PRINT("Gauss Z: "); WS_DEBUG_PRINTLN(gz);
}
// Check for overflow
if (_qmc->isOverflow()) {
WS_DEBUG_PRINTLN("QMC5883P data overflow - skipping reading");
return false;
}
// Calculate magnitude in Gauss
float magnitude_G = sqrtf(gx * gx + gy * gy + gz * gz);
magEvent->data[0] = magnitude_G;
return true;
}

View file

@ -0,0 +1,28 @@
/*!
* @file WipperSnapper_I2C_Driver_QMC5883P.h
*
* Driver wrapper for the Adafruit QMC5883P 3-axis magnetometer.
*
* Publishes magnetic field magnitude in Gauss as SENSOR_TYPE_MAGNETIC_FIELD.
*/
#ifndef WipperSnapper_I2C_Driver_QMC5883P_H
#define WipperSnapper_I2C_Driver_QMC5883P_H
#include "WipperSnapper_I2C_Driver.h"
#include "Wippersnapper.h"
class Adafruit_QMC5883P; // forward
class WipperSnapper_I2C_Driver_QMC5883P : public WipperSnapper_I2C_Driver {
public:
WipperSnapper_I2C_Driver_QMC5883P(TwoWire *i2c, uint16_t sensorAddress);
~WipperSnapper_I2C_Driver_QMC5883P();
bool begin();
bool getEventRaw(sensors_event_t *magEvent);
private:
Adafruit_QMC5883P *_qmc = nullptr;
};
#endif // WipperSnapper_I2C_Driver_QMC5883P_H