Skip to content

beginSPI and beginI2C call begin twice #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pbolduc opened this issue Oct 20, 2019 · 1 comment
Closed

beginSPI and beginI2C call begin twice #36

pbolduc opened this issue Oct 20, 2019 · 1 comment

Comments

@pbolduc
Copy link
Contributor

pbolduc commented Oct 20, 2019

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
pbolduc added a commit to pbolduc/SparkFun_BME280_Arduino_Library that referenced this issue Oct 20, 2019
AndyEngland521 added a commit that referenced this issue Oct 30, 2019
Avoid calling begin more than is required #36
@AndyEngland521
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants