-
-
Notifications
You must be signed in to change notification settings - Fork 324
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
Support SG on BierBot Bricks #559
Conversation
If iSpindel transmits SG (and not °P) 1 decimal (1.0, `round(x*10)/10`) is not sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit changes decimal point of gravity measurement sent to BierBot bricks to support SG and has no effect on the rest of the firmware.
4 decimals in SG can be a bit of overshoot. |
That's one more than actually needed to be able to round backend-wise and enable data freshness checks. I'm happy to change it if really necessary. But IMHO it should not hinder the merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change corrects a defect that allows bierbots to use Plato or SG. Does not impact anything other than number of decimal places transmitted
API_BRICKS seems to be the only API that does this. It this truncation needed at all? |
I'm personally a fan of a deterministic memory footprint in non-garbage collected environments and deterministic POST payloads. But: I don't want to force other APIs to follow this approach. Is a discussion about one decimal more or less really worth our time? I would really appreciate if we come to an agreement :) If that's the only concern hindering the merge, I'm happy to change it to avoid further waste of time and energy on all sides. |
This discussion at least can help to save this pull request from the stale bot's shredder :) Apparently, you haven't looked at these things from this point of view :) |
hehe, that's indeed correct. So how do we proceed? Can someone with the necessary rights to merge a PR make a clear statement ("remove truncation"/ "truncation to three decimals is fine" / "trundcation to four decimals is fine")? Thanks in advance! |
It is all about decimal places. With 1 decimal place bierbots will only support Plato units, with 3 or more decimal places it will support Plato and Specific Gravity (SG). So, yes this discussion is all about one the number of decimal places transmitted to the bierbots API |
But still 4 decimals doesnt make any sense because you simply dont have an instrument to measure with such precision (I believe you need a device that can measure gravity up to 5 decimals to get reliable 4 decimals result). Overall, to me it sounds like an attempt to fix bierbots issue (eg unable to configure gravity units in bierbots) on the iSpindel side? Why dont fix it on bierbots side? |
Fixing on the Bierbots side would force ispindel to be a device that is setup for Plato units. This is inconsistent with other interfaces that allow the gravity to be either P or SG. |
Nope, BierBot Bricks backend can't do much if the iSpindle user decided to go with SG and sends a But again: I'm happy to fullfill any request to be able to merge. Please just tell me what you want. |
@BernhardSchlegel |
I think it may be worth splitting this into two items. One quick and easy fix as this current request has. And then maybe open a discussion point as to whether or not the truncation can be removed altogether. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine, but please open a discussion point to raise the issue of whether or not BierBot Bricks could simply accept the raw untruncated value.
This merge can potentially cause future "fixes" in the same style. If there is no technical showstoppers for sending raw values without truncation, I'd propose change values to raw now and forget about bierbots fixing for a while. @thegreatgunbantoad |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd propose to get rid of truncation and send a raw values in the same way as the other APIs do.
pio/src/iSpindel.cpp
Outdated
@@ -788,7 +788,7 @@ bool uploadData(uint8_t service) | |||
sender.add("brand", "wemos_d1_mini"); | |||
sender.add("version", FIRMWAREVERSION); | |||
sender.add("chipid", chipidHashed); | |||
sender.add("s_number_wort_0", (float)(round(Gravity * 10) / 10)); | |||
sender.add("s_number_wort_0", (float)(round(Gravity * 10000) / 10000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we consider to send a raw values (without truncation) instead of such fixes with changing a magic numbers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done! 👍
bd2b898
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @BernhardSchlegel
Clang format has to be run onto iSpindel.cpp to get rid of lint errors. Format Document or Shift+Alt+F in VC Code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be merged as soon as build gets fixed,
EDIT: fix #566
The sort of point I was going for was that this was a fix in the style of the original code which I can't see any major issue with. Secondary to that was the query of weather the original should have been coded that way which is a bit of a different issue and could have been made it's own pull request in order to keep the two issues segregated. |
Looks like this is not "two issues" (which should be kept segrregated) but the only one and the same. Nevertheless, @BernhardSchlegel already removed truncation. @thegreatgunbantoad |
Indeed. I still don't think they needed to be the same problem (solve one thing at at time or you'll never get anywhere), but one did certainly raise the other. But that looks moot now anyway. Cheers to @BernhardSchlegel for not losing his mind while we all discuss the awkwardness. |
@pppedrillo huh, didn't realise git hub knew my name. |
@BernhardSchlegel, oh cool are you the BierBot-Bricks developer, didn't realise that. That's cool. |
Can we please merge this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
Thanks! |
If iSpindel transmits SG (and not °P) 1 decimal (1.0,
round(x*10)/10
) is not sufficient. This PR ensures, that 4 decimals are send to the BierBot Bricks backend. This way, gravity values like SG=1.0482 can be transmitted to the BierBot Bricks backend without loss of information.