better handling of defined/enabled spi sensors
This commit is contained in:
parent
c7c5f6c9b9
commit
b327d91976
|
@ -322,11 +322,5 @@
|
||||||
#define CFGMODE_ledBrightness GwConfigInterface::HIDDEN
|
#define CFGMODE_ledBrightness GwConfigInterface::HIDDEN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GWSPI0_CLK
|
|
||||||
#define _GWSPI
|
|
||||||
#endif
|
|
||||||
#ifdef GWSPI1_CLK
|
|
||||||
#define _GWSPI
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -108,9 +108,9 @@ class GWDMS22B : public SSISensor{
|
||||||
using SSISensor::SSISensor;
|
using SSISensor::SSISensor;
|
||||||
virtual bool preinit(GwApi * api){
|
virtual bool preinit(GwApi * api){
|
||||||
GwLog *logger=api->getLogger();
|
GwLog *logger=api->getLogger();
|
||||||
LOG_DEBUG(GwLog::LOG,"DMS22B configured, prefix=%s, intv=%f",prefix.c_str(),fintv);
|
LOG_DEBUG(GwLog::LOG,"DMS22B configured, prefix=%s, intv=%f, active=%d",prefix.c_str(),fintv,(int)act);
|
||||||
api->addCapability(prefix,"true");
|
api->addCapability(prefix,"true");
|
||||||
return true;
|
return act;
|
||||||
}
|
}
|
||||||
virtual void measure(GwApi * api,BusType *bus, int counterId){
|
virtual void measure(GwApi * api,BusType *bus, int counterId){
|
||||||
GwLog *logger=api->getLogger();
|
GwLog *logger=api->getLogger();
|
||||||
|
|
|
@ -54,7 +54,6 @@ static const int spi1mosi=GWSPI1_MOSI;
|
||||||
static const int spi1mosi=-1;
|
static const int spi1mosi=-1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _GWSPI
|
|
||||||
void runSpiTask(GwApi *api){
|
void runSpiTask(GwApi *api){
|
||||||
GwLog *logger=api->getLogger();
|
GwLog *logger=api->getLogger();
|
||||||
std::map<int,SPIBus *> buses;
|
std::map<int,SPIBus *> buses;
|
||||||
|
@ -122,9 +121,6 @@ void runSpiTask(GwApi *api){
|
||||||
|
|
||||||
void initSpiTask(GwApi *api){
|
void initSpiTask(GwApi *api){
|
||||||
GwLog *logger=api->getLogger();
|
GwLog *logger=api->getLogger();
|
||||||
#ifndef _GWSPI
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
registerDMS22B(api,sensors);
|
registerDMS22B(api,sensors);
|
||||||
bool addTask=false;
|
bool addTask=false;
|
||||||
for (auto && sensor:sensors){
|
for (auto && sensor:sensors){
|
||||||
|
@ -134,6 +130,6 @@ void initSpiTask(GwApi *api){
|
||||||
api->addUserTask(runSpiTask,"spiTask",3000);
|
api->addUserTask(runSpiTask,"spiTask",3000);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
LOG_DEBUG(GwLog::LOG,"no SPI sensors defined");
|
LOG_DEBUG(GwLog::LOG,"no SPI sensors defined/active");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue