adafruit / Adafruit_AS7341

Other
29 stars 18 forks source link

millis() is unsigned long #22

Closed jrw429 closed 1 year ago

jrw429 commented 1 year ago

Need to cast variable to be compatible with Arduino millis in Adafruit_AS7341::delayForData.

jrw429 commented 1 year ago

Sorry, should have made a separate branch for pull request. It is putting all my commits into the pull request.

caternuson commented 1 year ago

Sign might potentially be used in the future: https://github.com/adafruit/Adafruit_AS7341/blob/e62011db6d15cab6748b78c44d3296b6352c6fe3/Adafruit_AS7341.cpp#L249C9-L251

What issues is the current parameter type causing?

jrw429 commented 1 year ago

It is not causing any problem I'm aware of. However, I compile with -Wall and this was shown as a warning. It is fine to keep it as a signed int and change "elapsedMillis < waitTime" to "elapsedMillis < (uint32_t)waitTime". That gets rid of the warning, explicitly says we know what we are doing, and retains the future use of negative values.

caternuson commented 1 year ago

Oh, OK, I see in the PR better what's going on. Just need a local explicit cast in a conditional. Originally thought the suggestion was to change the parameter type in the function itself.

caternuson commented 1 year ago

Closing. Fixed with #23.