File tree Expand file tree Collapse file tree 2 files changed +24
-10
lines changed
src/components/i2c/drivers Expand file tree Collapse file tree 2 files changed +24
-10
lines changed Original file line number Diff line number Diff line change @@ -95,13 +95,18 @@ class WipperSnapper_I2C_Driver_SGP30 : public WipperSnapper_I2C_Driver {
95
95
Adafruit_SGP30 *_sgp30; // /< Pointer to SGP30 sensor object
96
96
97
97
// Fast sampling state
98
- uint32_t _lastFastMs = 0 ;
99
- uint32_t _n = 0 ;
100
- uint32_t _eco2Sum = 0 ;
101
- uint32_t _tvocSum = 0 ;
98
+ uint32_t _lastFastMs = 0 ; // /< Millis timestamp of last 1 Hz background read.
99
+ uint32_t _n = 0 ; // /< Number of samples accumulated since last publish.
100
+ uint32_t _eco2Sum = 0 ; // /< Running sum of eCO2 samples for averaging.
101
+ uint32_t _tvocSum = 0 ; // /< Running sum of TVOC samples for averaging.
102
102
103
+ /* ******************************************************************************/
104
+ /* !
105
+ @brief Returns whether IAQ background sampling should be active.
106
+ @return True if either eCO2 or TVOC metrics are configured to publish.
107
+ */
108
+ /* ******************************************************************************/
103
109
inline bool iaqEnabled () {
104
- // Enable IAQ background reads if either metric is requested
105
110
return (getSensorECO2Period () > 0 ) || (getSensorTVOCPeriod () > 0 );
106
111
}
107
112
};
Original file line number Diff line number Diff line change @@ -147,13 +147,22 @@ class WipperSnapper_I2C_Driver_SGP40 : public WipperSnapper_I2C_Driver {
147
147
148
148
protected:
149
149
Adafruit_SGP40 *_sgp40; // /< SGP40
150
+
150
151
// background accumulation state
151
- uint32_t _lastFastMs = 0 ;
152
- uint32_t _n = 0 ;
153
- float _vocSum = 0 .0f ;
154
- uint32_t _rawSum = 0 ;
152
+ uint32_t _lastFastMs = 0 ; // /< Millis timestamp of last 1 Hz background read.
153
+ uint32_t _n = 0 ; // /< Number of samples accumulated since last publish.
154
+ float _vocSum = 0 .0f ; // /< Running sum of VOC Index samples for averaging.
155
+ uint32_t _rawSum = 0 ; // /< Running sum of raw SGP40 samples for averaging.
155
156
156
- // enable fast sampling if either output is requested
157
+ /* ******************************************************************************/
158
+ /* !
159
+ @brief Returns whether VOC background sampling should be active.
160
+ @return True if either VOC Index or raw metrics are configured to publish.
161
+ */
162
+ /* ******************************************************************************/
163
+ inline bool vocEnabled () {
164
+ return (getSensorVOCIndexPeriod () > 0 ) || (getSensorRawPeriod () > 0 );
165
+ }
157
166
inline bool vocEnabled () {
158
167
return (getSensorVOCIndexPeriod () > 0 ) || (getSensorRawPeriod () > 0 );
159
168
}
You can’t perform that action at this time.
0 commit comments