1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-14 06:23:07 +01:00

intermediate: restructure SHT3X

This commit is contained in:
andreas
2024-11-19 19:33:18 +01:00
parent 0200352f91
commit 0b565cfdc7
6 changed files with 48 additions and 75 deletions

View File

@@ -47,12 +47,8 @@ class SensorBase{
virtual void readConfig(GwConfigHandler *cfg)=0;
};
template<typename BUS,SensorBase::BusType bt,typename Sensor>
template<typename BUS,SensorBase::BusType bt>
class SensorTemplate : public SensorBase{
public:
using ConfigReader=std::function<bool(Sensor *,GwConfigHandler *)>;
protected:
ConfigReader configReader;
public:
SensorTemplate(GwApi *api,const String &prfx)
:SensorBase(bt,api,prfx){}
@@ -65,16 +61,6 @@ class SensorTemplate : public SensorBase{
if (busType != bt) return;
measure(api,(BUS*)bus,counterId);
};
virtual void setConfigReader(ConfigReader r){
configReader=r;
}
protected:
bool configFromReader(Sensor *s, GwConfigHandler *cfg){
if (configReader){
return configReader(s,cfg);
}
return false;
}
};