From: W. Trevor King Date: Mon, 23 Jan 2012 19:16:26 +0000 (-0500) Subject: Also fix decimal handling for Melcor floats based on DECIMAL_1 during writes. X-Git-Tag: v0.4~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c67dd39868b692cfb210df40e81a735f7581cfce;p=pypid.git Also fix decimal handling for Melcor floats based on DECIMAL_1 during writes. This should have gone in with the last commit. --- diff --git a/pypid/backend/melcor.py b/pypid/backend/melcor.py index 1777da8..c3924d3 100644 --- a/pypid/backend/melcor.py +++ b/pypid/backend/melcor.py @@ -470,8 +470,10 @@ class MelcorBackend (_Backend, _ManualMixin, _PIDMixin, _TemperatureMixin): register = self._register[register_name] if 'w' not in register.direction: raise ValueError(register_name) - if register.needs_decimal and not self._decimal: - self._decimal = self._get_decimal() + if register.needs_decimal: + if not self._decimal: + self._decimal = self._get_decimal() + register.decimal = self._decimal v = register.encode(value, decimal=self._decimal) _LOG.info('write %s: %s (%s)' % (register_name, v, value)) rc = self._client.write_register(