File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
src/components/i2c/drivers Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -95,10 +95,12 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver {
9595 return false ;
9696 }
9797
98- if (_scd->getEvent (&_humidity, &_temperature )) {
98+ if (! _scd->read ( )) {
9999 return false ;
100100 }
101- _CO2.CO2 = _scd->CO2 ;
101+ _CO2 = _scd->CO2 ;
102+ _humidity = _scd->relative_humidity ;
103+ _temperature = _scd->temperature ;
102104 _lastRead = millis ();
103105 return true ;
104106 }
@@ -118,7 +120,7 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver {
118120 return false ;
119121 }
120122
121- tempEvent = & _temperature;
123+ tempEvent-> temperature = _temperature;
122124 return true ;
123125 }
124126
@@ -137,7 +139,7 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver {
137139 return false ;
138140 }
139141
140- humidEvent = & _humidity;
142+ humidEvent-> relative_humidity = _humidity;
141143 return true ;
142144 }
143145
@@ -156,16 +158,16 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver {
156158 return false ;
157159 }
158160
159- co2Event = & _CO2;
161+ co2Event-> CO2 = _CO2;
160162 return true ;
161163 }
162164
163165protected:
164166 Adafruit_SCD30 *_scd = nullptr ; // /< SCD30 driver object
165167 ulong _lastRead = 0 ; // /< Last time the sensor was read
166- sensors_event_t _temperature; // /< Temperature
167- sensors_event_t _humidity; // /< Relative Humidity
168- sensors_event_t _CO2; // /< CO2
168+ float _temperature; // /< Temperature
169+ float _humidity; // /< Relative Humidity
170+ float _CO2; // /< CO2
169171};
170172
171173#endif // WipperSnapper_I2C_Driver_SCD30
Original file line number Diff line number Diff line change @@ -120,7 +120,6 @@ class WipperSnapper_I2C_Driver_SCD4X : public WipperSnapper_I2C_Driver {
120120 return false ;
121121 }
122122
123-
124123 // Read SCD4x measurement
125124 uint16_t error = _scd->readMeasurement (_co2, _temperature, _humidity);
126125 if (error != 0 || _co2 == 0 ) {
@@ -190,8 +189,8 @@ class WipperSnapper_I2C_Driver_SCD4X : public WipperSnapper_I2C_Driver {
190189protected:
191190 SensirionI2CScd4x *_scd = nullptr ; // /< SCD4x driver object
192191 uint16_t _co2 = 0 ; // /< SCD4x co2 reading
193- float _temperature = 20 .0f ; // /< SCD4x temperature reading
194- float _humidity = 50 .0f ; // /< SCD4x humidity reading
192+ float _temperature = 20 .0f ; // /< SCD4x temperature reading
193+ float _humidity = 50 .0f ; // /< SCD4x humidity reading
195194 ulong _lastRead = 0 ; // /< Last time the sensor was read
196195};
197196
You can’t perform that action at this time.
0 commit comments