Skip to content

Commit

Permalink
Remove BMA-423 and STK8X by default (meshtastic#5429)
Browse files Browse the repository at this point in the history
* Remove BMA-423 by default

* STK

* Wrong macro

* Helps if you include the file
  • Loading branch information
thebentern authored and fifieldt committed Dec 14, 2024
1 parent 563aeba commit cc7440b
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 11 deletions.
6 changes: 1 addition & 5 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,11 @@ lib_deps =
sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino [email protected]
ClosedCube [email protected]
emotibit/EmotiBit [email protected]
dfrobot/[email protected]
sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor [email protected]
adafruit/Adafruit MLX90614 [email protected]

https://github.com/boschsensortec/Bosch-BSEC2-Library#v1.7.2502
boschsensortec/BME68x Sensor [email protected]
https://github.com/KodinLanewave/[email protected]
lewisxhe/[email protected]
mprograms/[email protected]

dfrobot/[email protected]
https://github.com/meshtastic/DFRobot_LarkWeatherStation#4de3a9cadef0f6a5220a8a906cf9775b02b0040d
https://github.com/gjelsoe/STK8xxx-Accelerometer.git#v0.1.1
2 changes: 2 additions & 0 deletions src/detect/ScanI2CTwoWire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,15 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
// We need to check for STK8BAXX first, since register 0x07 is new data flag for the z-axis and can produce some
// weird result. and register 0x00 doesn't seems to be colliding with MCP9808 and LIS3DH chips.
{
#ifdef HAS_STK8XXX
// Check register 0x00 for 0x8700 response to ID STK8BA53 chip.
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x00), 2);
if (registerValue == 0x8700) {
type = STK8BAXX;
LOG_INFO("STK8BAXX accelerometer found");
break;
}
#endif

// Check register 0x07 for 0x0400 response to ID MCP9808 chip.
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x07), 2);
Expand Down
8 changes: 8 additions & 0 deletions src/motion/AccelerometerThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C

#include "../concurrency/OSThread.h"
#ifdef HAS_BMA423
#include "BMA423Sensor.h"
#endif
#include "BMX160Sensor.h"
#include "ICM20948Sensor.h"
#include "LIS3DHSensor.h"
Expand All @@ -17,7 +19,9 @@
#ifdef HAS_QMA6100P
#include "QMA6100PSensor.h"
#endif
#ifdef HAS_STK8XXX
#include "STK8XXXSensor.h"
#endif

extern ScanI2C::DeviceAddress accelerometer_found;

Expand Down Expand Up @@ -79,9 +83,11 @@ class AccelerometerThread : public concurrency::OSThread
#endif

switch (device.type) {
#ifdef HAS_BMA423
case ScanI2C::DeviceType::BMA423:
sensor = new BMA423Sensor(device);
break;
#endif
case ScanI2C::DeviceType::MPU6050:
sensor = new MPU6050Sensor(device);
break;
Expand All @@ -94,9 +100,11 @@ class AccelerometerThread : public concurrency::OSThread
case ScanI2C::DeviceType::LSM6DS3:
sensor = new LSM6DS3Sensor(device);
break;
#ifdef HAS_STK8XXX
case ScanI2C::DeviceType::STK8BAXX:
sensor = new STK8XXXSensor(device);
break;
#endif
case ScanI2C::DeviceType::ICM20948:
sensor = new ICM20948Sensor(device);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/motion/BMA423Sensor.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "BMA423Sensor.h"

#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C && defined(HAS_BMA423)

using namespace MotionSensorI2C;

Expand Down
2 changes: 1 addition & 1 deletion src/motion/BMA423Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "MotionSensor.h"

#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C && defined(HAS_BMA423)

#include <SensorBMA423.hpp>
#include <Wire.h>
Expand Down
2 changes: 1 addition & 1 deletion src/motion/STK8XXXSensor.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "STK8XXXSensor.h"

#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C && defined(HAS_STK8XXX)

STK8XXXSensor::STK8XXXSensor(ScanI2C::FoundDevice foundDevice) : MotionSensor::MotionSensor(foundDevice) {}

Expand Down
2 changes: 1 addition & 1 deletion src/motion/STK8XXXSensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "MotionSensor.h"

#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C && defined(HAS_STK8XXX)

#ifdef STK8XXX_INT

Expand Down
4 changes: 3 additions & 1 deletion variants/radiomaster_900_bandit/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ build_flags =
-DRADIOMASTER_900_BANDIT
-DVTABLES_IN_FLASH=1
-DCONFIG_DISABLE_HAL_LOCKS=1
-DHAS_STK8XXX=1
-O2
-Ivariants/radiomaster_900_bandit
board_build.f_cpu = 240000000L
upload_protocol = esptool
lib_deps =
${esp32_base.lib_deps}
${esp32_base.lib_deps}
https://github.com/gjelsoe/STK8xxx-Accelerometer.git#v0.1.1
4 changes: 3 additions & 1 deletion variants/t-watch-s3/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ build_flags = ${esp32_base.build_flags}
-DT_WATCH_S3
-Ivariants/t-watch-s3
-DPCF8563_RTC=0x51
-DHAS_BMA423=1

lib_deps = ${esp32s3_base.lib_deps}
lovyan03/LovyanGFX@^1.1.9
lewisxhe/[email protected]
adafruit/Adafruit DRV2605 Library@^1.2.2
earlephilhower/ESP8266Audio@^1.9.9
earlephilhower/ESP8266SAM@^1.0.1
earlephilhower/ESP8266SAM@^1.0.1
lewisxhe/[email protected]

0 comments on commit cc7440b

Please sign in to comment.