Move address, bus and port to TelemetrySensor
This commit is contained in:
@@ -34,10 +34,7 @@ class PMSA003ISensor : public TelemetrySensor
|
||||
uint32_t pmMeasureStarted = 0;
|
||||
|
||||
uint8_t buffer[PMSA003I_FRAME_LENGTH]{};
|
||||
TwoWire *_bus{};
|
||||
uint8_t _address{};
|
||||
#ifdef PMSA003I_I2C_CLOCK_SPEED
|
||||
ScanI2C::I2CPort _port = ScanI2C::I2CPort::NO_I2C;
|
||||
ReClockI2C reClockI2C;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -13,10 +13,7 @@ class SCD30Sensor : public TelemetrySensor
|
||||
{
|
||||
private:
|
||||
SensirionI2cScd30 scd30;
|
||||
TwoWire *_bus{};
|
||||
uint8_t _address{};
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
ScanI2C::I2CPort _port = ScanI2C::I2CPort::NO_I2C;
|
||||
ReClockI2C reClockI2C;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -16,10 +16,7 @@ class SCD4XSensor : public TelemetrySensor
|
||||
{
|
||||
private:
|
||||
SensirionI2cScd4x scd4x;
|
||||
TwoWire *_bus{};
|
||||
uint8_t _address{};
|
||||
#ifdef SCD4X_I2C_CLOCK_SPEED
|
||||
ScanI2C::I2CPort _port = ScanI2C::I2CPort::NO_I2C;
|
||||
ReClockI2C reClockI2C;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -61,10 +61,7 @@ struct _SEN5XMeasurements {
|
||||
class SEN5XSensor : public TelemetrySensor
|
||||
{
|
||||
private:
|
||||
TwoWire *_bus{};
|
||||
uint8_t _address{};
|
||||
#ifdef SEN5X_I2C_CLOCK_SPEED
|
||||
ScanI2C::I2CPort _port = ScanI2C::I2CPort::NO_I2C;
|
||||
ReClockI2C reClockI2C;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -20,10 +20,7 @@ class SFA30Sensor : public TelemetrySensor
|
||||
uint32_t measureStarted = 0;
|
||||
|
||||
SensirionI2cSfa3x sfa30;
|
||||
TwoWire *_bus{};
|
||||
uint8_t _address{};
|
||||
#ifdef SFA30_I2C_CLOCK_SPEED
|
||||
ScanI2C::I2CPort _port = ScanI2C::I2CPort::NO_I2C;
|
||||
ReClockI2C reClockI2C;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -56,6 +56,11 @@ class TelemetrySensor
|
||||
}
|
||||
|
||||
const char *sensorName;
|
||||
// TODO: Rename?
|
||||
uint8_t _address = 0;
|
||||
TwoWire *_bus{};
|
||||
ScanI2C::I2CPort _port = ScanI2C::I2CPort::NO_I2C;
|
||||
|
||||
// TODO: delete after migration
|
||||
bool hasSensor() { return nodeTelemetrySensorsMap[sensorType].first > 0; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user