Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /branches/Gxsm-2x3-transition-sig/plug-ins/hard/MK3-A810_spmcontrol/python_scripts/mk3_spm_configurator.py [r3530] .. [r3531] Maximize Restore

  Switch to side-by-side view

--- a/branches/Gxsm-2x3-transition-sig/plug-ins/hard/MK3-A810_spmcontrol/python_scripts/mk3_spm_configurator.py
+++ b/branches/Gxsm-2x3-transition-sig/plug-ins/hard/MK3-A810_spmcontrol/python_scripts/mk3_spm_configurator.py
@@ -1192,7 +1192,7 @@
 		self.wins[name].show_all()
 
     # LOG "VU" Meter
-    def create_meterVU(self, w, tap):
+    def create_meterVU(self, w, tap, fsk):
 	    [value, uv, signal] = self.mk3spm.get_monitor_signal (tap)
 	    label = signal[3]
 	    unit  = signal[4]
@@ -1211,16 +1211,29 @@
 		    instr.show()
 		    win.add(v)
 
-		    def update_meter(meter_set, _tap, signal):
+		    def update_meter(inst, _tap, signal, fm):
 #			    [value, v, signal] = self.mk3spm.get_monitor_signal (_tap)
 			    value = self.mk3spm.get_monitor_data (_tap)
+
+
 			    if signal[2] == 'analog.rms_signal':
+				    try:
+					    float (fm ())
+					    maxv = math.fabs( float (fm ()))
+				    except ValueError:
+					    maxv = (1<<31)*math.fabs(math.sqrt(signal[5]))
+			    
 				    v = math.sqrt(math.fabs(value) * signal[5])
-				    maxdb = 20.*math.log10((1<<31)*math.fabs(math.sqrt(signal[5])))
-#				    print value, v, maxdb, signal[5], signal[2] 
 			    else:
+				    try:
+					    float (fm ())
+					    maxv = math.fabs( float (fm ()))
+				    except ValueError:
+					    maxv = (1<<31)*math.fabs(signal[5])
+			    
 				    v = value * signal[5]
-				    maxdb = 20.*math.log10((1<<31)*math.fabs(signal[5]))
+
+			    maxdb = 20.*math.log10(maxv)
 			    # _labsv("%+06.2f " %v+signal[4])
 
 			    if v >= 0:
@@ -1228,14 +1241,17 @@
 			    else:
 				    p="-"
 			    db = -maxdb + 20.*math.log10(math.fabs(v+0.001))
-			    meter_set (db, p)
+
+			    inst.set_reading_auto_vu (db, p)
+			    inst.set_range(arange(0,maxv/10*11,maxv/10))
+
 			    return gtk.TRUE
 
-		    gobject.timeout_add (88, update_meter, instr.set_reading_auto_vu, tap, signal)
+		    gobject.timeout_add (88, update_meter, instr, tap, signal, fsk)
 	    self.wins[name].show_all()
 
     # Linear Meter
-    def create_meterLinear(self, w, tap):
+    def create_meterLinear(self, w, tap, fsk):
 	    [value, uv, signal] = self.mk3spm.get_monitor_signal (tap)
 	    label = signal[3]
 	    unit  = signal[4]
@@ -1250,27 +1266,36 @@
 		    self.wins[name] = win
 		    win.connect("delete_event", self.delete_event)
 		    v = gobject.new(gtk.VBox(spacing=0))
-		    maxv = (1<<31)*math.fabs(signal[5])
+		    try:
+			    float (fsk ())
+			    maxv = float (fsk ())
+		    except ValueError:
+			    maxv = (1<<31)*math.fabs(signal[5])
 
 		    instr = Instrument( gobject.new(gtk.Label), v, "Volt", label, unit)
 		    instr.set_range(arange(0,maxv/10*11,maxv/10))
 		    instr.show()
 		    win.add(v)
 
-		    def update_meter(meter_set, _tap, signal):
+		    def update_meter(inst, _tap, signal, fm):
 #			    [value, v, signal] = self.mk3spm.get_monitor_signal (_tap)
 			    value = self.mk3spm.get_monitor_data (_tap)
 			    v = value * signal[5]
-			    maxv = (1<<31)*math.fabs(signal[5])
+			    try:
+				    float (fm ())
+				    maxv = float (fm ())
+			    except ValueError:
+				    maxv = (1<<31)*math.fabs(signal[5])
 			    
 			    if v >= 0:
 				    p="+"
 			    else:
 				    p="-"
-			    meter_set (v, p)
+			    inst.set_reading_auto_vu (v, p)
+			    inst.set_range(arange(0,maxv/10*11,maxv/10))
 			    return gtk.TRUE
 
-		    gobject.timeout_add (88, update_meter, instr.set_reading_auto_vu, tap, signal)
+		    gobject.timeout_add (88, update_meter, instr, tap, signal, fsk)
 	    self.wins[name].show_all()
 
     def update_signal_menu_from_signal (self, menu, tap):
@@ -1300,7 +1325,7 @@
 			box2.set_border_width(5)
 			box1.pack_start(box2)
 
-			table = gtk.Table (6, 17)
+			table = gtk.Table (11, 17)
 			table.set_row_spacings(0)
 			table.set_col_spacings(4)
 			box2.pack_start(table, False, False, 0)
@@ -1326,6 +1351,10 @@
 			lab = gobject.new(gtk.Label, label="V")
 			lab.set_alignment(1.0, 0.5)
 			table.attach (lab, 8, 9, r, r+1, gtk.FILL | gtk.EXPAND )
+
+			lab = gobject.new(gtk.Label, label="Max.")
+			lab.set_alignment(1.0, 0.5)
+			table.attach (lab, 9, 10, r, r+1, gtk.FILL | gtk.EXPAND )
 
 			r = r+1
 			separator = gobject.new(gtk.HSeparator())
@@ -1357,12 +1386,16 @@
 				table.attach (labsv, 6, 7, r, r+1, gtk.FILL | gtk.EXPAND )
 				gobject.timeout_add(500, self.signal_reading_update, lab2.set_text, labv.set_text, labsv.set_text, tap)
 
+				full_scale = gtk.Entry()
+				full_scale.set_text("auto")
+				table.attach (full_scale, 9, 10, r, r+1, gtk.FILL | gtk.EXPAND )
+
 				image = gtk.Image()
 				image.set_from_file("meter-icondB.png")
 				image.show()
 				button = gtk.Button()
 				button.add(image)
-				button.connect("clicked", self.create_meterVU, tap)
+				button.connect("clicked", self.create_meterVU, tap, full_scale.get_text)
 				table.attach (button, 7, 8, r, r+1, gtk.FILL | gtk.EXPAND )
 
 				image = gtk.Image()
@@ -1370,8 +1403,10 @@
 				image.show()
 				button = gtk.Button()
 				button.add(image)
-				button.connect("clicked", self.create_meterLinear, tap)
+				button.connect("clicked", self.create_meterLinear, tap, full_scale.get_text)
 				table.attach (button, 8, 9, r, r+1, gtk.FILL | gtk.EXPAND )
+
+				
 
 				r = r+1