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
3029public:
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