-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -61,8 +61,8 @@ Page { | |||
allowed: dataItem.seen && (!standard.dataItem.isValid || standard.currentValue === 2) | ||||
dataItem.uid: root.bindPrefix + "/RawValueEmpty" | ||||
suffix: rawUnit.value || "" | ||||
decimals: 3 | ||||
stepSize: 0.005 | ||||
decimals: rawUnit.decimals | ||||
stepSize: rawUnit.stepSize | ||||
} | ||||
|
||||
ListSpinBox { | ||||
|
@@ -71,8 +71,8 @@ Page { | |||
allowed: dataItem.seen && (!standard.dataItem.isValid || standard.currentValue === 2) | ||||
dataItem.uid: root.bindPrefix + "/RawValueFull" | ||||
suffix: rawUnit.value || "" | ||||
decimals: 3 | ||||
stepSize: 0.005 | ||||
decimals: rawUnit.decimals | ||||
stepSize: rawUnit.stepSize | ||||
} | ||||
|
||||
ListRadioButtonGroup { | ||||
|
@@ -160,6 +160,27 @@ Page { | |||
|
||||
VeQuickItem { | ||||
id: rawUnit | ||||
|
||||
// The possible values here are not well defined. The doco says: "can be V, and probably also mA and R or O." | ||||
// At least one installation uses "cm". | ||||
property int decimals: { | ||||
switch (value) { | ||||
case "cm": | ||||
return 1 | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was going to suggest adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So long as this is an isolated case this might be ok. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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" |
||||
default: | ||||
return 3 | ||||
} | ||||
} | ||||
|
||||
property real stepSize: { | ||||
switch (value) { | ||||
case "cm": | ||||
return 0.1 | ||||
default: | ||||
return 0.005 | ||||
} | ||||
} | ||||
|
||||
uid: root.bindPrefix + "/RawUnit" | ||||
} | ||||
} |
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