Skip to content

Commit f98d42b

Browse files
committed
clang
1 parent 0b020d4 commit f98d42b

File tree

4 files changed

+27
-20
lines changed

4 files changed

+27
-20
lines changed

src/components/i2c/WipperSnapper_I2C.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,8 @@ void WipperSnapper_Component_I2C::update() {
13491349

13501350
// one fast pass for all drivers every update() call
13511351
for (auto *drv : drivers) {
1352-
if (drv) drv->fastTick();
1352+
if (drv)
1353+
drv->fastTick();
13531354
}
13541355

13551356
long curTime;

src/components/i2c/drivers/WipperSnapper_I2C_Driver.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ class WipperSnapper_I2C_Driver {
5757
/*!
5858
@brief Per-update background hook for drivers that need faster internal
5959
sampling than the user publish interval.
60-
Default is a no-op; override in concrete drivers (e.g., SGP30/40)
61-
to maintain required ~1 Hz reads and accumulate/condition
62-
values for later publish.
60+
Default is a no-op; override in concrete drivers (e.g.,
61+
SGP30/40) to maintain required ~1 Hz reads and accumulate/condition values
62+
for later publish.
6363
@note Call site: WipperSnapper_Component_I2C::update() will invoke
6464
this once per loop for each driver. Implementations must be
6565
non-blocking (do not delay); use millis()-based timing.
@@ -1413,8 +1413,8 @@ class WipperSnapper_I2C_Driver {
14131413
long _ambientTempFPeriod = 0L; ///< The time period between reading the
14141414
///< ambient temp. (°F) sensor's value.
14151415
long _ambientTempFPeriodPrv =
1416-
PERIOD_24HRS_AGO_MILLIS; ///< The time when the ambient temp. (°F) sensor
1417-
///< was last read.
1416+
PERIOD_24HRS_AGO_MILLIS; ///< The time when the ambient temp. (°F) sensor
1417+
///< was last read.
14181418
long _objectTempFPeriod = 0L; ///< The time period between reading the object
14191419
///< temp. (°F) sensor's value.
14201420
long _objectTempFPeriodPrv =

src/components/i2c/drivers/WipperSnapper_I2C_Driver_SGP30.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,31 @@ class WipperSnapper_I2C_Driver_SGP30 : public WipperSnapper_I2C_Driver {
4949
bool begin() {
5050
_sgp30 = new Adafruit_SGP30();
5151
if (!_sgp30->begin(_i2c)) {
52-
delete _sgp30; // avoid leak on init failure
52+
delete _sgp30; // avoid leak on init failure
5353
_sgp30 = nullptr;
5454
return false;
5555
}
56-
_sgp30->IAQinit(); // start IAQ algorithm
56+
_sgp30->IAQinit(); // start IAQ algorithm
5757
_lastFastMs = millis(); // reset fast sampler
5858
_n = _eco2Sum = _tvocSum = 0; // clear accumulators
5959
return true;
6060
}
6161

6262
bool getEventECO2(sensors_event_t *senseEvent) override {
63-
if (!_sgp30) return false;
63+
if (!_sgp30)
64+
return false;
6465
bool ok = _sgp30->IAQmeasure();
65-
if (ok) senseEvent->eCO2 = _sgp30->eCO2;
66+
if (ok)
67+
senseEvent->eCO2 = _sgp30->eCO2;
6668
return ok;
6769
}
6870

6971
bool getEventTVOC(sensors_event_t *senseEvent) override {
70-
if (!_sgp30) return false;
72+
if (!_sgp30)
73+
return false;
7174
bool ok = _sgp30->IAQmeasure();
72-
if (ok) senseEvent->tvoc = _sgp30->TVOC;
75+
if (ok)
76+
senseEvent->tvoc = _sgp30->TVOC;
7377
return ok;
7478
}
7579

@@ -79,16 +83,15 @@ class WipperSnapper_I2C_Driver_SGP30 : public WipperSnapper_I2C_Driver {
7983
uint32_t now = millis();
8084
if (now - _lastFastMs >= 1000) { // ~1 Hz cadence
8185
if (_sgp30 && _sgp30->IAQmeasure()) {
82-
_eco2Sum += _sgp30->eCO2; // uint16_t in library
83-
_tvocSum += _sgp30->TVOC; // uint16_t in library
86+
_eco2Sum += _sgp30->eCO2; // uint16_t in library
87+
_tvocSum += _sgp30->TVOC; // uint16_t in library
8488
_n++;
8589
}
8690
_lastFastMs = now;
8791
}
8892
}
8993

9094
protected:
91-
9295
Adafruit_SGP30 *_sgp30; ///< Pointer to SGP30 sensor object
9396

9497
// Fast sampling state

src/components/i2c/drivers/WipperSnapper_I2C_Driver_SGP40.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ class WipperSnapper_I2C_Driver_SGP40 : public WipperSnapper_I2C_Driver {
8787
*/
8888
/*******************************************************************************/
8989
bool getEventRaw(sensors_event_t *rawEvent) override {
90-
if (!_sgp40) return false;
90+
if (!_sgp40)
91+
return false;
9192
if (_n > 0) {
9293
rawEvent->data[0] = (float)_rawSum / (float)_n;
9394
_rawSum = 0;
@@ -109,7 +110,8 @@ class WipperSnapper_I2C_Driver_SGP40 : public WipperSnapper_I2C_Driver {
109110
*/
110111
/*******************************************************************************/
111112
bool getEventVOCIndex(sensors_event_t *vocIndexEvent) override {
112-
if (!_sgp40) return false;
113+
if (!_sgp40)
114+
return false;
113115
if (_n > 0) {
114116
vocIndexEvent->voc_index = _vocSum / (float)_n;
115117
_rawSum = 0;
@@ -129,8 +131,10 @@ class WipperSnapper_I2C_Driver_SGP40 : public WipperSnapper_I2C_Driver {
129131
*/
130132
/*******************************************************************************/
131133
void fastTick() override {
132-
if (!_sgp40) return;
133-
if (!vocEnabled()) return;
134+
if (!_sgp40)
135+
return;
136+
if (!vocEnabled())
137+
return;
134138

135139
uint32_t now = millis();
136140
if (now - _lastFastMs >= 1000) {
@@ -142,7 +146,6 @@ class WipperSnapper_I2C_Driver_SGP40 : public WipperSnapper_I2C_Driver {
142146
}
143147

144148
protected:
145-
146149
Adafruit_SGP40 *_sgp40; ///< SGP40
147150
// background accumulation state
148151
uint32_t _lastFastMs = 0;

0 commit comments

Comments
 (0)