File tree Expand file tree Collapse file tree 3 files changed +28
-7
lines changed Expand file tree Collapse file tree 3 files changed +28
-7
lines changed Original file line number Diff line number Diff line change 13
13
expect-arduino-examples : true
14
14
# change to "update" once you published the driver on Arduino library registry
15
15
lint-lib-manager-check : submit
16
-
17
- code-generation-check :
18
- uses : sensirion/.github/.github/workflows/driver.generated.metadata_check.yml@main
19
16
Original file line number Diff line number Diff line change @@ -107,10 +107,22 @@ void loop() {
107
107
error = sensor.readMeasurement (co2Concentration, temperature,
108
108
relativeHumidity, sensorStatus);
109
109
if (error != NO_ERROR) {
110
- Serial.print (" Error trying to execute readMeasurement(): " );
110
+ // A failed read can be caused by clock shifting. We advise to retry
111
+ // after a delay of 150ms.
112
+ Serial.print (
113
+ " Error trying to execute readMeasurement() (retry in 150ms): " );
111
114
errorToString (error, errorMessage, sizeof errorMessage);
112
115
Serial.println (errorMessage);
113
- return ;
116
+ delay (150 );
117
+ error = sensor.readMeasurement (co2Concentration, temperature,
118
+ relativeHumidity, sensorStatus);
119
+ if (error != NO_ERROR) {
120
+ Serial.print (" Error trying to execute readMeasurement() after "
121
+ " additional delay: " );
122
+ errorToString (error, errorMessage, sizeof errorMessage);
123
+ Serial.println (errorMessage);
124
+ return ;
125
+ }
114
126
}
115
127
Serial.print (" co2Concentration: " );
116
128
Serial.print (co2Concentration);
Original file line number Diff line number Diff line change @@ -122,10 +122,22 @@ void loop() {
122
122
error = sensor.readMeasurement (co2Concentration, temperature,
123
123
relativeHumidity, status);
124
124
if (error != NO_ERROR) {
125
- Serial.print (" Error trying to execute readMeasurement(): " );
125
+ // A failed read can be caused by clock shifting. We advise to retry
126
+ // after a delay of 150ms.
127
+ Serial.print (
128
+ " Error trying to execute readMeasurement() (retry in 150ms): " );
126
129
errorToString (error, errorMessage, sizeof errorMessage);
127
130
Serial.println (errorMessage);
128
- return ;
131
+ delay (150 );
132
+ error = sensor.readMeasurement (co2Concentration, temperature,
133
+ relativeHumidity, status);
134
+ if (error != NO_ERROR) {
135
+ Serial.print (" Error trying to execute readMeasurement() after "
136
+ " additional delay: " );
137
+ errorToString (error, errorMessage, sizeof errorMessage);
138
+ Serial.println (errorMessage);
139
+ return ;
140
+ }
129
141
}
130
142
//
131
143
// Power down the sensor to reduce power consumption.
You can’t perform that action at this time.
0 commit comments