Handle requests using timestamps#222
Merged
milesburton merged 1 commit intomilesburton:masterfrom Jul 5, 2022
Merged
Conversation
Changes the return types of a few functions to pass along a timestamp to blockTillConversionComplete A few overloads are added to blockTillConversionComplete Example usage: sensors.setWaitForConversion(false); DallasTemperature::result_t request = sensors.requestTemperatures(); sensors.blockTillConversionComplete(sensors.getResolution(), request); or sensors.blockTillConversionComplete(sensors.getResolution(), request.timestamp);
e8053ca to
8004027
Compare
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes the return types of a few functions to pass along a timestamp to
blockTillConversionComplete.A few overloads are added to
blockTillConversionComplete.Example usage:
Note: The struct isn't strictly necessary. I figured I should make each request function return the same struct to avoid confusion.
requestTemperatures()could easily return just anunsigned long. I added a conversion operator to bool so that on the off chance anyone is using an older library their usage shouldn't break, I left the bool first for any binary compatibility issues for similar reasons. I'm not particularly happy with how longDallasTemperature::request_tis compared tounsigned long. I was consideringresult_toverrequest_t, but that's simple enough to change and obviously feel free to edit.I added one new overload for the new request type which isn't strictly needed, but I figured would be nice to have / a good example of how the request struct can be used. It specifically handles the case where the request struct indicates the probe was disconnected when the request was made to avoid any unnecessary wait.