def resetboard(self): board = pySer(self.comport, 9600, 3) board.Send_Command('O(00,01,1)E') time.sleep(1) board.Send_Command('O(00,01,0)E') time.sleep(1) board.Send_Command('O(00,03,1)E') time.sleep(4) board.Send_Command('O(00,03,0)E') time.sleep(1) board.close()
def start(self): if self.comvar.get() != None and self.ser == None: self.ser = pySer(self.comvar.get(), 115200, 10) self.ser.start() elif self.comvar.get() == None: tkMessageBox.showerror( "Error", "No com port! please fill it with \"COM1\" format.") return t = Thread(target=self.recdata) t.daemon = True t.start() for k, v in self.atlist.items(): if v.get() == 1: #print(type(v)) #self.scr.insert("insert",self.btnlist[k]["text"]) self.execlist.append(self.btnlist[k]["text"]) if len(self.execlist) > 0: for at in self.execlist: print at self.ser.Send_Command(str(at) + "\r") time.sleep(1)
def resetboard(self): board = pySer(self.comport,9600,3) #board.Send_Command('O(00,02,1)E') #time.sleep(2) board.Send_Command('O(00,01,1)E') self.logger.info('O(00,01,1)E') time.sleep(2) board.Send_Command('O(00,01,0)E') self.logger.info('O(00,01,0)E') time.sleep(3) board.Send_Command('O(00,03,1)E') self.logger.info('O(00,03,1)E') time.sleep(2) board.Send_Command('O(00,03,0)E') self.logger.info('O(00,03,0)E') time.sleep(7) #board.Send_Command('O(00,02,0)E') #time.sleep(2) board.close()
config = ConfigParser.ConfigParser() config.read("config.ini") assertfilepath = config.get("mtbf", "assertfile") comport = config.get("mtbf", "port") powerrelayport = config.get("mtbf", "powerrelayport") catchertool = config.get("mtbf", "catchertool") tclcommand = config.get("mtbf", "tclcommand") dmdsenable = config.get("mtbf", "dmdsenable") dmdsdmssswitch = config.get("mtbf", "dmdsdmssswitch") #casepath = "D:\\scripts\\python\\testcase" event_handler = MyHandler(powerrelayport, catchertool, tclcommand) observer = Observer() observer.schedule(event_handler, path=assertfilepath, recursive=True) observer.start() sercom = pySer(comport, 115200, 10) sercom.start() logger.debug(" start com port!") if 1 == int(dmdsenable): dmdsflag = 1 else: dmdsflag = 0 try: logger.debug("started myWatch") gsmidlenbbs_setting(sercom) for i in range(1000): gsmidlenbbs(sercom, i) except KeyboardInterrupt: observer.stop() observer.join()