forked from RnD/measurement
Constrain value before checking for updates to avoid out of bound scaling event triggers / updates when nothing changes.
This commit is contained in:
@@ -497,8 +497,18 @@ class Measurement {
|
||||
|
||||
updateOutputAbs(val) {
|
||||
|
||||
// Constrain first, then check for changes
|
||||
let constrainedVal = val;
|
||||
|
||||
if (val < this.config.scaling.absMin || val > this.config.scaling.absMax) {
|
||||
this.logger.warn(`Output value=${val} is outside of ABS range. Constraining.`);
|
||||
constrainedVal = this.constrain(val, this.config.scaling.absMin, this.config.scaling.absMax);
|
||||
}
|
||||
|
||||
const roundedVal = Math.round(constrainedVal * 100) / 100;
|
||||
|
||||
//only update on change
|
||||
if (val != this.outputAbs) {
|
||||
if (roundedVal != this.outputAbs) {
|
||||
|
||||
// Constrain value within process range
|
||||
if (val < this.config.scaling.absMin || val > this.config.scaling.absMax) {
|
||||
|
||||
Reference in New Issue
Block a user