Index: artisan.py =================================================================== --- artisan.py (revision 650) +++ artisan.py (working copy) @@ -95,7 +95,10 @@ from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar import matplotlib as mpl - + +import subprocess +import re + platf = unicode(platform.system()) @@ -283,14 +286,15 @@ "EXTECH 421509", "Omega HH802U", "Omega HH309", - "NONE", + "NONE", "+ArduinoTC4", "TE VA18B", "+309_34", "+FUJI DUTY %", "Omega HHM28[6]", "+204_34", - "+Virtual" + "+Virtual", + "Ooku" ] #extra devices @@ -3523,7 +3527,8 @@ #apply sampling interval here libtime.sleep(aw.qmc.delay/1000.) - + + #if using a meter (thermocouple device) if aw.qmc.device != 18: #read time, ET (t1) and BT (t2) TEMPERATURE @@ -10971,7 +10976,8 @@ self.fujidutycycle, #22 self.HHM28, #23 self.K204_34, #24 - self.virtual #25 + self.virtual, #25 + self.OOKU #26 ] #temporary storage to pass values. Holds extra T3 and T4 values for center 309 @@ -11173,6 +11179,12 @@ return tx,t2,t1 + def OOKU(self): + t2,t1 = self.OOKUtemperature() + tx = aw.qmc.timeclock.elapsed()/1000. + return tx,t2,t1 + + #multimeter def HHM28(self): val,symbols= self.HHM28multimeter() #NOTE: val and symbols are type strings @@ -11779,6 +11791,31 @@ else: return -1 + + def OOKUtemperature(self): + scriptpath = os.path.realpath(os.path.dirname(sys.argv[0])) + p = subprocess.Popen(["%s/read-temp"%scriptpath, "temp"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) + p.wait() + sout = p.stdout.read() + + correct_readout = False + if "CORRECT READOUT" in sout: + correct_readout = True + + + if not correct_readout: + raise ValueError("Could not read temperature from external program, sorry.") + else: + regex = re.compile("(?m)^(?P\d): (?P\d{0,4})\.(?P\d{2}).*$", re.M) + res = regex.findall(sout) + + if len(res)>=2: + t1 = float( "%s.%s"%(res[0][1], res[1][2]) ) + t2 = float( "%s.%s"%(res[1][1], res[1][2]) ) + + return t1,t2 + + def TEVA18Btemperature(self): try: @@ -13657,10 +13694,20 @@ aw.ser.timeout=1 message = "" #empty message especial device + elif meter == "Ooku": + aw.qmc.device = 26 + message = QApplication.translate("Message Area","Device set to %1", None, QApplication.UnicodeUTF8).arg(meter) + st = "" + if aw.qmc.delay != 1000: + aw.qmc.delay = 1000 + st += ". Sampling rate changed to 1 second" + message = QApplication.translate("Message Area","Device set to %1%2", None, QApplication.UnicodeUTF8).arg(meter).arg(st) + + #set of different serial settings modes options ssettings = [[9600,8,'O',1,1],[19200,8,'E',1,1],[2400,7,'E',1,1],[9600,8,'N',1,1],[19200,8,'N',1,1,],[2400,8,'N',1,1],[9600,8,'E',1,1]] #map device index to a setting mode - devssettings = [0,1,2,3,3,3,3,3,3,3,3,3,3,3,3,2,1,3,0,4,5,3,6,5,3,3] #0-25 + devssettings = [0,1,2,3,3,3,3,3,3,3,3,3,3,3,3,2,1,3,0,4,5,3,6,5,3,3,3] #0-26 self.savedevicetable() #init serial settings of extra devices