correct compilation of SHT3X and QMP6988

This commit is contained in:
andreas 2023-11-03 20:00:16 +01:00
parent 28ae7d3bbd
commit adf55fcade
9 changed files with 87 additions and 89 deletions

View File

@ -8,19 +8,19 @@
#else #else
#undef _GWBME280 #undef _GWBME280
#undef GWBME280 #undef GWBME280
#undef GWBME2801 #undef GWBME28011
#undef GWBME2802 #undef GWBME28012
#undef GWBME2803 #undef GWBME28021
#undef GWBME2804 #undef GWBME28022
#endif #endif
#ifdef _GWBME280 #ifdef _GWBME280
#include <Adafruit_BME280.h> #include <Adafruit_BME280.h>
#endif #endif
#ifdef _GWBME280 #ifdef _GWBME280
#define PRFX1 "BME2801" #define PRFX1 "BME28011"
#define PRFX2 "BME2802" #define PRFX2 "BME28012"
#define PRFX3 "BME2803" #define PRFX3 "BME28013"
#define PRFX4 "BME2804" #define PRFX4 "BME28014"
class BME280Config : public SensorBase{ class BME280Config : public SensorBase{
public: public:
bool prAct=true; bool prAct=true;
@ -97,7 +97,7 @@ class BME280Config : public SensorBase{
busId = 1; busId = 1;
addr = 0x76; addr = 0x76;
#undef CG #undef CG
#define CG(name) CFG_GET(name, BME2801) #define CG(name) CFG_GET(name, BME28011)
CG(prAct); CG(prAct);
CG(tmAct); CG(tmAct);
CG(huAct); CG(huAct);
@ -117,7 +117,7 @@ class BME280Config : public SensorBase{
busId = 1; busId = 1;
addr = 0x77; addr = 0x77;
#undef CG #undef CG
#define CG(name) CFG_GET(name, BME2802) #define CG(name) CFG_GET(name, BME28012)
CG(prAct); CG(prAct);
CG(tmAct); CG(tmAct);
CG(huAct); CG(huAct);
@ -137,7 +137,7 @@ class BME280Config : public SensorBase{
busId = 2; busId = 2;
addr = 0x76; addr = 0x76;
#undef CG #undef CG
#define CG(name) CFG_GET(name, BME2803) #define CG(name) CFG_GET(name, BME28021)
CG(prAct); CG(prAct);
CG(tmAct); CG(tmAct);
CG(huAct); CG(huAct);
@ -157,7 +157,7 @@ class BME280Config : public SensorBase{
busId = 1; busId = 1;
addr = 0x77; addr = 0x77;
#undef CG #undef CG
#define CG(name) CFG_GET(name, BME2804) #define CG(name) CFG_GET(name, BME28022)
CG(prAct); CG(prAct);
CG(tmAct); CG(tmAct);
CG(huAct); CG(huAct);
@ -177,25 +177,25 @@ class BME280Config : public SensorBase{
}; };
void registerBME280(GwApi *api,SensorList &sensors){ void registerBME280(GwApi *api,SensorList &sensors){
#if defined(GWBME280) || defined(GWBME2801) #if defined(GWBME280) || defined(GWBME28011)
{ {
BME280Config *cfg=new BME280Config(api,PRFX1); BME280Config *cfg=new BME280Config(api,PRFX1);
sensors.add(api,cfg); sensors.add(api,cfg);
} }
#endif #endif
#if defined(GWBME2802) #if defined(GWBME28012)
{ {
BME280Config *cfg=new BME280Config(api,PRFX2); BME280Config *cfg=new BME280Config(api,PRFX2);
sensors.add(api,cfg); sensors.add(api,cfg);
} }
#endif #endif
#if defined(GWBME2803) #if defined(GWBME28021)
{ {
BME280Config *cfg=new BME280Config(api,PRFX3); BME280Config *cfg=new BME280Config(api,PRFX3);
sensors.add(api,cfg); sensors.add(api,cfg);
} }
#endif #endif
#if defined(GWBME2804) #if defined(GWBME28022)
{ {
BME280Config *cfg=new BME280Config(api,PRFX4); BME280Config *cfg=new BME280Config(api,PRFX4);
sensors.add(api,cfg); sensors.add(api,cfg);

View File

@ -45,6 +45,7 @@ void initIicTask(GwApi *api){
if (addTask){ if (addTask){
api->addUserTask(runIicTask,"iicTask",3000); api->addUserTask(runIicTask,"iicTask",3000);
} }
#endif
} }
#ifndef _GWIIC #ifndef _GWIIC
void runIicTask(GwApi *api){ void runIicTask(GwApi *api){
@ -147,6 +148,5 @@ void runIicTask(GwApi *api){
timers.loop(); timers.loop();
} }
vTaskDelete(NULL); vTaskDelete(NULL);
#endif
} }
#endif #endif

View File

@ -1,26 +1,9 @@
#include "GwQMP6988.h" #include "GwQMP6988.h"
#ifdef _GWIIC
#if defined(GWQMP6988) || defined(GWQMP69881) || defined(GWQMP69882) || defined(GWQMP69883) || defined(GWQMP69884)
#define _GWQMP6988
#else
#undef _GWQMP6988
#endif
#else
#undef _GWQMP6988
#undef GWQMP6988
#undef GWQMP69881
#undef GWQMP69882
#undef GWQMP69883
#undef GWQMP69884
#endif
#ifdef _GWQMP6988 #ifdef _GWQMP6988
#include "QMP6988.h" #define PRFX1 "QMP698811"
#endif #define PRFX2 "QMP698812"
#ifdef _GWQMP6988 #define PRFX3 "QMP698821"
#define PRFX1 "QMP69881" #define PRFX4 "QMP698822"
#define PRFX2 "QMP69882"
#define PRFX3 "QMP69883"
#define PRFX4 "QMP69884"
class QMP6988Config : public SensorBase{ class QMP6988Config : public SensorBase{
public: public:
String prNam="Pressure"; String prNam="Pressure";
@ -62,7 +45,7 @@ class QMP6988Config : public SensorBase{
busId=1; busId=1;
addr=86; addr=86;
#undef CG #undef CG
#define CG(name) CFG_GET(name,QMP69881) #define CG(name) CFG_GET(name,QMP698811)
CG(prNam); CG(prNam);
CG(iid); CG(iid);
CG(prAct); CG(prAct);
@ -74,7 +57,7 @@ class QMP6988Config : public SensorBase{
busId=1; busId=1;
addr=112; addr=112;
#undef CG #undef CG
#define CG(name) CFG_GET(name,QMP69882) #define CG(name) CFG_GET(name,QMP698812)
CG(prNam); CG(prNam);
CG(iid); CG(iid);
CG(prAct); CG(prAct);
@ -86,7 +69,7 @@ class QMP6988Config : public SensorBase{
busId=2; busId=2;
addr=86; addr=86;
#undef CG #undef CG
#define CG(name) CFG_GET(name,QMP69883) #define CG(name) CFG_GET(name,QMP698821)
CG(prNam); CG(prNam);
CG(iid); CG(iid);
CG(prAct); CG(prAct);
@ -98,7 +81,7 @@ class QMP6988Config : public SensorBase{
busId=2; busId=2;
addr=112; addr=112;
#undef CG #undef CG
#define CG(name) CFG_GET(name,QMP69884) #define CG(name) CFG_GET(name,QMP698822)
CG(prNam); CG(prNam);
CG(iid); CG(iid);
CG(prAct); CG(prAct);

View File

@ -1,5 +1,22 @@
#ifndef _GQQMP6988_H #ifndef _GQQMP6988_H
#define _GQQMP6988_H #define _GQQMP6988_H
#include "GwIicSensors.h" #include "GwIicSensors.h"
#ifdef _GWIIC
#if defined(GWQMP6988) || defined(GWQMP698811) || defined(GWQMP698812) || defined(GWQMP698821) || defined(GWQMP698822)
#define _GWQMP6988
#else
#undef _GWQMP6988
#endif
#else
#undef _GWQMP6988
#undef GWQMP6988
#undef GWQMP698811
#undef GWQMP698812
#undef GWQMP698821
#undef GWQMP698822
#endif
#ifdef _GWQMP6988
#include "QMP6988.h"
#endif
void registerQMP6988(GwApi *api,SensorList &sensors); void registerQMP6988(GwApi *api,SensorList &sensors);
#endif #endif

View File

@ -1,27 +1,10 @@
#include "GwSHT3X.h" #include "GwSHT3X.h"
#ifdef _GWIIC
#if defined(GWSHT3X) || defined(GWSHT3X1) || defined(GWSHT3X2) || defined(GWSHT3X2) || defined(GWSHT3X4)
#define _GWSHT3X
#else
#undef _GWSHT3X
#endif
#else
#undef _GWSHT3X
#undef GWSHT3X
#undef GWSHT3X1
#undef GWSHT3X2
#undef GWSHT3X3
#undef GWSHT3X4
#endif
#ifdef _GWSHT3X
#include "SHT3X.h"
#endif
#ifdef _GWSHT3X #ifdef _GWSHT3X
#define PRFX1 "SHT3X1" #define PRFX1 "SHT3X11"
#define PRFX2 "SHT3X2" #define PRFX2 "SHT3X12"
#define PRFX3 "SHT3X3" #define PRFX3 "SHT3X21"
#define PRFX4 "SHT3X4" #define PRFX4 "SHT3X22"
class SHT3XConfig : public SensorBase{ class SHT3XConfig : public SensorBase{
public: public:
String tmNam; String tmNam;
@ -88,7 +71,7 @@ class SHT3XConfig : public SensorBase{
busId=1; busId=1;
addr=0x44; addr=0x44;
#undef CG #undef CG
#define CG(name) CFG_GET(name,SHT3X1) #define CG(name) CFG_GET(name,SHT3X11)
CG(tmNam); CG(tmNam);
CG(huNam); CG(huNam);
CG(iid); CG(iid);
@ -103,7 +86,7 @@ class SHT3XConfig : public SensorBase{
busId=1; busId=1;
addr=0x45; addr=0x45;
#undef CG #undef CG
#define CG(name) CFG_GET(name,SHT3X2) #define CG(name) CFG_GET(name,SHT3X12)
CG(tmNam); CG(tmNam);
CG(huNam); CG(huNam);
CG(iid); CG(iid);
@ -118,7 +101,7 @@ class SHT3XConfig : public SensorBase{
busId=2; busId=2;
addr=0x44; addr=0x44;
#undef CG #undef CG
#define CG(name) CFG_GET(name,SHT3X3) #define CG(name) CFG_GET(name,SHT3X21)
CG(tmNam); CG(tmNam);
CG(huNam); CG(huNam);
CG(iid); CG(iid);
@ -133,7 +116,7 @@ class SHT3XConfig : public SensorBase{
busId=2; busId=2;
addr=0x45; addr=0x45;
#undef CG #undef CG
#define CG(name) CFG_GET(name,SHT3X4) #define CG(name) CFG_GET(name,SHT3X22)
CG(tmNam); CG(tmNam);
CG(huNam); CG(huNam);
CG(iid); CG(iid);
@ -149,25 +132,25 @@ class SHT3XConfig : public SensorBase{
}; };
void registerSHT3X(GwApi *api,SensorList &sensors){ void registerSHT3X(GwApi *api,SensorList &sensors){
GwLog *logger=api->getLogger(); GwLog *logger=api->getLogger();
#if defined(GWSHT3X) || defined (GWSHT3X1) #if defined(GWSHT3X) || defined (GWSHT3X11)
{ {
SHT3XConfig *scfg=new SHT3XConfig(api,PRFX1); SHT3XConfig *scfg=new SHT3XConfig(api,PRFX1);
sensors.add(api,scfg); sensors.add(api,scfg);
} }
#endif #endif
#if defined(GWSHT3X2) #if defined(GWSHT3X12)
{ {
SHT3XConfig *scfg=new SHT3XConfig(api,PRFX2); SHT3XConfig *scfg=new SHT3XConfig(api,PRFX2);
sensors.add(api,scfg); sensors.add(api,scfg);
} }
#endif #endif
#if defined(GWSHT3X3) #if defined(GWSHT3X21)
{ {
SHT3XConfig *scfg=new SHT3XConfig(api,PRFX3); SHT3XConfig *scfg=new SHT3XConfig(api,PRFX3);
sensors.add(api,scfg); sensors.add(api,scfg);
} }
#endif #endif
#if defined(GWSHT3X4) #if defined(GWSHT3X22)
{ {
SHT3XConfig *scfg=new SHT3XConfig(api,PRFX4); SHT3XConfig *scfg=new SHT3XConfig(api,PRFX4);
sensors.add(api,scfg); sensors.add(api,scfg);

View File

@ -1,5 +1,22 @@
#ifndef _GWSHT3X_H #ifndef _GWSHT3X_H
#define _GWSHT3X_H #define _GWSHT3X_H
#include "GwIicSensors.h" #include "GwIicSensors.h"
#ifdef _GWIIC
#if defined(GWSHT3X) || defined(GWSHT3X11) || defined(GWSHT3X12) || defined(GWSHT3X21) || defined(GWSHT3X22)
#define _GWSHT3X
#else
#undef _GWSHT3X
#endif
#else
#undef _GWSHT3X
#undef GWSHT3X
#undef GWSHT3X11
#undef GWSHT3X12
#undef GWSHT3X21
#undef GWSHT3X22
#endif
#ifdef _GWSHT3X
#include "SHT3X.h"
#endif
void registerSHT3X(GwApi *api,SensorList &sensors); void registerSHT3X(GwApi *api,SensorList &sensors);
#endif #endif

View File

@ -1,9 +1,8 @@
#include "GwHardware.h" #include "GwQMP6988.h"
#ifdef GWQMP6988 #ifdef _GWQMP6988
#include <math.h> #include <math.h>
#include "stdint.h" #include "stdint.h"
#include "stdio.h" #include "stdio.h"
#include "QMP6988.h"
// DISABLE LOG // DISABLE LOG
#define QMP6988_LOG(format...) #define QMP6988_LOG(format...)

View File

@ -1,6 +1,5 @@
#include "GwHardware.h" #include "GwSHT3X.h"
#ifdef GWSHT3X #ifdef _GWSHT3X
#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)
{ {

View File

@ -5,22 +5,22 @@
"replace": [ "replace": [
{ {
"b": "1", "b": "1",
"i": "1", "i": "11",
"n": "99" "n": "99"
}, },
{ {
"b": "1", "b": "1",
"i": "2", "i": "12",
"n": "98" "n": "98"
}, },
{ {
"b": "2", "b": "2",
"i": "3", "i": "21",
"n": "109" "n": "109"
}, },
{ {
"b": "2", "b": "2",
"i": "4", "i": "22",
"n": "108" "n": "108"
} }
@ -202,22 +202,22 @@
"replace": [ "replace": [
{ {
"b": "1", "b": "1",
"i": "1", "i": "11",
"n": "97" "n": "97"
}, },
{ {
"b": "1", "b": "1",
"i": "2", "i": "12",
"n": "96" "n": "96"
}, },
{ {
"b": "2", "b": "2",
"i": "3", "i": "21",
"n": "107" "n": "107"
}, },
{ {
"b": "2", "b": "2",
"i": "4", "i": "22",
"n": "106" "n": "106"
} }
], ],
@ -291,22 +291,22 @@
"replace": [ "replace": [
{ {
"b": "1", "b": "1",
"i": "1", "i": "11",
"n": "95" "n": "95"
}, },
{ {
"b": "1", "b": "1",
"i": "2", "i": "12",
"n": "94" "n": "94"
}, },
{ {
"b": "2", "b": "2",
"i": "3", "i": "21",
"n": "105" "n": "105"
}, },
{ {
"b": "2", "b": "2",
"i": "4", "i": "22",
"n": "104" "n": "104"
} }
], ],