From f060063e34f744e2e4d73dd2746a0c0529f55a2e Mon Sep 17 00:00:00 2001
From: LorenzoMonti <lorenzomonti42@gmail.com>
Date: Fri, 28 Jan 2022 10:26:45 +0100
Subject: [PATCH] Fix set_conf() in order to upload and update data correctly

---
 src/Utils.py                  | 2 +-
 src/gui.py                    | 2 +-
 src/tabs/configuration_tab.py | 2 ++
 src/tabs/connect_tab.py       | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/Utils.py b/src/Utils.py
index ae5d519..5910f11 100644
--- a/src/Utils.py
+++ b/src/Utils.py
@@ -36,7 +36,7 @@ def set_SPA_for_measure(ms2830a, config_file, manual_command):
         # BW
         ms2830a.do_set_resolutionBW(config_file["resolution_bandwith"]) # 1Mhz
         log_list.append("Resolution Bandwith: " + str(ms2830a.do_get_resolutionBW()))
-        ms2830a.do_set_videoBW(100)
+        ms2830a.do_set_videoBW(config_file["video_bandwith"])
         log_list.append("Video bandwith:" + str(ms2830a.do_get_videoBW()))
         
         # AMPLITUDE
diff --git a/src/gui.py b/src/gui.py
index c97a0c9..10cf674 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -92,7 +92,7 @@ class UserInterface:
         #############################
         # TABS CREATION
         #############################
-        connect_tab.connect(self, self.TNotebook1, config_interface, config_file)
+        connect_tab.connect(self, self.TNotebook1, config_interface)
         configuration_tab.configuration(self, self.TNotebook1, config_interface, config_file)
         measure_tab.measure(self,self.TNotebook1)
         
diff --git a/src/tabs/configuration_tab.py b/src/tabs/configuration_tab.py
index 11ef6b4..a139e33 100644
--- a/src/tabs/configuration_tab.py
+++ b/src/tabs/configuration_tab.py
@@ -150,6 +150,8 @@ def configuration(self, TNotebook1, config_interface, config_file):
 
     def set_conf():
         try:
+            config_file = Utils.read_config_file("../config/config_MS2830A.json")
+            config_interface = Utils.read_config_file("../config/config_interface.json")
             self.instr = SPA.Anritsu_MS2830A("Anritsu_MS2830A",config_interface[self.selected_interface.get()])
             log_list = Utils.set_SPA_for_measure(self.instr, config_file, self.Entry10.get())
             self.Text1.insert(tk.END, "\nConfiguration\n")
diff --git a/src/tabs/connect_tab.py b/src/tabs/connect_tab.py
index 6eb2bb7..01a3f66 100644
--- a/src/tabs/connect_tab.py
+++ b/src/tabs/connect_tab.py
@@ -15,7 +15,7 @@ from tkinter import ttk
 import Utils
 import logging
 
-def connect(self, TNotebook1, config_interface, config_file):
+def connect(self, TNotebook1, config_interface):
 
     ##################################
     # 	          TAB 1	        	 #
-- 
GitLab