-
Notifications
You must be signed in to change notification settings - Fork 11
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
Change the number of decimals used to display tank sensor values when… #1851
base: main
Are you sure you want to change the base?
Change the number of decimals used to display tank sensor values when… #1851
Conversation
@@ -61,7 +61,7 @@ Page { | |||
allowed: dataItem.seen && (!standard.dataItem.isValid || standard.currentValue === 2) | |||
dataItem.uid: root.bindPrefix + "/RawValueEmpty" | |||
suffix: rawUnit.value || "" | |||
decimals: 3 | |||
decimals: rawUnit.decimals |
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.
It seems odd to have decimals=1 but stepSize=0.005 in the cm case.
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.
Changes step size for the cm case to 0.1
property int decimals: { | ||
switch (value) { | ||
case "cm": | ||
return 1 |
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 was going to suggest adding cm
as a unit to units.h
and providing some default precision for it, but I suppose the 3 decimals for the volts here is already non-standard, so ... maybe it's okay like this even if it's not ideal.
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.
So long as this is an isolated case this might be ok.
However a more consistent approach would be nice if it were possible to define the types of units available for display - and define a) a default decimals for that unit and b) override the chosen unit's decimal on a per-instance basis. I had to deal with this exact problem in a former life so I know how hard b) in particular is to solve.
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.
Maybe I'm misunderstanding something, but we do support that already, don't we? e.g.
precision: 1 |
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 asked about this on slack, we'll wait and see what comes back.
https://victrondevelopment.slack.com/archives/C020QG3JVEW/p1737080996093759
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.
@MikeTrahearn-Qinetic we do have a list of units available for display, and they have default precisions, as per units.h/cpp, but this case it's more difficult to determine as this is a "raw unit string" rather than a fixed unit type, so in theory the unit could be anything.
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.
MV says 1 decimal is fine for cm, and then leave the rest at 3
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 page doesn't use default precision, because it's an odd case where we want higher precision for tuning tank sensors. MV says: "You can change it to be 1 decimal for centimeters. And then we leave this. Its not important: sensor value is a debug value. The value that matters is the tank level in liters or m3"
… empty / full Fixes #1836
ea3b094
to
9240c8b
Compare
… empty / full
Fixes #1836