mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 08:17:49 -06:00
Bugfixes to usb printing
This commit is contained in:
parent
34aac653b4
commit
a07781fa26
4 changed files with 11 additions and 8 deletions
|
@ -9,7 +9,7 @@ Rectangle
|
||||||
|
|
||||||
Text
|
Text
|
||||||
{
|
{
|
||||||
text: "Updating firmware
|
text: "Updating firmware"
|
||||||
}
|
}
|
||||||
ProgressBar
|
ProgressBar
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,9 +117,9 @@ class PrinterConnection(SignalEmitter):
|
||||||
self._connect_thread.start()
|
self._connect_thread.start()
|
||||||
|
|
||||||
def updateFirmware(self, file_name):
|
def updateFirmware(self, file_name):
|
||||||
|
print("Update firmware; " , self._is_connecting, " ", self._is_connected )
|
||||||
if self._is_connecting or self._is_connected:
|
if self._is_connecting or self._is_connected:
|
||||||
return False
|
self.close()
|
||||||
|
|
||||||
hex_file = intelHex.readHex(file_name)
|
hex_file = intelHex.readHex(file_name)
|
||||||
if len(hex_file) == 0:
|
if len(hex_file) == 0:
|
||||||
Logger.log('e', "Unable to read provided hex file. Could not update firmware")
|
Logger.log('e', "Unable to read provided hex file. Could not update firmware")
|
||||||
|
@ -136,7 +136,7 @@ class PrinterConnection(SignalEmitter):
|
||||||
programmer.programChip(hex_file)
|
programmer.programChip(hex_file)
|
||||||
self._updating_firmware = False
|
self._updating_firmware = False
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Logger.log("e", "Exception while trying to update firmware" , e)
|
Logger.log("e", "Exception while trying to update firmware %s" %e)
|
||||||
self._updating_firmware = False
|
self._updating_firmware = False
|
||||||
return False
|
return False
|
||||||
programmer.close()
|
programmer.close()
|
||||||
|
@ -173,6 +173,9 @@ class PrinterConnection(SignalEmitter):
|
||||||
self._sendCommand("M105") #Request temperature, as this should (if baudrate is correct) result in a command with 'T:' in it
|
self._sendCommand("M105") #Request temperature, as this should (if baudrate is correct) result in a command with 'T:' in it
|
||||||
while timeout_time > time.time():
|
while timeout_time > time.time():
|
||||||
line = self._readline()
|
line = self._readline()
|
||||||
|
if line is None:
|
||||||
|
self.setIsConnected(False) # something went wrong with reading, could be that close was called.
|
||||||
|
return
|
||||||
if b"T:" in line:
|
if b"T:" in line:
|
||||||
self._serial.timeout = 0.5
|
self._serial.timeout = 0.5
|
||||||
self._serial.write(b"\n")
|
self._serial.write(b"\n")
|
||||||
|
|
|
@ -34,7 +34,7 @@ def readHex(filename):
|
||||||
if recType == 0:#Data record
|
if recType == 0:#Data record
|
||||||
while len(data) < addr + recLen:
|
while len(data) < addr + recLen:
|
||||||
data.append(0)
|
data.append(0)
|
||||||
for i in xrange(0, recLen):
|
for i in range(0, recLen):
|
||||||
data[addr + i] = int(line[i*2+9:i*2+11], 16)
|
data[addr + i] = int(line[i*2+9:i*2+11], 16)
|
||||||
elif recType == 1: #End Of File record
|
elif recType == 1: #End Of File record
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -86,7 +86,7 @@ class Stk500v2(ispBase.IspBase):
|
||||||
self.sendMessage([0x06, 0x00, 0x00, 0x00, 0x00])
|
self.sendMessage([0x06, 0x00, 0x00, 0x00, 0x00])
|
||||||
|
|
||||||
loadCount = (len(flashData) + pageSize - 1) / pageSize
|
loadCount = (len(flashData) + pageSize - 1) / pageSize
|
||||||
for i in xrange(0, loadCount):
|
for i in range(0, loadCount):
|
||||||
recv = self.sendMessage([0x13, pageSize >> 8, pageSize & 0xFF, 0xc1, 0x0a, 0x40, 0x4c, 0x20, 0x00, 0x00] + flashData[(i * pageSize):(i * pageSize + pageSize)])
|
recv = self.sendMessage([0x13, pageSize >> 8, pageSize & 0xFF, 0xc1, 0x0a, 0x40, 0x4c, 0x20, 0x00, 0x00] + flashData[(i * pageSize):(i * pageSize + pageSize)])
|
||||||
if self.progressCallback is not None:
|
if self.progressCallback is not None:
|
||||||
if self._has_checksum:
|
if self._has_checksum:
|
||||||
|
@ -114,11 +114,11 @@ class Stk500v2(ispBase.IspBase):
|
||||||
self.sendMessage([0x06, 0x00, 0x00, 0x00, 0x00])
|
self.sendMessage([0x06, 0x00, 0x00, 0x00, 0x00])
|
||||||
|
|
||||||
loadCount = (len(flashData) + 0xFF) / 0x100
|
loadCount = (len(flashData) + 0xFF) / 0x100
|
||||||
for i in xrange(0, loadCount):
|
for i in range(0, loadCount):
|
||||||
recv = self.sendMessage([0x14, 0x01, 0x00, 0x20])[2:0x102]
|
recv = self.sendMessage([0x14, 0x01, 0x00, 0x20])[2:0x102]
|
||||||
if self.progressCallback is not None:
|
if self.progressCallback is not None:
|
||||||
self.progressCallback(loadCount + i + 1, loadCount*2)
|
self.progressCallback(loadCount + i + 1, loadCount*2)
|
||||||
for j in xrange(0, 0x100):
|
for j in range(0, 0x100):
|
||||||
if i * 0x100 + j < len(flashData) and flashData[i * 0x100 + j] != recv[j]:
|
if i * 0x100 + j < len(flashData) and flashData[i * 0x100 + j] != recv[j]:
|
||||||
raise ispBase.IspError('Verify error at: 0x%x' % (i * 0x100 + j))
|
raise ispBase.IspError('Verify error at: 0x%x' % (i * 0x100 + j))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue