From 13f39f3dd7e31bf3fcb71a68d270f385795513e1 Mon Sep 17 00:00:00 2001
From: su530201 <olivier.kaufmann@umons.ac.be>
Date: Fri, 16 Jun 2023 13:46:15 +0200
Subject: [PATCH] Tests event logging

---
 ohmpi/hardware_components/ohmpi_card_3_15.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ohmpi/hardware_components/ohmpi_card_3_15.py b/ohmpi/hardware_components/ohmpi_card_3_15.py
index 873730a9..a89c5704 100644
--- a/ohmpi/hardware_components/ohmpi_card_3_15.py
+++ b/ohmpi/hardware_components/ohmpi_card_3_15.py
@@ -233,18 +233,22 @@ class Rx(RxAbstract):
         self.exec_logger.debug(f'Setting RX ADC gain to {value}')
 
     def adc_gain_auto(self):
+        self.exec_logger.event(f'{self.board_name}\tAuto_Gain_RX\tbegin\t{datetime.datetime.utcnow()}')
         gain_0 = _gain_auto(AnalogIn(self._ads_voltage, ads.P0))
         gain_2 = _gain_auto(AnalogIn(self._ads_voltage, ads.P2))
         gain = np.min([gain_0, gain_2])
         self.exec_logger.debug(f'Setting RX ADC gain automatically to {gain}')
         self.adc_gain = gain
+        self.exec_logger.event(f'{self.board_name}\tAuto_Gain_RX\tend\t{datetime.datetime.utcnow()}')
 
     @property
     def voltage(self):
         """ Gets the voltage VMN in Volts
         """
+        self.exec_logger.event(f'{self.board_name}\Measure_Voltage_RX\tbegin\t{datetime.datetime.utcnow()}')
         u0 = AnalogIn(self._ads_voltage, ads.P0).voltage * 1000.
         u2 = AnalogIn(self._ads_voltage, ads.P2).voltage * 1000.
-        u = np.max([u0,u2]) * (np.heaviside(u0-u2, 1.) * 2 - 1.) # gets the max between u0 & u2 and set the sign
+        u = np.max([u0, u2]) * (np.heaviside(u0-u2, 1.) * 2 - 1.) # gets the max between u0 & u2 and set the sign
         self.exec_logger.debug(f'Reading voltages {u0} mV and {u2} mV on RX. Returning {u} mV')
+        self.exec_logger.event(f'{self.board_name}\Measure_Voltage_RX\tend\t{datetime.datetime.utcnow()}')
         return u
\ No newline at end of file
-- 
GitLab