Skip to content

New Pressure Unit - #768

Merged
krwq merged 72 commits into
dotnet:masterfrom
MarkCiliaVincenti:MeanSeaLevelPressure
Oct 8, 2019
Merged

krwq merged 72 commits into
dotnet:masterfrom
MarkCiliaVincenti:MeanSeaLevelPressure

Conversation

@MarkCiliaVincenti

@MarkCiliaVincenti MarkCiliaVincenti commented Oct 5, 2019 •

Copy link
Copy Markdown
Contributor
  • Created new structure Pressure
  • Includes static value for Mean Sea-Level Pressure (MSLP) (1013.25 hPa)
  • Updated Bmxx80 (including BMP180), LPS25H and SenseHat to use this new unit, which breaks existing code since the return type is now Pressure.

@dnfclas

dnfclas commented Oct 5, 2019 •

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@MarkCiliaVincenti

Copy link
Copy Markdown
Contributor Author

With reference to #752

Comment thread src/devices/Units/Pressure.cs Resolved
Comment thread src/devices/Units/Pressure.cs Resolved
@MarkCiliaVincenti

MarkCiliaVincenti commented Oct 6, 2019 •

Copy link
Copy Markdown
Contributor Author

The changes in this pull request are now breaking existing code using Bmxx80 pressure readings, due to the implementation of a Pressure struct that works like the Temperature one.

@MarkCiliaVincenti

Copy link
Copy Markdown
Contributor Author

@MarkCiliaVincenti Hectopascal sounds correct to me then (in my mind it's still two words though 😄)

Great! OK for merge now?

Comment thread src/devices/Bmp180/Bmp180.cs Resolved
@krwq
krwq merged commit c1f4bf0 into dotnet:master Oct 8, 2019
@MarkCiliaVincenti
MarkCiliaVincenti deleted the MeanSeaLevelPressure branch October 8, 2019 07:08
@MarkCiliaVincenti

Copy link
Copy Markdown
Contributor Author

Cheers!

@MarkCiliaVincenti

Copy link
Copy Markdown
Contributor Author

@MarkCiliaVincenti

Copy link
Copy Markdown
Contributor Author

@krwq

krwq commented Oct 8, 2019 •

Copy link
Copy Markdown
Member

@MarkCiliaVincenti good point, We should add some comment under the article clarifying the difference or make a tiny change if possible to use older package version which still has the old API. Fortunately this difference is relatively small and rather straight forward to fix and actually makes code cleaner. Perhaps we should consider adding more units we're likely going to add anyway in the future...

@krwq

krwq commented Oct 8, 2019

Copy link
Copy Markdown
Member

FYI: @joperezr I created the label to track these kind of changes in case we need to document them

@joperezr

Copy link
Copy Markdown
Member

@krwq I just saw this. Instead of breaking, should we just add a new overload that returns the new type instead of double? I would really like to minimize breaking-changes even for the device bindings when possible, and this case seems like it is something that could easily be avoided with a new overload

@krwq

krwq commented Nov 13, 2019

Copy link
Copy Markdown
Member

@joperezr I'm fine with that if the old API has units in the name (which I don't think it does). If not I'd go with the breaking change on this one but I'm ok with doing that if I'm outvoted

@MarkCiliaVincenti

Copy link
Copy Markdown
Contributor Author

I don't see how you could do this without breaking, otherwise it will be messy. There's a unit for Temperature and all methods return an instance of Temperature. Pressure was missing a unit, which it now has, and is consistent with Temperature.

It's been merged a while ago now, so either way it's going to break either for those who are on stable or the ones who are on prerelease who have already adapted their code for this PR.

Furthermore there are other PRs which are dependent on this, such as the WeatherHelper.

@krwq

krwq commented Nov 14, 2019

Copy link
Copy Markdown
Member

I agree with the "will be messy" part. I think this one is worth to make a breaking change for consistency. What we can consider though is perhaps making Pressure be implicitly convertible to double with whatever unit we used before (hPa?)

@github-actions github-actions Bot locked and limited conversation to collaborators Dec 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants