Fixed setting wrong current value

This commit is contained in:
Andre Basche 2023-03-05 19:03:03 +01:00
parent 0f630e854e
commit 00ac6912e2
2 changed files with 4 additions and 4 deletions

View file

@ -76,7 +76,7 @@ class HonParameterRange(HonParameter):
@value.setter @value.setter
def value(self, value): def value(self, value):
if self._min <= value <= self._max and not value % self._step: if self._min <= value <= self._max and not value % self._step:
self._value = self._value self._value = value
else: else:
raise ValueError(f"Allowed: min {self._min} max {self._max} step {self._step}") raise ValueError(f"Allowed: min {self._min} max {self._max} step {self._step}")
@ -102,7 +102,7 @@ class HonParameterEnum(HonParameter):
@value.setter @value.setter
def value(self, value): def value(self, value):
if value in self.values: if value in self.values:
self._value = self._value self._value = value
else: else:
raise ValueError(f"Allowed values {self._value}") raise ValueError(f"Allowed values {self._value}")
@ -123,4 +123,4 @@ class HonParameterProgram(HonParameterEnum):
if value in self.values: if value in self.values:
self._command.set_program(value) self._command.set_program(value)
else: else:
raise ValueError(f"Allowed values {self._value}") raise ValueError(f"Allowed values {self._values}")

View file

@ -7,7 +7,7 @@ with open("README.md", "r") as f:
setup( setup(
name="pyhOn", name="pyhOn",
version="0.2.2", version="0.2.4",
author="Andre Basche", author="Andre Basche",
description="Control hOn devices with python", description="Control hOn devices with python",
long_description=long_description, long_description=long_description,