ClosedCube_SHT31D_Arduino icon indicating copy to clipboard operation
ClosedCube_SHT31D_Arduino copied to clipboard

Failure to return error in periodicFetchData function

Open rhudson2802 opened this issue 7 years ago • 1 comments

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

rhudson2802 avatar Sep 18 '18 13:09 rhudson2802