protected override void moduleConfigHasChanged() { base.moduleConfigHasChanged(); _currentValue = _func.get_currentValue(); if (_currentValue == YAPI.INVALID_DOUBLE) { _currentValue = Double.NaN; } _unit = _func.get_unit(); _updateFrequency = _func.get_reportFrequency(); if (_updateFrequency == "OFF") { _updateFrequency = "auto"; } _logFrequency = _func.get_logFrequency(); _reportFrequency = _func.get_reportFrequency(); _advMode = _func.get_advMode() + 1; _resolution = _func.get_resolution(); }
private void DisplayValue(YSensor fct) { double value = fct.get_currentValue(); double rawvalue = fct.get_currentRawValue(); double resolution = fct.get_resolution(); string valunit = fct.get_unit(); // displays the sensor value on the ui ValueDisplayUnits.Text = valunit; if (resolution != YSensor.RESOLUTION_INVALID) { // if resolution is available on the device the use it to round the value string format = "F" + ((int)-Math.Round(Math.Log10(resolution))).ToString(); RawValueDisplay.Text = "(raw value: " + (resolution * Math.Round(rawvalue / resolution)).ToString(format) + ")"; ValueDisplay.Text = (resolution * Math.Round(value / resolution)).ToString(format); } else { ValueDisplay.Text = value.ToString(); RawValueDisplay.Text = ""; } }