Пример #1
0
	def upload (self, code, port, board, boardMCU, boardBaudRate, pathToMain, pathToSketchbook):
		if port != None:
			args = "-v -F "+"-P "+ port +" -p "+ boardMCU +" -b "+ boardBaudRate+" -c arduino " + "-U flash:w:"+ self.tmpPath+":i"
			stdOut, stdErr = callAvrdude(args)
			errorReport = self.avrdudeStderr(stdErr)
			return {'status':errorReport['status'],'errorReport':errorReport,'stdOut':stdOut,'stdErr':stdErr}
		else:
			return {'status':'KO','error':'no port'}
Пример #2
0
	def searchPort (self):
		availablePorts = self.getAvailablePorts()
		if len(availablePorts) <=0:
			return []
		ports = []
		for port in availablePorts:
			args = "-P "+port+" -p "+ self.getBoardMCU() +" -b "+ self.getBoardBaudRate()+" -c arduino"
			output, err = callAvrdude(args);
			if 'Device signature =' in output or 'Device signature =' in err:
				ports.append(port)
		if len(ports)==1:
			self.setPort(ports[0])
		return ports