From adf55fcadecb5b607d697fc6662dc6acedc1aee4 Mon Sep 17 00:00:00 2001 From: andreas Date: Fri, 3 Nov 2023 20:00:16 +0100 Subject: [PATCH] correct compilation of SHT3X and QMP6988 --- lib/iictask/GwBME280.cpp | 32 +++++++++++++++--------------- lib/iictask/GwIicTask.cpp | 2 +- lib/iictask/GwQMP6988.cpp | 33 ++++++++----------------------- lib/iictask/GwQMP6988.h | 17 ++++++++++++++++ lib/iictask/GwSHT3X.cpp | 41 ++++++++++++--------------------------- lib/iictask/GwSHT3X.h | 17 ++++++++++++++++ lib/iictask/QMP6988.cpp | 5 ++--- lib/iictask/SHT3X.cpp | 5 ++--- lib/iictask/config.json | 24 +++++++++++------------ 9 files changed, 87 insertions(+), 89 deletions(-) diff --git a/lib/iictask/GwBME280.cpp b/lib/iictask/GwBME280.cpp index 7ed27ac..01e75f4 100644 --- a/lib/iictask/GwBME280.cpp +++ b/lib/iictask/GwBME280.cpp @@ -8,19 +8,19 @@ #else #undef _GWBME280 #undef GWBME280 - #undef GWBME2801 - #undef GWBME2802 - #undef GWBME2803 - #undef GWBME2804 + #undef GWBME28011 + #undef GWBME28012 + #undef GWBME28021 + #undef GWBME28022 #endif #ifdef _GWBME280 #include #endif #ifdef _GWBME280 -#define PRFX1 "BME2801" -#define PRFX2 "BME2802" -#define PRFX3 "BME2803" -#define PRFX4 "BME2804" +#define PRFX1 "BME28011" +#define PRFX2 "BME28012" +#define PRFX3 "BME28013" +#define PRFX4 "BME28014" class BME280Config : public SensorBase{ public: bool prAct=true; @@ -97,7 +97,7 @@ class BME280Config : public SensorBase{ busId = 1; addr = 0x76; #undef CG - #define CG(name) CFG_GET(name, BME2801) + #define CG(name) CFG_GET(name, BME28011) CG(prAct); CG(tmAct); CG(huAct); @@ -117,7 +117,7 @@ class BME280Config : public SensorBase{ busId = 1; addr = 0x77; #undef CG - #define CG(name) CFG_GET(name, BME2802) + #define CG(name) CFG_GET(name, BME28012) CG(prAct); CG(tmAct); CG(huAct); @@ -137,7 +137,7 @@ class BME280Config : public SensorBase{ busId = 2; addr = 0x76; #undef CG - #define CG(name) CFG_GET(name, BME2803) + #define CG(name) CFG_GET(name, BME28021) CG(prAct); CG(tmAct); CG(huAct); @@ -157,7 +157,7 @@ class BME280Config : public SensorBase{ busId = 1; addr = 0x77; #undef CG - #define CG(name) CFG_GET(name, BME2804) + #define CG(name) CFG_GET(name, BME28022) CG(prAct); CG(tmAct); CG(huAct); @@ -177,25 +177,25 @@ class BME280Config : public SensorBase{ }; void registerBME280(GwApi *api,SensorList &sensors){ - #if defined(GWBME280) || defined(GWBME2801) + #if defined(GWBME280) || defined(GWBME28011) { BME280Config *cfg=new BME280Config(api,PRFX1); sensors.add(api,cfg); } #endif - #if defined(GWBME2802) + #if defined(GWBME28012) { BME280Config *cfg=new BME280Config(api,PRFX2); sensors.add(api,cfg); } #endif - #if defined(GWBME2803) + #if defined(GWBME28021) { BME280Config *cfg=new BME280Config(api,PRFX3); sensors.add(api,cfg); } #endif - #if defined(GWBME2804) + #if defined(GWBME28022) { BME280Config *cfg=new BME280Config(api,PRFX4); sensors.add(api,cfg); diff --git a/lib/iictask/GwIicTask.cpp b/lib/iictask/GwIicTask.cpp index 7d1fa4f..2fbb186 100644 --- a/lib/iictask/GwIicTask.cpp +++ b/lib/iictask/GwIicTask.cpp @@ -45,6 +45,7 @@ void initIicTask(GwApi *api){ if (addTask){ api->addUserTask(runIicTask,"iicTask",3000); } + #endif } #ifndef _GWIIC void runIicTask(GwApi *api){ @@ -147,6 +148,5 @@ void runIicTask(GwApi *api){ timers.loop(); } vTaskDelete(NULL); - #endif } #endif diff --git a/lib/iictask/GwQMP6988.cpp b/lib/iictask/GwQMP6988.cpp index 1707a1e..960e8b9 100644 --- a/lib/iictask/GwQMP6988.cpp +++ b/lib/iictask/GwQMP6988.cpp @@ -1,26 +1,9 @@ #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 - #include "QMP6988.h" -#endif -#ifdef _GWQMP6988 -#define PRFX1 "QMP69881" -#define PRFX2 "QMP69882" -#define PRFX3 "QMP69883" -#define PRFX4 "QMP69884" +#define PRFX1 "QMP698811" +#define PRFX2 "QMP698812" +#define PRFX3 "QMP698821" +#define PRFX4 "QMP698822" class QMP6988Config : public SensorBase{ public: String prNam="Pressure"; @@ -62,7 +45,7 @@ class QMP6988Config : public SensorBase{ busId=1; addr=86; #undef CG - #define CG(name) CFG_GET(name,QMP69881) + #define CG(name) CFG_GET(name,QMP698811) CG(prNam); CG(iid); CG(prAct); @@ -74,7 +57,7 @@ class QMP6988Config : public SensorBase{ busId=1; addr=112; #undef CG - #define CG(name) CFG_GET(name,QMP69882) + #define CG(name) CFG_GET(name,QMP698812) CG(prNam); CG(iid); CG(prAct); @@ -86,7 +69,7 @@ class QMP6988Config : public SensorBase{ busId=2; addr=86; #undef CG - #define CG(name) CFG_GET(name,QMP69883) + #define CG(name) CFG_GET(name,QMP698821) CG(prNam); CG(iid); CG(prAct); @@ -98,7 +81,7 @@ class QMP6988Config : public SensorBase{ busId=2; addr=112; #undef CG - #define CG(name) CFG_GET(name,QMP69884) + #define CG(name) CFG_GET(name,QMP698822) CG(prNam); CG(iid); CG(prAct); diff --git a/lib/iictask/GwQMP6988.h b/lib/iictask/GwQMP6988.h index e4cfef0..43e6426 100644 --- a/lib/iictask/GwQMP6988.h +++ b/lib/iictask/GwQMP6988.h @@ -1,5 +1,22 @@ #ifndef _GQQMP6988_H #define _GQQMP6988_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); #endif \ No newline at end of file diff --git a/lib/iictask/GwSHT3X.cpp b/lib/iictask/GwSHT3X.cpp index 378352a..f4dc62e 100644 --- a/lib/iictask/GwSHT3X.cpp +++ b/lib/iictask/GwSHT3X.cpp @@ -1,27 +1,10 @@ #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 -#define PRFX1 "SHT3X1" -#define PRFX2 "SHT3X2" -#define PRFX3 "SHT3X3" -#define PRFX4 "SHT3X4" +#define PRFX1 "SHT3X11" +#define PRFX2 "SHT3X12" +#define PRFX3 "SHT3X21" +#define PRFX4 "SHT3X22" class SHT3XConfig : public SensorBase{ public: String tmNam; @@ -88,7 +71,7 @@ class SHT3XConfig : public SensorBase{ busId=1; addr=0x44; #undef CG - #define CG(name) CFG_GET(name,SHT3X1) + #define CG(name) CFG_GET(name,SHT3X11) CG(tmNam); CG(huNam); CG(iid); @@ -103,7 +86,7 @@ class SHT3XConfig : public SensorBase{ busId=1; addr=0x45; #undef CG - #define CG(name) CFG_GET(name,SHT3X2) + #define CG(name) CFG_GET(name,SHT3X12) CG(tmNam); CG(huNam); CG(iid); @@ -118,7 +101,7 @@ class SHT3XConfig : public SensorBase{ busId=2; addr=0x44; #undef CG - #define CG(name) CFG_GET(name,SHT3X3) + #define CG(name) CFG_GET(name,SHT3X21) CG(tmNam); CG(huNam); CG(iid); @@ -133,7 +116,7 @@ class SHT3XConfig : public SensorBase{ busId=2; addr=0x45; #undef CG - #define CG(name) CFG_GET(name,SHT3X4) + #define CG(name) CFG_GET(name,SHT3X22) CG(tmNam); CG(huNam); CG(iid); @@ -149,25 +132,25 @@ class SHT3XConfig : public SensorBase{ }; void registerSHT3X(GwApi *api,SensorList &sensors){ GwLog *logger=api->getLogger(); - #if defined(GWSHT3X) || defined (GWSHT3X1) + #if defined(GWSHT3X) || defined (GWSHT3X11) { SHT3XConfig *scfg=new SHT3XConfig(api,PRFX1); sensors.add(api,scfg); } #endif - #if defined(GWSHT3X2) + #if defined(GWSHT3X12) { SHT3XConfig *scfg=new SHT3XConfig(api,PRFX2); sensors.add(api,scfg); } #endif - #if defined(GWSHT3X3) + #if defined(GWSHT3X21) { SHT3XConfig *scfg=new SHT3XConfig(api,PRFX3); sensors.add(api,scfg); } #endif - #if defined(GWSHT3X4) + #if defined(GWSHT3X22) { SHT3XConfig *scfg=new SHT3XConfig(api,PRFX4); sensors.add(api,scfg); diff --git a/lib/iictask/GwSHT3X.h b/lib/iictask/GwSHT3X.h index be5e8dd..085cab7 100644 --- a/lib/iictask/GwSHT3X.h +++ b/lib/iictask/GwSHT3X.h @@ -1,5 +1,22 @@ #ifndef _GWSHT3X_H #define _GWSHT3X_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); #endif \ No newline at end of file diff --git a/lib/iictask/QMP6988.cpp b/lib/iictask/QMP6988.cpp index 50f178f..35c3c5c 100644 --- a/lib/iictask/QMP6988.cpp +++ b/lib/iictask/QMP6988.cpp @@ -1,9 +1,8 @@ -#include "GwHardware.h" -#ifdef GWQMP6988 +#include "GwQMP6988.h" +#ifdef _GWQMP6988 #include #include "stdint.h" #include "stdio.h" -#include "QMP6988.h" // DISABLE LOG #define QMP6988_LOG(format...) diff --git a/lib/iictask/SHT3X.cpp b/lib/iictask/SHT3X.cpp index 7ab5ec3..7830cf5 100644 --- a/lib/iictask/SHT3X.cpp +++ b/lib/iictask/SHT3X.cpp @@ -1,6 +1,5 @@ -#include "GwHardware.h" -#ifdef GWSHT3X -#include "SHT3X.h" +#include "GwSHT3X.h" +#ifdef _GWSHT3X bool SHT3X::init(uint8_t slave_addr_in, TwoWire* wire_in) { diff --git a/lib/iictask/config.json b/lib/iictask/config.json index 9989c0c..ec7d613 100644 --- a/lib/iictask/config.json +++ b/lib/iictask/config.json @@ -5,22 +5,22 @@ "replace": [ { "b": "1", - "i": "1", + "i": "11", "n": "99" }, { "b": "1", - "i": "2", + "i": "12", "n": "98" }, { "b": "2", - "i": "3", + "i": "21", "n": "109" }, { "b": "2", - "i": "4", + "i": "22", "n": "108" } @@ -202,22 +202,22 @@ "replace": [ { "b": "1", - "i": "1", + "i": "11", "n": "97" }, { "b": "1", - "i": "2", + "i": "12", "n": "96" }, { "b": "2", - "i": "3", + "i": "21", "n": "107" }, { "b": "2", - "i": "4", + "i": "22", "n": "106" } ], @@ -291,22 +291,22 @@ "replace": [ { "b": "1", - "i": "1", + "i": "11", "n": "95" }, { "b": "1", - "i": "2", + "i": "12", "n": "94" }, { "b": "2", - "i": "3", + "i": "21", "n": "105" }, { "b": "2", - "i": "4", + "i": "22", "n": "104" } ],