From c67dd39868b692cfb210df40e81a735f7581cfce Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 23 Jan 2012 14:16:26 -0500 Subject: [PATCH] Also fix decimal handling for Melcor floats based on DECIMAL_1 during writes. This should have gone in with the last commit. --- pypid/backend/melcor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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( -- 2.26.2