From c69eb188d2b510bc65659d35eafd87c2e39b15ea Mon Sep 17 00:00:00 2001 From: su530201 <olivier.kaufmann@umons.ac.be> Date: Wed, 11 Oct 2023 00:28:51 +0200 Subject: [PATCH] Improve code consistency --- ohmpi/hardware_components/pwr_batt.py | 7 +++---- ohmpi/hardware_components/pwr_dps5005.py | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ohmpi/hardware_components/pwr_batt.py b/ohmpi/hardware_components/pwr_batt.py index 205762f2..0616ba94 100644 --- a/ohmpi/hardware_components/pwr_batt.py +++ b/ohmpi/hardware_components/pwr_batt.py @@ -6,6 +6,8 @@ from ohmpi.utils import enforce_specs # hardware characteristics and limitations SPECS = {'model': {'default': os.path.basename(__file__).rstrip('.py')}, 'voltage': {'default': 12., 'max': 12., 'min': 12.}, + 'current_adjustable': {'default': False}, + 'voltage_adjustable': {'default': False} } @@ -17,11 +19,8 @@ class Pwr(PwrAbstract): subclass_init = False else: subclass_init = True - voltage = kwargs.pop('voltage', 12.) super().__init__(**kwargs) - self.voltage_adjustable = False - self._voltage = voltage - self.current_adjustable = False + self._voltage = kwargs['voltage'] self._current = np.nan self._state = 'on' diff --git a/ohmpi/hardware_components/pwr_dps5005.py b/ohmpi/hardware_components/pwr_dps5005.py index b1cd7180..daf6a7d0 100644 --- a/ohmpi/hardware_components/pwr_dps5005.py +++ b/ohmpi/hardware_components/pwr_dps5005.py @@ -9,6 +9,8 @@ from ohmpi.utils import enforce_specs SPECS = {'model': {'default': os.path.basename(__file__).rstrip('.py')}, 'voltage': {'default': 12., 'max': 50., 'min': 0.}, 'current_max': {'default': 100.}, + 'current_adjustable': {'default': False}, + 'voltage_adjustable': {'default': True} } # TODO: Complete this code... handle modbus connection -- GitLab