mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-14 06:23:07 +01:00
restructure SensorBase
This commit is contained in:
@@ -33,8 +33,8 @@ class BMP280Config : public IICSensorBase{
|
||||
float prOff=0;
|
||||
Adafruit_BMP280 *device=nullptr;
|
||||
uint32_t sensorId=-1;
|
||||
BMP280Config(GwApi * api, const String &prfx):SensorBase(TYPE,api,prfx){
|
||||
}
|
||||
BMP280Config(GwApi * api, const String &prfx):IICSensorBase(TYPE,api,prfx){
|
||||
}
|
||||
virtual bool isActive(){return prAct||tmAct;}
|
||||
virtual bool initDevice(GwApi *api,TwoWire *wire){
|
||||
GwLog *logger=api->getLogger();
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
class TwoWire;
|
||||
#endif
|
||||
|
||||
using BusType=TwoWire;
|
||||
using IICSensorList=SensorList<BusType>;
|
||||
using IICSensorBase=SensorBase<BusType>;
|
||||
using BUSTYPE=TwoWire;
|
||||
using IICSensorList=SensorList;
|
||||
using IICSensorBase=SensorTemplate<BUSTYPE,SensorBase::IIC>;
|
||||
|
||||
|
||||
template <class CFG>
|
||||
|
||||
@@ -184,8 +184,8 @@ void runIicTask(GwApi *api){
|
||||
bool runLoop=false;
|
||||
GwIntervalRunner timers;
|
||||
int counterId=api->addCounter("iicsensors");
|
||||
for (auto it=sensors.begin();it != sensors.end();it++){
|
||||
IICSensorBase *cfg=*it;
|
||||
for (auto &&cfg:sensors){
|
||||
if (cfg->busType != SensorBase::IIC) continue;
|
||||
auto bus=buses.find(cfg->busId);
|
||||
if (! cfg->isActive()) continue;
|
||||
if (bus == buses.end()){
|
||||
|
||||
Reference in New Issue
Block a user