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 {
95
95
return false ;
96
96
}
97
97
98
- if (_scd->getEvent (&_humidity, &_temperature )) {
98
+ if (! _scd->read ( )) {
99
99
return false ;
100
100
}
101
- _CO2.CO2 = _scd->CO2 ;
101
+ _CO2 = _scd->CO2 ;
102
+ _humidity = _scd->relative_humidity ;
103
+ _temperature = _scd->temperature ;
102
104
_lastRead = millis ();
103
105
return true ;
104
106
}
@@ -118,7 +120,7 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver {
118
120
return false ;
119
121
}
120
122
121
- tempEvent = & _temperature;
123
+ tempEvent-> temperature = _temperature;
122
124
return true ;
123
125
}
124
126
@@ -137,7 +139,7 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver {
137
139
return false ;
138
140
}
139
141
140
- humidEvent = & _humidity;
142
+ humidEvent-> relative_humidity = _humidity;
141
143
return true ;
142
144
}
143
145
@@ -156,16 +158,16 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver {
156
158
return false ;
157
159
}
158
160
159
- co2Event = & _CO2;
161
+ co2Event-> CO2 = _CO2;
160
162
return true ;
161
163
}
162
164
163
165
protected:
164
166
Adafruit_SCD30 *_scd = nullptr ; // /< SCD30 driver object
165
167
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
169
171
};
170
172
171
173
#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 {
120
120
return false ;
121
121
}
122
122
123
-
124
123
// Read SCD4x measurement
125
124
uint16_t error = _scd->readMeasurement (_co2, _temperature, _humidity);
126
125
if (error != 0 || _co2 == 0 ) {
@@ -190,8 +189,8 @@ class WipperSnapper_I2C_Driver_SCD4X : public WipperSnapper_I2C_Driver {
190
189
protected:
191
190
SensirionI2CScd4x *_scd = nullptr ; // /< SCD4x driver object
192
191
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
195
194
ulong _lastRead = 0 ; // /< Last time the sensor was read
196
195
};
197
196
You can’t perform that action at this time.
0 commit comments