1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-14 06:23:07 +01:00

separate sensor libs

This commit is contained in:
andreas
2023-10-29 09:46:54 +01:00
parent 6281067afa
commit f606b78929
5 changed files with 53 additions and 16 deletions

View File

@@ -1,13 +1,21 @@
#include "GwIicTask.h"
#include "GwHardware.h"
#include <Wire.h>
#include "SHT3X.h"
#include "QMP6988.h"
#ifdef _GWIIC
#include <Wire.h>
#endif
#ifdef GWSHT3X
#include "SHT3X.h"
#endif
#ifdef GWQMP6988
#include "QMP6988.h"
#endif
#include "GwTimer.h"
#include "N2kMessages.h"
#include "GwHardware.h"
#include "GwXdrTypeMappings.h"
#include <Adafruit_BME280.h>
#ifdef GWBME280
#include <Adafruit_BME280.h>
#endif
//#define GWSHT3X -1
#ifndef GWIIC_SDA
@@ -92,8 +100,9 @@ void runIicTask(GwApi *api);
void initIicTask(GwApi *api){
GwLog *logger=api->getLogger();
#ifndef _GWIIC
vTaskDelete(NULL);
return;
#endif
#else
bool addTask=false;
#ifdef GWSHT3X
api->addCapability("SHT3X","true");
@@ -214,11 +223,11 @@ void runIicTask(GwApi *api){
return;
}
GwConfigHandler *config=api->getConfig();
SHT3X *sht3x=nullptr;
bool runLoop=false;
GwIntervalRunner timers;
int counterId=api->addCounter("iicsensors");
#ifdef GWSHT3X
SHT3X *sht3x=nullptr;
int addr=GWSHT3X;
if (addr < 0) addr=0x44; //default
SHT3XConfig sht3xConfig(config);
@@ -337,4 +346,5 @@ void runIicTask(GwApi *api){
timers.loop();
}
vTaskDelete(NULL);
#endif
}

View File

@@ -1,3 +1,5 @@
#include "GwHardware.h"
#ifdef GWQMP6988
#include <math.h>
#include "stdint.h"
#include "stdio.h"
@@ -390,3 +392,4 @@ uint8_t QMP6988::init(uint8_t slave_addr_in, TwoWire* wire_in) {
setOversamplingT(QMP6988_OVERSAMPLING_1X);
return 1;
}
#endif

View File

@@ -1,3 +1,5 @@
#include "GwHardware.h"
#ifdef GWSHT3X
#include "SHT3X.h"
bool SHT3X::init(uint8_t slave_addr_in, TwoWire* wire_in)
@@ -43,3 +45,4 @@ byte SHT3X::get()
return 0;
}
#endif

View File

@@ -1,18 +1,22 @@
[platformio]
#basically for testing purposes
[env:m5stack-atom-env3]
extends = sensors
board = m5stack-atom
lib_deps =
${env.lib_deps}
${sensors.lib_deps}
build_flags=
-D M5_ENV3
-D M5_CAN_KIT
${env.build_flags}
[env:m5stack-atom-bme280]
extends = sensors
board = m5stack-atom
lib_deps =
${env.lib_deps}
${sensors.lib_deps}
build_flags=
-D GWBME280=-1
-D M5_GROOVEIIC