From fde41ac456ccfd548b464d8da49dfa31d2f7e831 Mon Sep 17 00:00:00 2001 From: Alexandre Leites <1256013+alexandre-leites@users.noreply.github.com> Date: Tue, 14 Mar 2023 14:28:22 +0100 Subject: [PATCH 1/3] Update parameter.py to fix parameter being set from history --- pyhon/parameter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyhon/parameter.py b/pyhon/parameter.py index 2970fd9..7f4e1f7 100644 --- a/pyhon/parameter.py +++ b/pyhon/parameter.py @@ -75,6 +75,7 @@ class HonParameterRange(HonParameter): @value.setter def value(self, value): + value = int(value) if self._min <= value <= self._max and not value % self._step: self._value = value else: From 318e60e91eb9e0a457cfcae43ba6d988e0182550 Mon Sep 17 00:00:00 2001 From: Alexandre Leites <1256013+alexandre-leites@users.noreply.github.com> Date: Tue, 14 Mar 2023 14:29:25 +0100 Subject: [PATCH 2/3] Update device.py trying to set fixed value from history --- pyhon/device.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyhon/device.py b/pyhon/device.py index e63b89d..54ff200 100644 --- a/pyhon/device.py +++ b/pyhon/device.py @@ -1,6 +1,7 @@ import importlib from pyhon.commands import HonCommand +from pyhon.parameter import HonParameterFixed class HonDevice: @@ -93,7 +94,7 @@ class HonDevice: command.set_program(parameters.pop("program").split(".")[-1].lower()) command = self.commands[name] for key, data in command.settings.items(): - if parameters.get(key) is not None: + if not isinstance(data, HonParameterFixed) and parameters.get(key) is not None: data.value = parameters.get(key) async def load_commands(self): From c9d4461f8fa187212b4b6edac0bbfbbe6181d5bb Mon Sep 17 00:00:00 2001 From: Alexandre Leites <1256013+alexandre-leites@users.noreply.github.com> Date: Tue, 14 Mar 2023 14:30:00 +0100 Subject: [PATCH 3/3] Update commands.py to fix None values --- pyhon/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyhon/commands.py b/pyhon/commands.py index 6fad60a..7c1e9ee 100644 --- a/pyhon/commands.py +++ b/pyhon/commands.py @@ -67,5 +67,5 @@ class HonCommand: @property def settings(self): """Parameters with typology enum and range""" - return {s: self._parameters[s] for s in self.setting_keys} + return {s: self._parameters.get(s) for s in self.setting_keys if self._parameters.get(s) is not None}