From afaf6b39c33cd56f01e4661ce00541dec4868261 Mon Sep 17 00:00:00 2001
From: su530201 <olivier.kaufmann@umons.ac.be>
Date: Sat, 15 Apr 2023 17:58:43 +0200
Subject: [PATCH] Adds a change config function in utils

---
 config.py | 2 +-
 utils.py  | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/config.py b/config.py
index 021481c4..8ce65319 100644
--- a/config.py
+++ b/config.py
@@ -29,7 +29,7 @@ HARDWARE_CONFIG = {
              'coef_p2': 2.50,  # slope for current conversion for ADS.P2, measurement in V/V
              'nb_samples': 20,  # Max value 10 # was named integer before...
             },
-    'mux': {'model' : 'ohmpi_i2c_mux64_v1.01',
+    'mux': {'model' : 'dummy_mux', # 'ohmpi_i2c_mux64_v1.01',
              'max_elec': 64,
              'board_addresses': {'A': 0x73, 'B': 0x72, 'M': 0x71, 'N': 0x70},  # CHECK IF YOUR BOARDS HAVE THESE ADDRESSES
              'voltage_max': 100,
diff --git a/utils.py b/utils.py
index 86e740b9..7f367f03 100644
--- a/utils.py
+++ b/utils.py
@@ -20,10 +20,15 @@ def get_platform():
         pass
     return platform, on_pi
 
-def change_config(config_file):
+def change_config(config_file, verbose=True):
     cwd = os.getcwd()
     try:
         shutil.copyfile(f'{cwd}/OhmPi/config.py', f'{cwd}/OhmPi/config_tmp.py')
         shutil.copyfile(f'{cwd}/OhmPi/{config_file}', f'{cwd}/OhmPi/config.py')
+        if verbose:
+            print(f'Changed to {cwd}/OhmPi/{config_file}:\n')
+            with open(f'{cwd}/OhmPi/config.py', mode='r') as f:
+                print(f.read())
+
     except Exception as error:
         print(f'Could not change config file to {cwd}/OhmPi/{config_file}:\n{error}')
\ No newline at end of file
-- 
GitLab