Skip to content
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

Failure to return error in periodicFetchData function #5

Open
rhudson2802 opened this issue Sep 18, 2018 · 1 comment · May be fixed by #7
Open

Failure to return error in periodicFetchData function #5

rhudson2802 opened this issue Sep 18, 2018 · 1 comment · May be fixed by #7

Comments

@rhudson2802
Copy link

Hi,
I believe there is a return statement in periodicFetchData. The existing code is:

SHT31D ClosedCube_SHT31D::periodicFetchData()
{
	SHT31D_ErrorCode error = writeCommand(SHT3XD_CMD_FETCH_DATA);
	if (error == SHT3XD_NO_ERROR)
		return readTemperatureAndHumidity();
	else
		returnError(error);
}

I was trying to use this function however it would not return an error if error != 0. I managed to fix the issue by changing the else statement to

return returnError(error)

As returnError only returns a value to periodicFetchData, and does not get passed anywhere else in the program.

Thanks

@pilotak pilotak linked a pull request Jun 23, 2019 that will close this issue
@BugerDread
Copy link

I was trying to use this function however it would not return an error if error != 0. I managed to fix the issue by changing the else statement to

return returnError(error)

As returnError only returns a value to periodicFetchData, and does not get passed anywhere else in the program.

Thanks

This also fix the error when compiling on ESP8266 core 3.1.1

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

Successfully merging a pull request may close this issue.

2 participants