def check_pic_terminal(self, port, baud, rts): print 'checking pic' c, message = detectpic.check_conection(port, baud) #If tinybld cant connect to selected port return error message if c == False: print message, return else: print message, #chunkhexfile.chunk_hexfile(file) print '\n Searching for PIC ...', for i in range(0, 20): while gtk.events_pending(): gtk.main_iteration() type, max_flash, family, message = detectpic.check_pic( port, baud, rts) if max_flash != None: break print ' press RESET' if max_flash == None: print ' pic not found' return else: print message
def check_pic_terminal(self,port,baud,rts): print 'checking pic' c,message=detectpic.check_conection(port, baud) #If tinybld cant connect to selected port return error message if c==False: print message, return else: print message, #chunkhexfile.chunk_hexfile(file) print '\n Searching for PIC ...', for i in range(0,20): while gtk.events_pending(): gtk.main_iteration() type,max_flash,family,message=detectpic.check_pic(port,baud,rts) if max_flash!=None: break print ' press RESET' if max_flash==None: print ' pic not found' return else: print message
def tranfer_file(self, file, port, baud, rts, gpio): begin = time.strftime("%H:%M", time.localtime()) c, message = detectpic.check_conection(port, baud) #If tinybld cant connect to selected port return error message if c == False: print message, return else: print message, #chunkhexfile.chunk_hexfile(file) print '\n Searching for PIC ...', for i in range(0, 20): while gtk.events_pending(): gtk.main_iteration() type, max_flash, family, message = detectpic.check_pic( port, baud, rts) if max_flash != None: break print ' press RESET' if max_flash == None: print ' pic not found' return else: print message start = time.time() write_status = transferhex.transfer_hex(None, file, port, baud, type, max_flash, family, rts, gpio) end = time.time() if write_status == 'OK': print 'Write OK at ' + str(begin) + ' time: ' + str( end - start)[0:5] + ' sec' else: print '\n Error writing' return
def tranfer_file(self,file,port,baud,rts,gpio): begin=time.strftime("%H:%M", time.localtime()) c,message=detectpic.check_conection(port, baud) #If tinybld cant connect to selected port return error message if c==False: print message, return else: print message, #chunkhexfile.chunk_hexfile(file) print '\n Searching for PIC ...', for i in range(0,20): while gtk.events_pending(): gtk.main_iteration() type,max_flash,family,message=detectpic.check_pic(port,baud,rts) if max_flash!=None: break print ' press RESET' if max_flash==None: print ' pic not found' return else: print message start = time.time() write_status=transferhex.transfer_hex(None,file,port,baud,type,max_flash,family,rts,gpio) end = time.time() if write_status=='OK': print 'Write OK at ' +str(begin)+' time: '+str(end-start)[0:5]+' sec' else: print '\n Error writing' return
def on_checkpic_button_clicked(self, widget): print #Showing abort button self.abort_button.show() #Getting serial port and boud rate values PORT = self.port_entry.get_text() BAUD = self.speed_combo.get_active_text() #Asigning some variables type, max_flash, family = None, None, None #checking if there's port availeble c, message = detectpic.check_conection(PORT, BAUD) #If tinybld cant connect to selected port return error message if c == False: print message self.write_message(message) self.abort_button.hide() self.status_icon.set_from_file(red) gobject.timeout_add(2000, self.on_timeout) return type, max_flash, family else: self.status_icon.set_from_file(yellow) self.write_message(message) self.write_message('\n Searching for PIC ...') #Reset PIC by software RESET_RTS = self.rts_checkbutton.get_active() for i in range(0, 15): progress = (i + 1) / 15.0 while gtk.events_pending(): gtk.main_iteration() self.progress_bar.set_fraction(progress) type, max_flash, family, message = detectpic.check_pic( PORT, BAUD, RESET_RTS) if max_flash != None: break if self.want_to_abort: self.want_to_abort = False break print 'Not found press PIC reset...' #if after ask several times PIC ide tinybld dont have a vali max_flask #return an error message if max_flash == None: print message self.write_message(message) self.abort_button.hide() self.status_icon.set_from_file(red) self.progress_bar.set_fraction(0) gobject.timeout_add(2000, self.on_timeout) return type, max_flash, family print message self.write_message(message) self.progress_bar.set_fraction(0) self.abort_button.hide() self.status_icon.set_from_file(green) gobject.timeout_add(2000, self.on_timeout) return type, max_flash, family
def on_write_button_clicked(self, widget): begin = time.strftime("%H:%M", time.localtime()) PORT = self.port_entry.get_text() BAUD = self.speed_combo.get_active_text() hex_file_path = self.hex_file_entry.get_text() #Test of GPIO functionality message = '\nGPIO option is ' + str(self.gpio_checkbutton.get_active()) self.write_message(message) #checking if there's port availeble c, message = detectpic.check_conection(PORT, BAUD) #If tinybld cant connect to selected port return error message if c == False: print message self.write_message(message) while gtk.events_pending(): gtk.main_iteration() self.abort_button.hide() self.status_icon.set_from_file(red) gobject.timeout_add(2000, self.on_timeout) return else: self.status_icon.set_from_file(yellow) self.write_message(message) while gtk.events_pending(): gtk.main_iteration() if self.chunk_hexfile.get_active(): message = chunkhexfile.chunk_hexfile(hex_file_path) if message == None: self.write_message('\nChoose a valid hexfile') while gtk.events_pending(): gtk.main_iteration() else: self.write_message(message) while gtk.events_pending(): gtk.main_iteration() self.write_message('\n Searching for PIC ...') #Reset PIC by software RESET_RTS = self.rts_checkbutton.get_active() for i in range(0, 15): progress = (i + 1) / 15.0 while gtk.events_pending(): gtk.main_iteration() self.progress_bar.set_fraction(progress) print 'Not found press PIC reset...' type, max_flash, family, message = detectpic.check_pic( PORT, BAUD, RESET_RTS) if max_flash != None: break if self.want_to_abort: self.want_to_abort = False break #if after ask several times PIC ide tinybld dont have a vali max_flask #return an error message if max_flash == None: self.write_message(message) self.abort_button.hide() self.status_icon.set_from_file(red) self.progress_bar.set_fraction(0) gobject.timeout_add(2000, self.on_timeout) return else: self.write_message(message) while gtk.events_pending(): gtk.main_iteration() #Reset PIC by software rts = self.rts_checkbutton.get_active() #Activate GPIO Pin while programming gpio = self.gpio_checkbutton.get_active() start = time.time() #Transfering file write_status = transferhex.transfer_hex(Tinybldlin, hex_file_path, PORT, BAUD, type, max_flash, family, rts, gpio) end = time.time() if write_status == 'OK': self.write_message('\n Write OK at ' + str(begin) + ' time: ' + str(end - start)[0:5] + ' sec') self.progress_bar.set_fraction(0) self.abort_button.hide() self.status_icon.set_from_file(green) gobject.timeout_add(2000, self.on_timeout)
def on_checkpic_button_clicked(self, widget): print #Showing abort button self.abort_button.show() #Getting serial port and boud rate values PORT=self.port_entry.get_text() BAUD=self.speed_combo.get_active_text() #Asigning some variables type,max_flash,family=None,None,None #checking if there's port availeble c,message=detectpic.check_conection(PORT, BAUD) #If tinybld cant connect to selected port return error message if c==False: print message self.write_message(message) self.abort_button.hide() self.status_icon.set_from_file(red) gobject.timeout_add(2000, self.on_timeout) return type,max_flash,family else: self.status_icon.set_from_file(yellow) self.write_message(message) self.write_message('\n Searching for PIC ...') #Reset PIC by software RESET_RTS=self.rts_checkbutton.get_active() for i in range(0,15): progress = (i+1)/15.0 while gtk.events_pending(): gtk.main_iteration() self.progress_bar.set_fraction(progress) type,max_flash,family,message=detectpic.check_pic(PORT,BAUD,RESET_RTS) if max_flash!=None: break if self.want_to_abort: self.want_to_abort=False break print 'Not found press PIC reset...' #if after ask several times PIC ide tinybld dont have a vali max_flask #return an error message if max_flash==None: print message self.write_message(message) self.abort_button.hide() self.status_icon.set_from_file(red) self.progress_bar.set_fraction(0) gobject.timeout_add(2000, self.on_timeout) return type,max_flash,family print message self.write_message(message) self.progress_bar.set_fraction(0) self.abort_button.hide() self.status_icon.set_from_file(green) gobject.timeout_add(2000, self.on_timeout) return type,max_flash,family
def on_write_button_clicked(self, widget): begin=time.strftime("%H:%M", time.localtime()) PORT=self.port_entry.get_text() BAUD=self.speed_combo.get_active_text() hex_file_path=self.hex_file_entry.get_text() #Test of GPIO functionality message='\nGPIO option is '+str(self.gpio_checkbutton.get_active()) self.write_message(message) #checking if there's port availeble c,message=detectpic.check_conection(PORT, BAUD) #If tinybld cant connect to selected port return error message if c==False: print message self.write_message(message) while gtk.events_pending(): gtk.main_iteration() self.abort_button.hide() self.status_icon.set_from_file(red) gobject.timeout_add(2000, self.on_timeout) return else: self.status_icon.set_from_file(yellow) self.write_message(message) while gtk.events_pending(): gtk.main_iteration() if self.chunk_hexfile.get_active(): message = chunkhexfile.chunk_hexfile(hex_file_path) if message==None: self.write_message('\nChoose a valid hexfile') while gtk.events_pending(): gtk.main_iteration() else: self.write_message(message) while gtk.events_pending(): gtk.main_iteration() self.write_message('\n Searching for PIC ...') #Reset PIC by software RESET_RTS=self.rts_checkbutton.get_active() for i in range(0,15): progress = (i+1)/15.0 while gtk.events_pending(): gtk.main_iteration() self.progress_bar.set_fraction(progress) print 'Not found press PIC reset...' type,max_flash,family,message=detectpic.check_pic(PORT,BAUD,RESET_RTS) if max_flash!=None: break if self.want_to_abort: self.want_to_abort=False break #if after ask several times PIC ide tinybld dont have a vali max_flask #return an error message if max_flash==None: self.write_message(message) self.abort_button.hide() self.status_icon.set_from_file(red) self.progress_bar.set_fraction(0) gobject.timeout_add(2000, self.on_timeout) return else: self.write_message(message) while gtk.events_pending(): gtk.main_iteration() #Reset PIC by software rts=self.rts_checkbutton.get_active() #Activate GPIO Pin while programming gpio=self.gpio_checkbutton.get_active() start = time.time() #Transfering file write_status=transferhex.transfer_hex(Tinybldlin,hex_file_path,PORT,BAUD,type,max_flash,family,rts,gpio) end = time.time() if write_status=='OK': self.write_message('\n Write OK at ' +str(begin)+' time: '+str(end-start)[0:5]+' sec') self.progress_bar.set_fraction(0) self.abort_button.hide() self.status_icon.set_from_file(green) gobject.timeout_add(2000, self.on_timeout)