sparkfun/SparkFun_BME280_Arduino_Library

beginSPI and beginI2C call begin twice

pbolduc opened this issue · 1 comments

In functions beginSPI and beginI2C there are two calls to the begin function. The begin function has a 2 ms delay at the start to accommodate BME280 startup. When using a BME280, this introduces more delay that is required. Capturing the return value of begin and using it in the comparisons will eliminate the extra startup delay. PR will be submitted shortly.

Change

	if(begin() == 0x58) return(true); //Begin normal init with these settings. Should return chip ID of 0x58 for BMP
	if(begin() == 0x60) return(true); //Begin normal init with these settings. Should return chip ID of 0x60 for BME

to

	uint8_t chipID = begin();

	if(chipID == 0x58) return(true); //Begin normal init with these settings. Should return chip ID of 0x58 for BMP
	if(chipID == 0x60) return(true); //Begin normal init with these settings. Should return chip ID of 0x60 for BME

added pull request and released in v2.0.6. Thanks for your work!