Skip to content

Commit 8ee25a5

Browse files
committed
format SCD30
1 parent 4eb816e commit 8ee25a5

File tree

1 file changed

+14
-28
lines changed

1 file changed

+14
-28
lines changed

src/components/i2c/drivers/WipperSnapper_I2C_Driver_SCD30.h

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
@brief Class that provides a driver interface for the SCD30 sensor.
2525
*/
2626
/**************************************************************************/
27-
class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver
28-
{
27+
class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver {
2928

3029
public:
3130
/*******************************************************************************/
@@ -38,8 +37,7 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver
3837
*/
3938
/*******************************************************************************/
4039
WipperSnapper_I2C_Driver_SCD30(TwoWire *i2c, uint16_t sensorAddress)
41-
: WipperSnapper_I2C_Driver(i2c, sensorAddress)
42-
{
40+
: WipperSnapper_I2C_Driver(i2c, sensorAddress) {
4341
_i2c = i2c;
4442
_sensorAddress = sensorAddress;
4543
}
@@ -50,8 +48,7 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver
5048
@returns True if initialized successfully, False otherwise.
5149
*/
5250
/*******************************************************************************/
53-
bool begin()
54-
{
51+
bool begin() {
5552
_scd = new Adafruit_SCD30();
5653
return _scd->begin((uint8_t)_sensorAddress, _i2c);
5754
}
@@ -62,26 +59,21 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver
6259
@returns True if the sensor was read successfully, False otherwise.
6360
*/
6461
/*******************************************************************************/
65-
bool readSensor()
66-
{
62+
bool readSensor() {
6763
// dont read sensor more than once per second
68-
if (_lastRead != 0 && millis() - _lastRead < 1000)
69-
{
64+
if (_lastRead != 0 && millis() - _lastRead < 1000) {
7065
return true;
7166
}
7267

73-
if (!_scd->dataReady())
74-
{
68+
if (!_scd->dataReady()) {
7569
delay(100);
76-
if (!_scd->dataReady())
77-
{
70+
if (!_scd->dataReady()) {
7871
return false;
7972
}
8073
}
8174
sensors_event_t tempEvent;
8275
sensors_event_t humidEvent;
83-
if (!_scd->getEvent(&humidEvent, &tempEvent))
84-
{
76+
if (!_scd->getEvent(&humidEvent, &tempEvent)) {
8577
return false;
8678
}
8779
_temperature = tempEvent.temperature;
@@ -100,11 +92,9 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver
10092
otherwise.
10193
*/
10294
/*******************************************************************************/
103-
bool getEventAmbientTemp(sensors_event_t *tempEvent)
104-
{
95+
bool getEventAmbientTemp(sensors_event_t *tempEvent) {
10596
// check if sensor is enabled and data is available
106-
if (!readSensor())
107-
{
97+
if (!readSensor()) {
10898
return false;
10999
}
110100

@@ -121,11 +111,9 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver
121111
otherwise.
122112
*/
123113
/*******************************************************************************/
124-
bool getEventRelativeHumidity(sensors_event_t *humidEvent)
125-
{
114+
bool getEventRelativeHumidity(sensors_event_t *humidEvent) {
126115
// check if sensor is enabled and data is available
127-
if (!readSensor())
128-
{
116+
if (!readSensor()) {
129117
return false;
130118
}
131119

@@ -142,11 +130,9 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver
142130
otherwise.
143131
*/
144132
/*******************************************************************************/
145-
bool getEventCO2(sensors_event_t *co2Event)
146-
{
133+
bool getEventCO2(sensors_event_t *co2Event) {
147134
// check if sensor is enabled and data is available
148-
if (!readSensor())
149-
{
135+
if (!readSensor()) {
150136
return false;
151137
}
152138

0 commit comments

Comments
 (0)