diff --git a/lib/iictask/GwBME280.cpp b/lib/iictask/GwBME280.cpp index 01e75f4..a1bca7d 100644 --- a/lib/iictask/GwBME280.cpp +++ b/lib/iictask/GwBME280.cpp @@ -1,6 +1,6 @@ #include "GwBME280.h" #ifdef _GWIIC - #if defined(GWBME280) || defined(GWBME2801) || defined(GWBME2802)|| defined(GWBME2803)|| defined(GWBME2804) + #if defined(GWBME280) || defined(GWBME28011) || defined(GWBME28012)|| defined(GWBME28021)|| defined(GWBME28022) #define _GWBME280 #else #undef _GWBME280 @@ -19,8 +19,8 @@ #ifdef _GWBME280 #define PRFX1 "BME28011" #define PRFX2 "BME28012" -#define PRFX3 "BME28013" -#define PRFX4 "BME28014" +#define PRFX3 "BME28021" +#define PRFX4 "BME28022" class BME280Config : public SensorBase{ public: bool prAct=true; @@ -154,7 +154,7 @@ class BME280Config : public SensorBase{ } if (prefix == PRFX4) { - busId = 1; + busId = 2; addr = 0x77; #undef CG #define CG(name) CFG_GET(name, BME28022) @@ -181,24 +181,28 @@ void registerBME280(GwApi *api,SensorList &sensors){ { BME280Config *cfg=new BME280Config(api,PRFX1); sensors.add(api,cfg); + #pragma message "GWBME28011 defined" } #endif #if defined(GWBME28012) { BME280Config *cfg=new BME280Config(api,PRFX2); sensors.add(api,cfg); + #pragma message "GWBME28012 defined" } #endif #if defined(GWBME28021) { BME280Config *cfg=new BME280Config(api,PRFX3); sensors.add(api,cfg); + #pragma message "GWBME28021 defined" } #endif #if defined(GWBME28022) { BME280Config *cfg=new BME280Config(api,PRFX4); sensors.add(api,cfg); + #pragma message "GWBME28022 defined" } #endif } diff --git a/lib/iictask/GwIicTask.cpp b/lib/iictask/GwIicTask.cpp index 2fbb186..889d539 100644 --- a/lib/iictask/GwIicTask.cpp +++ b/lib/iictask/GwIicTask.cpp @@ -69,7 +69,7 @@ void runIicTask(GwApi *api){ { if (GWIIC_SDA < 0 || GWIIC_SCL < 0) { - LOG_DEBUG(GwLog::ERROR, "IIC 1 invalid config %d,%d", + LOG_DEBUG(GwLog::ERROR, "IIC 1 invalid config sda=%d,scl=%d", (int)GWIIC_SDA, (int)GWIIC_SCL); } else @@ -77,12 +77,14 @@ void runIicTask(GwApi *api){ bool rt = Wire.begin(GWIIC_SDA, GWIIC_SCL); if (!rt) { - LOG_DEBUG(GwLog::ERROR, "unable to initialize IIC 1 at %d,%d", + LOG_DEBUG(GwLog::ERROR, "unable to initialize IIC 1 at sad=%d,scl=%d", (int)GWIIC_SDA, (int)GWIIC_SCL); } else { buses[busId] = &Wire; + LOG_DEBUG(GwLog::ERROR, "initialized IIC 1 at sda=%d,scl=%d", + (int)GWIIC_SDA, (int)GWIIC_SCL); } } } @@ -91,7 +93,7 @@ void runIicTask(GwApi *api){ { if (GWIIC_SDA2 < 0 || GWIIC_SCL2 < 0) { - LOG_DEBUG(GwLog::ERROR, "IIC 2 invalid config %d,%d", + LOG_DEBUG(GwLog::ERROR, "IIC 2 invalid config sda=%d,scl=%d", (int)GWIIC_SDA2, (int)GWIIC_SCL2); } else @@ -100,12 +102,14 @@ void runIicTask(GwApi *api){ bool rt = Wire1.begin(GWIIC_SDA2, GWIIC_SCL2); if (!rt) { - LOG_DEBUG(GwLog::ERROR, "unable to initialize IIC 2 at %d,%d", + LOG_DEBUG(GwLog::ERROR, "unable to initialize IIC 2 at sda=%d,scl=%d", (int)GWIIC_SDA2, (int)GWIIC_SCL2); } else { buses[busId] = &Wire1; + LOG_DEBUG(GwLog::LOG, "initialized IIC 2 at sda=%d,scl=%d", + (int)GWIIC_SDA2, (int)GWIIC_SCL2); } } } @@ -129,7 +133,7 @@ void runIicTask(GwApi *api){ continue; } TwoWire *wire=bus->second; - bool rt=cfg->initDevice(api,&Wire); + bool rt=cfg->initDevice(api,wire); if (rt){ runLoop=true; timers.addAction(cfg->intv,[wire,api,cfg,counterId](){ diff --git a/lib/iictask/GwSHT3X.cpp b/lib/iictask/GwSHT3X.cpp index f4dc62e..3bda811 100644 --- a/lib/iictask/GwSHT3X.cpp +++ b/lib/iictask/GwSHT3X.cpp @@ -29,7 +29,7 @@ class SHT3XConfig : public SensorBase{ } virtual bool preinit(GwApi * api){ GwLog *logger=api->getLogger(); - LOG_DEBUG(GwLog::LOG,"SHT3X configured"); + LOG_DEBUG(GwLog::LOG,"%s configured",prefix.c_str()); api->addCapability(prefix,"true"); addHumidXdr(api,*this); addTempXdr(api,*this); @@ -46,7 +46,7 @@ class SHT3XConfig : public SensorBase{ double temp = device->cTemp; temp = CToKelvin(temp); double humid = device->humidity; - LOG_DEBUG(GwLog::DEBUG, "SHT3X measure temp=%2.1f, humid=%2.0f", (float)temp, (float)humid); + LOG_DEBUG(GwLog::DEBUG, "%s measure temp=%2.1f, humid=%2.0f",prefix.c_str(), (float)temp, (float)humid); if (huAct) { sendN2kHumidity(api, *this, humid, counterId); @@ -58,7 +58,7 @@ class SHT3XConfig : public SensorBase{ } else { - LOG_DEBUG(GwLog::DEBUG, "unable to query SHT3X: %d", rt); + LOG_DEBUG(GwLog::DEBUG, "unable to query %s: %d",prefix.c_str(), rt); } } /**