Skip to content

Commit 77685bd

Browse files
committed
Removing extraneous Wire reads. Issue 4
1 parent 82b11d8 commit 77685bd

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/SparkFunCCS811.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ CCS811Core::status CCS811Core::beginCore(void)
7070
temp++;
7171
}
7272

73-
while ( Wire.available() ) //Clear wire as a precaution
74-
{
75-
Wire.read();
76-
}
77-
7873
//Check the ID register to determine if the operation was a success.
7974
uint8_t readCheck;
8075
readCheck = 0;
@@ -162,11 +157,6 @@ CCS811Core::status CCS811Core::multiReadRegister(uint8_t offset, uint8_t *output
162157
outputPointer++;
163158
i++;
164159
}
165-
//dump extra
166-
while(Wire.available())
167-
{
168-
Wire.read();
169-
}
170160
}
171161

172162

@@ -268,6 +258,7 @@ CCS811Core::status CCS811::begin( void )
268258
//Tclk = 1/16MHz = 0x0000000625
269259
//0.001 s / tclk = 16000 counts
270260
volatile uint8_t temp = 0;
261+
271262
#ifdef ARDUINO_ARCH_ESP32
272263
for( uint32_t i = 0; i < 80000; i++ ) //This waits > 1ms @ 80MHz clock
273264
{
@@ -284,6 +275,7 @@ CCS811Core::status CCS811::begin( void )
284275
temp++;
285276
}
286277
#endif
278+
287279
if( checkForStatusError() == true ) return SENSOR_INTERNAL_ERROR;
288280

289281
if( appValid() == false ) return SENSOR_INTERNAL_ERROR;

0 commit comments

Comments
 (0)