From 5e79c7ba49aae27bda4b00db0fa486c72baa5fed Mon Sep 17 00:00:00 2001
From: su530201 <olivier.kaufmann@umons.ac.be>
Date: Sat, 15 Apr 2023 13:31:17 +0200
Subject: [PATCH] Adds logging message for current

---
 hardware/abstract_hardware.py | 2 +-
 hardware/mb_2024_rev_0_0.py   | 2 +-
 hardware/ohmpi_card_3_15.py   | 6 ++++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/hardware/abstract_hardware.py b/hardware/abstract_hardware.py
index fa2f99fa..881c9bea 100644
--- a/hardware/abstract_hardware.py
+++ b/hardware/abstract_hardware.py
@@ -48,7 +48,7 @@ class TxAbstract(ABC):
     @property
     @abstractmethod
     def current(self):
-        # add actions to read the DPS current and return it
+        # add actions to read the TX current and return it
         return None
 
     @current.setter
diff --git a/hardware/mb_2024_rev_0_0.py b/hardware/mb_2024_rev_0_0.py
index 67e25af9..bfabb780 100644
--- a/hardware/mb_2024_rev_0_0.py
+++ b/hardware/mb_2024_rev_0_0.py
@@ -139,7 +139,7 @@ class Tx(TxAbstract):
     def current(self):
         """ Gets the current IAB in Amps
         """
-        return AnalogIn(self._ads_current, ads.P0).voltage * 1000. / (50 * TX_CONFIG['R_shunt'])  # noqa measure current
+        return AnalogIn(self._ads_current, ads.P0).voltage * 1000. / (50 * TX_CONFIG['r_shunt'])  # noqa measure current
 
     @ current.setter
     def current(self, value):
diff --git a/hardware/ohmpi_card_3_15.py b/hardware/ohmpi_card_3_15.py
index 064a99f7..72d5568b 100644
--- a/hardware/ohmpi_card_3_15.py
+++ b/hardware/ohmpi_card_3_15.py
@@ -125,7 +125,9 @@ class Tx(TxAbstract):
     def current(self):
         """ Gets the current IAB in Amps
         """
-        return AnalogIn(self._ads_current, ads.P0).voltage * 1000. / (50 * TX_CONFIG['r_shunt'])  # noqa measure current
+        iab = AnalogIn(self._ads_current, ads.P0).voltage * 1000. / (50 * TX_CONFIG['r_shunt'])  # measure current
+        self.exec_logger.debug(f'Reading TX current:  {iab} mA')
+        return iab
 
     @ current.setter
     def current(self, value):
@@ -138,7 +140,7 @@ class Tx(TxAbstract):
 
     @property
     def polarity(self):
-        return TxAbstract.polarity.gset(self)
+        return TxAbstract.polarity.fget(self)
 
     @polarity.setter
     def polarity(self, value):
-- 
GitLab