Skip to content

Commit 7c59917

Browse files
committed
Bugfix and push to v1.1.1
Remove unused pointer in example. Fix pointer logic in the begin function. This was the bug. Removed returns that could cause the begin function to return early. Rev library.properties to v1.1.1
1 parent 27aed74 commit 7c59917

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

examples/Example9_SensorType/Example9_SensorType.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ void setup()
4747
;
4848
}
4949

50-
scd4x_sensor_type_e* sensorType;
5150
char serialNumber[13];
5251
bool success = mySensor.getSerialNumber(serialNumber);
5352
Serial.print(F("Serial Number is: "));

src/SparkFun_SCD4x_Arduino_Library.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ bool SCD4x::begin(TwoWire &wirePort, bool measBegin, bool autoCalibrate, bool sk
4747

4848
char serialNumber[13]; // Serial number is 12 digits plus trailing NULL
4949
success &= getSerialNumber(serialNumber); // Read the serial number. Return false if the CRC check fails.
50-
if (success == false)
51-
return (false);
5250

5351
#if SCD4x_ENABLE_DEBUGLOG
5452
if (_printDebug == true)
@@ -60,12 +58,10 @@ bool SCD4x::begin(TwoWire &wirePort, bool measBegin, bool autoCalibrate, bool sk
6058

6159
if (pollAndSetDeviceType == true)
6260
{
63-
scd4x_sensor_type_e* sensorType;
64-
success &= determineSensorType(sensorType, serialNumber);
65-
if (success == false)
66-
return (false);
61+
scd4x_sensor_type_e sensorType;
62+
success &= determineSensorType(&sensorType, serialNumber);
6763

68-
setSensorType(*sensorType);
64+
setSensorType(sensorType);
6965

7066
#if SCD4x_ENABLE_DEBUGLOG
7167
if (_printDebug == true)

0 commit comments

Comments
 (0)