def loadFirmware(self, hexBaudRate, clearEEPROM): avr_dude = AvrDude(port=profile.getProfileSetting('serial_name'), baudRate=hexBaudRate) extraFlags = [] if clearEEPROM: extraFlags = ["-D"] self.count = -50 out = avr_dude.flash(extraFlags=extraFlags, hexPath=self.hexPath, callback=self.incrementProgress) if 'not in sync' in out or 'Invalid' in out: wx.CallAfter(self.wrongBoardMessage) wx.CallAfter(self.afterLoadFirmware)
def loadFirmware(self, hexBaudRate, clearEEPROM): avr_dude = AvrDude(port=profile.getProfileSetting('serial_name'), baudRate=hexBaudRate) extraFlags = [] if clearEEPROM: extraFlags = ["-D"] proc = avr_dude.flash(extraFlags=extraFlags) #TODO: fails if change board count = -50 while count < 100: if proc: try: out = proc.stderr.read() if 'not in sync' in out or 'Invalid' in out: wx.CallAfter(self.wrongBoardMessage) break count += out.count('#') if count >= 0: self.gauge.SetValue(count) except IOError: count += 10 wx.CallAfter(self.afterLoadFirmware)
def loadFirmware(self, hexBaudRate, clearEEPROM): avr_dude = AvrDude(port=profile.getProfileSetting('serial_name'), baudRate=hexBaudRate) extraFlags = [] if clearEEPROM: extraFlags = ["-D"] proc = avr_dude.flash( extraFlags=extraFlags) #TODO: fails if change board count = -50 while count < 100: if proc: try: out = proc.stderr.read() if 'not in sync' in out or 'Invalid' in out: wx.CallAfter(self.wrongBoardMessage) break count += out.count('#') if count >= 0: self.gauge.SetValue(count) except IOError: pass wx.CallAfter(self.afterLoadFirmware)