separate sensor libs
This commit is contained in:
parent
6281067afa
commit
f606b78929
|
@ -1,13 +1,21 @@
|
||||||
#include "GwIicTask.h"
|
#include "GwIicTask.h"
|
||||||
#include "GwHardware.h"
|
#include "GwHardware.h"
|
||||||
|
#ifdef _GWIIC
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
|
#endif
|
||||||
|
#ifdef GWSHT3X
|
||||||
#include "SHT3X.h"
|
#include "SHT3X.h"
|
||||||
|
#endif
|
||||||
|
#ifdef GWQMP6988
|
||||||
#include "QMP6988.h"
|
#include "QMP6988.h"
|
||||||
|
#endif
|
||||||
#include "GwTimer.h"
|
#include "GwTimer.h"
|
||||||
#include "N2kMessages.h"
|
#include "N2kMessages.h"
|
||||||
#include "GwHardware.h"
|
#include "GwHardware.h"
|
||||||
#include "GwXdrTypeMappings.h"
|
#include "GwXdrTypeMappings.h"
|
||||||
|
#ifdef GWBME280
|
||||||
#include <Adafruit_BME280.h>
|
#include <Adafruit_BME280.h>
|
||||||
|
#endif
|
||||||
//#define GWSHT3X -1
|
//#define GWSHT3X -1
|
||||||
|
|
||||||
#ifndef GWIIC_SDA
|
#ifndef GWIIC_SDA
|
||||||
|
@ -92,8 +100,9 @@ void runIicTask(GwApi *api);
|
||||||
void initIicTask(GwApi *api){
|
void initIicTask(GwApi *api){
|
||||||
GwLog *logger=api->getLogger();
|
GwLog *logger=api->getLogger();
|
||||||
#ifndef _GWIIC
|
#ifndef _GWIIC
|
||||||
|
vTaskDelete(NULL);
|
||||||
return;
|
return;
|
||||||
#endif
|
#else
|
||||||
bool addTask=false;
|
bool addTask=false;
|
||||||
#ifdef GWSHT3X
|
#ifdef GWSHT3X
|
||||||
api->addCapability("SHT3X","true");
|
api->addCapability("SHT3X","true");
|
||||||
|
@ -214,11 +223,11 @@ void runIicTask(GwApi *api){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GwConfigHandler *config=api->getConfig();
|
GwConfigHandler *config=api->getConfig();
|
||||||
SHT3X *sht3x=nullptr;
|
|
||||||
bool runLoop=false;
|
bool runLoop=false;
|
||||||
GwIntervalRunner timers;
|
GwIntervalRunner timers;
|
||||||
int counterId=api->addCounter("iicsensors");
|
int counterId=api->addCounter("iicsensors");
|
||||||
#ifdef GWSHT3X
|
#ifdef GWSHT3X
|
||||||
|
SHT3X *sht3x=nullptr;
|
||||||
int addr=GWSHT3X;
|
int addr=GWSHT3X;
|
||||||
if (addr < 0) addr=0x44; //default
|
if (addr < 0) addr=0x44; //default
|
||||||
SHT3XConfig sht3xConfig(config);
|
SHT3XConfig sht3xConfig(config);
|
||||||
|
@ -337,4 +346,5 @@ void runIicTask(GwApi *api){
|
||||||
timers.loop();
|
timers.loop();
|
||||||
}
|
}
|
||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include "GwHardware.h"
|
||||||
|
#ifdef GWQMP6988
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
@ -390,3 +392,4 @@ uint8_t QMP6988::init(uint8_t slave_addr_in, TwoWire* wire_in) {
|
||||||
setOversamplingT(QMP6988_OVERSAMPLING_1X);
|
setOversamplingT(QMP6988_OVERSAMPLING_1X);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include "GwHardware.h"
|
||||||
|
#ifdef GWSHT3X
|
||||||
#include "SHT3X.h"
|
#include "SHT3X.h"
|
||||||
|
|
||||||
bool SHT3X::init(uint8_t slave_addr_in, TwoWire* wire_in)
|
bool SHT3X::init(uint8_t slave_addr_in, TwoWire* wire_in)
|
||||||
|
@ -43,3 +45,4 @@ byte SHT3X::get()
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
|
@ -1,18 +1,22 @@
|
||||||
[platformio]
|
[platformio]
|
||||||
#basically for testing purposes
|
#basically for testing purposes
|
||||||
[env:m5stack-atom-env3]
|
[env:m5stack-atom-env3]
|
||||||
|
extends = sensors
|
||||||
board = m5stack-atom
|
board = m5stack-atom
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
|
${sensors.lib_deps}
|
||||||
build_flags=
|
build_flags=
|
||||||
-D M5_ENV3
|
-D M5_ENV3
|
||||||
-D M5_CAN_KIT
|
-D M5_CAN_KIT
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
|
|
||||||
[env:m5stack-atom-bme280]
|
[env:m5stack-atom-bme280]
|
||||||
|
extends = sensors
|
||||||
board = m5stack-atom
|
board = m5stack-atom
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
|
${sensors.lib_deps}
|
||||||
build_flags=
|
build_flags=
|
||||||
-D GWBME280=-1
|
-D GWBME280=-1
|
||||||
-D M5_GROOVEIIC
|
-D M5_GROOVEIIC
|
||||||
|
|
|
@ -33,11 +33,7 @@ lib_deps =
|
||||||
ESPmDNS
|
ESPmDNS
|
||||||
WiFi
|
WiFi
|
||||||
Update
|
Update
|
||||||
Wire
|
|
||||||
SPI
|
|
||||||
adafruit/Adafruit BME280 Library @ 2.2.2
|
|
||||||
adafruit/Adafruit BusIO @ 1.14.5
|
|
||||||
adafruit/Adafruit Unified Sensor @ 1.1.13
|
|
||||||
|
|
||||||
|
|
||||||
board_build.embed_files =
|
board_build.embed_files =
|
||||||
|
@ -57,6 +53,15 @@ monitor_speed = 115200
|
||||||
build_flags =
|
build_flags =
|
||||||
-D PIO_ENV_BUILD=$PIOENV
|
-D PIO_ENV_BUILD=$PIOENV
|
||||||
|
|
||||||
|
[sensors]
|
||||||
|
; collect the libraries for sensors here
|
||||||
|
lib_deps =
|
||||||
|
Wire
|
||||||
|
SPI
|
||||||
|
adafruit/Adafruit BME280 Library @ 2.2.2
|
||||||
|
adafruit/Adafruit BusIO @ 1.14.5
|
||||||
|
adafruit/Adafruit Unified Sensor @ 1.1.13
|
||||||
|
|
||||||
[env:m5stack-atom]
|
[env:m5stack-atom]
|
||||||
board = m5stack-atom
|
board = m5stack-atom
|
||||||
lib_deps = ${env.lib_deps}
|
lib_deps = ${env.lib_deps}
|
||||||
|
@ -67,8 +72,11 @@ upload_port = /dev/esp32
|
||||||
upload_protocol = esptool
|
upload_protocol = esptool
|
||||||
|
|
||||||
[env:m5stack-atom-generic]
|
[env:m5stack-atom-generic]
|
||||||
|
extends = sensors
|
||||||
board = m5stack-atom
|
board = m5stack-atom
|
||||||
lib_deps = ${env.lib_deps}
|
lib_deps =
|
||||||
|
${env.lib_deps}
|
||||||
|
${sensors.lib_deps}
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
upload_port = /dev/esp32
|
upload_port = /dev/esp32
|
||||||
|
@ -84,8 +92,11 @@ upload_port = /dev/esp32s3
|
||||||
upload_protocol = esptool
|
upload_protocol = esptool
|
||||||
|
|
||||||
[env:m5stack-atoms3-generic]
|
[env:m5stack-atoms3-generic]
|
||||||
|
extends = sensors
|
||||||
board = m5stack-atoms3
|
board = m5stack-atoms3
|
||||||
lib_deps = ${env.lib_deps}
|
lib_deps =
|
||||||
|
${env.lib_deps}
|
||||||
|
${sensors.lib_deps}
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
upload_port = /dev/esp32s3
|
upload_port = /dev/esp32s3
|
||||||
|
@ -134,13 +145,16 @@ board = m5stick-c
|
||||||
lib_deps = ${env.lib_deps}
|
lib_deps = ${env.lib_deps}
|
||||||
build_flags =
|
build_flags =
|
||||||
-D BOARD_M5STICK_CANUNIT -D HAS_RTC -D HAS_M5LCD
|
-D BOARD_M5STICK_CANUNIT -D HAS_RTC -D HAS_M5LCD
|
||||||
${env.build_flags}
|
${env.build_flags}${sensors.lib_deps}
|
||||||
upload_port = /dev/esp32
|
upload_port = /dev/esp32
|
||||||
upload_protocol = esptool
|
upload_protocol = esptool
|
||||||
|
|
||||||
[env:m5stickc-atom-generic]
|
[env:m5stickc-atom-generic]
|
||||||
|
extends = sensors
|
||||||
board = m5stick-c
|
board = m5stick-c
|
||||||
lib_deps = ${env.lib_deps}
|
lib_deps =
|
||||||
|
${env.lib_deps}
|
||||||
|
${sensors.lib_deps}
|
||||||
build_flags =
|
build_flags =
|
||||||
-D BOARD_M5STICK -D HAS_RTC -D HAS_M5LCD
|
-D BOARD_M5STICK -D HAS_RTC -D HAS_M5LCD
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
|
@ -157,8 +171,11 @@ upload_port = /dev/esp32
|
||||||
upload_protocol = esptool
|
upload_protocol = esptool
|
||||||
|
|
||||||
[env:nodemcu-generic]
|
[env:nodemcu-generic]
|
||||||
|
extends = sensors
|
||||||
board = nodemcu-32s
|
board = nodemcu-32s
|
||||||
lib_deps = ${env.lib_deps}
|
lib_deps =
|
||||||
|
${env.lib_deps}
|
||||||
|
${sensors.lib_deps}
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
upload_port = /dev/esp32
|
upload_port = /dev/esp32
|
||||||
|
|
Loading…
Reference in New Issue