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

compiler warning: #85

Closed
coelner opened this issue Apr 2, 2018 · 4 comments
Closed

compiler warning: #85

coelner opened this issue Apr 2, 2018 · 4 comments

Comments

@coelner
Copy link
Contributor

coelner commented Apr 2, 2018

Expected behavior

return a bool from:

  • bool BME280::InitializeFilter()
  • bool BME280::WriteSettings()

Actual behavior

/Arduino/libraries/BME280/src/BME280.cpp: In member function 'bool BME280::InitializeFilter()':
/Arduino/libraries/BME280/src/BME280.cpp:85:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
/Arduino/libraries/BME280/src/BME280.cpp: In member function 'bool BME280::WriteSettings()':
/Arduino/libraries/BME280/src/BME280.cpp:122:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }

Steps to reporduce the behavior

compile the master branch

suggested solution

bool BME280::InitializeFilter()

  1. read Data from Sensor to get individual boot up values
  2. Write Settings
  3. read Data from Sensor to get current values
  4. compare them

bool BME280::WriteSettings()
0. Write Settings

  1. read Settings
  2. compare them
  3. return result

-- OR --
return the return value from used I2C functions

@bertrik
Copy link

bertrik commented Aug 7, 2018

Please fix this, either doing complicated stuff like write-read-compare (as suggested here), or just return true (like in my pull request). The best compromise may be to simply return the i2c result, as a bool (success or not). I'm a bit surprised actually that something like this is classified by Arduino as a compile warning, I would consider this a hard error because currently the result is completely undefined.

@finitespace
Copy link
Owner

Thank you for bring this to my attention @coelner. I have been extremely busy recently and haven't had time to look into this. My apologies. I will try to look at this tonight.

@bertrik the proper value needs to be returned or the function needs to be changed to void. I will take a look and see which is appropriate in this situation.

Regards,
@finitespace

@finitespace
Copy link
Owner

finitespace commented Feb 24, 2021

#117 is a duplicate, which I realized later, I have a new branch 117-non-void-return (or something like that)

@coelner @bertrik @atar-axis could one of you (or anyone else) test this branch, I don't have hardware right now, on biz trip. If it works as intended, then I will release 3.0.0. Finally! I need to pay attention to you guys more often. :)

@finitespace
Copy link
Owner

#121

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

3 participants