From c31a451e7882d7c7bfde3d222f178a9755f98254 Mon Sep 17 00:00:00 2001
From: jkl <sagitta1618@gmail.com>
Date: Thu, 19 Oct 2023 17:46:02 +0200
Subject: [PATCH] Fix typo _switchable + add ohmpi_settings.json

---
 dev/test_mb_2023_4_mux_2023.py                           | 6 +++---
 ohmpi/config.py                                          | 9 +++++----
 .../hardware_components/abstract_hardware_components.py  | 2 +-
 ohmpi_settings.json                                      | 2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/dev/test_mb_2023_4_mux_2023.py b/dev/test_mb_2023_4_mux_2023.py
index 80ff435b..ca9c9c66 100644
--- a/dev/test_mb_2023_4_mux_2023.py
+++ b/dev/test_mb_2023_4_mux_2023.py
@@ -85,11 +85,11 @@ if within_ohmpi:
     print('Starting test with OhmPi.')
     k = OhmPi()
     # k.get_data()
-    k.load_sequence(os.path.join(os.path.dirname(__file__), '../sequences/test_circuit_1423.txt'))
+    k.load_sequence(os.path.join(os.path.dirname(__file__), '../sequences/wenner.txt'))
     k.reset_mux()
     # k.run_multiple_sequences(sequence_delay=20, nb_meas=3)
-    # k.run_sequence(injection_duration=0.2)
-    k.rs_check(tx_volt=4)
+    k.run_sequence(injection_duration=0.2)
+    # k.rs_check(tx_volt=4)
     # k.test_mux(mux_id=None, activation_time=0.2)
     # k._hw.switch_mux([A, B, M, N], state='on')
     # k._hw.vab_square_wave(12.,1., cycles=2)
diff --git a/ohmpi/config.py b/ohmpi/config.py
index fa30ccaa..40665972 100644
--- a/ohmpi/config.py
+++ b/ohmpi/config.py
@@ -17,14 +17,15 @@ OHMPI_CONFIG = {
     'settings': 'ohmpi_settings.json',  # INSERT YOUR FAVORITE SETTINGS FILE HERE
 }
 
+r_shunt = 2.
 HARDWARE_CONFIG = {
     'ctl': {'model': 'raspberry_pi'},
     'pwr': {'model': 'pwr_batt', 'voltage': 12., 'interface_name': 'none'},
     'tx':  {'model': 'mb_2023_0_X',
-             'voltage_max': 12.,  # Maximum voltage supported by the TX board [V]
-             'adc_voltage_max': 4800.,  # Maximum voltage read by the current ADC on the TX board [mA]
-             'r_shunt': 2.,  # Shunt resistance in Ohms
-             'interface_name': 'i2c',
+             'voltage_max': 50.,  # Maximum voltage supported by the TX board [V]
+             'current_max': 4.80/(50*r_shunt),  # Maximum voltage read by the current ADC on the TX board [A]
+             'r_shunt': r_shunt,  # Shunt resistance in Ohms
+             'interface_name': 'i2c'
             },
     'rx':  {'model': 'mb_2023_0_X',
             'coef_p2': 2.50,  # slope for conversion for ADS, measurement in V/V
diff --git a/ohmpi/hardware_components/abstract_hardware_components.py b/ohmpi/hardware_components/abstract_hardware_components.py
index be1e51e2..5b98a620 100644
--- a/ohmpi/hardware_components/abstract_hardware_components.py
+++ b/ohmpi/hardware_components/abstract_hardware_components.py
@@ -423,7 +423,7 @@ class TxAbstract(ABC):
     def pwr_state(self, state):
         if state == 'on':
             self._pwr_state = 'on'
-            if not self.pwr.switchable:
+            if not self.pwr._switchable:
                 self.exec_logger.debug(f'{self.model} cannot switch on power source')
             self.pwr.reload_settings()
         elif state == 'off':
diff --git a/ohmpi_settings.json b/ohmpi_settings.json
index e839f5fb..2964e24b 100644
--- a/ohmpi_settings.json
+++ b/ohmpi_settings.json
@@ -1,5 +1,5 @@
 {
-    "nb_electrodes": 64,
+    "nb_electrodes": 16,
     "injection_duration": 0.2,
     "nb_stack": 1,
     "nb_meas": 1,
-- 
GitLab