From 66f9e2522aeab944407d3d2c1e63e2b511cd1b5b Mon Sep 17 00:00:00 2001 From: awatlet <arnaud.watlet@umons.ac.be> Date: Sun, 15 Oct 2023 21:27:30 +0200 Subject: [PATCH] Adds pwr_state in pwr module and refactors turn_on turn_off --- ohmpi/hardware_components/abstract_hardware_components.py | 1 - ohmpi/hardware_components/mb_2024_0_2.py | 6 +++--- ohmpi/hardware_components/pwr_dps5005.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ohmpi/hardware_components/abstract_hardware_components.py b/ohmpi/hardware_components/abstract_hardware_components.py index eb854748..54c56fb4 100644 --- a/ohmpi/hardware_components/abstract_hardware_components.py +++ b/ohmpi/hardware_components/abstract_hardware_components.py @@ -396,7 +396,6 @@ class TxAbstract(ABC): @pwr_state.setter def pwr_state(self, state): - if state == 'on': self._pwr_state = 'on' self.exec_logger.debug(f'{self.model} cannot switch on power source') diff --git a/ohmpi/hardware_components/mb_2024_0_2.py b/ohmpi/hardware_components/mb_2024_0_2.py index b82545da..5f8f4fb1 100644 --- a/ohmpi/hardware_components/mb_2024_0_2.py +++ b/ohmpi/hardware_components/mb_2024_0_2.py @@ -93,10 +93,10 @@ class Tx(Tx_mb_2023): if not subclass_init: self.exec_logger.event(f'{self.model}\ttx_init\tend\t{datetime.datetime.utcnow()}') - def inject(self, polarity=1, injection_duration=None,switch_pwr=True): + def inject(self, polarity=1, injection_duration=None): # add leds? - self.pin6.value=True - Tx_mb_2023.inject(self, polarity=polarity, injection_duration=injection_duration,switch_pwr=switch_pwr) + self.pin6.value = True + Tx_mb_2023.inject(self, polarity=polarity, injection_duration=injection_duration) self.pin6.value = False @property diff --git a/ohmpi/hardware_components/pwr_dps5005.py b/ohmpi/hardware_components/pwr_dps5005.py index c6e3a600..691fc396 100644 --- a/ohmpi/hardware_components/pwr_dps5005.py +++ b/ohmpi/hardware_components/pwr_dps5005.py @@ -78,7 +78,7 @@ class Pwr(PwrAbstract): def current_max(self, value): self.connection.write_register(0x0001, value * 10, 0) - def pwr_state(self): + def pwr_state(self): return self._pwr_state @pwr_state.setter -- GitLab