better handling of defined/enabled spi sensors

This commit is contained in:
andreas 2024-03-03 16:48:11 +01:00
parent c7c5f6c9b9
commit b327d91976
3 changed files with 3 additions and 13 deletions

View File

@ -322,11 +322,5 @@
#define CFGMODE_ledBrightness GwConfigInterface::HIDDEN
#endif
#ifdef GWSPI0_CLK
#define _GWSPI
#endif
#ifdef GWSPI1_CLK
#define _GWSPI
#endif
#endif

View File

@ -108,9 +108,9 @@ class GWDMS22B : public SSISensor{
using SSISensor::SSISensor;
virtual bool preinit(GwApi * api){
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");
return true;
return act;
}
virtual void measure(GwApi * api,BusType *bus, int counterId){
GwLog *logger=api->getLogger();

View File

@ -54,7 +54,6 @@ static const int spi1mosi=GWSPI1_MOSI;
static const int spi1mosi=-1;
#endif
#define _GWSPI
void runSpiTask(GwApi *api){
GwLog *logger=api->getLogger();
std::map<int,SPIBus *> buses;
@ -122,9 +121,6 @@ void runSpiTask(GwApi *api){
void initSpiTask(GwApi *api){
GwLog *logger=api->getLogger();
#ifndef _GWSPI
return;
#endif
registerDMS22B(api,sensors);
bool addTask=false;
for (auto && sensor:sensors){
@ -134,6 +130,6 @@ void initSpiTask(GwApi *api){
api->addUserTask(runSpiTask,"spiTask",3000);
}
else{
LOG_DEBUG(GwLog::LOG,"no SPI sensors defined");
LOG_DEBUG(GwLog::LOG,"no SPI sensors defined/active");
}
}