mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Code-style fixes
CURA-2079
This commit is contained in:
parent
b619b68675
commit
2a55bba840
2 changed files with 18 additions and 18 deletions
|
@ -185,7 +185,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
return
|
return
|
||||||
|
|
||||||
programmer = stk500v2.Stk500v2()
|
programmer = stk500v2.Stk500v2()
|
||||||
programmer.progressCallback = self.setProgress
|
programmer.progress_callback = self.setProgress
|
||||||
|
|
||||||
try:
|
try:
|
||||||
programmer.connect(self._serial_port)
|
programmer.connect(self._serial_port)
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Stk500v2(ispBase.IspBase):
|
||||||
self.serial = None
|
self.serial = None
|
||||||
self.seq = 1
|
self.seq = 1
|
||||||
self.last_addr = -1
|
self.last_addr = -1
|
||||||
self.progressCallback = None
|
self.progress_callback = None
|
||||||
|
|
||||||
def connect(self, port = "COM22", speed = 115200):
|
def connect(self, port = "COM22", speed = 115200):
|
||||||
if self.serial is not None:
|
if self.serial is not None:
|
||||||
|
@ -92,11 +92,11 @@ class Stk500v2(ispBase.IspBase):
|
||||||
load_count = (len(flash_data) + page_size - 1) / page_size
|
load_count = (len(flash_data) + page_size - 1) / page_size
|
||||||
for i in range(0, int(load_count)):
|
for i in range(0, int(load_count)):
|
||||||
recv = self.sendMessage([0x13, page_size >> 8, page_size & 0xFF, 0xc1, 0x0a, 0x40, 0x4c, 0x20, 0x00, 0x00] + flash_data[(i * page_size):(i * page_size + page_size)])
|
recv = self.sendMessage([0x13, page_size >> 8, page_size & 0xFF, 0xc1, 0x0a, 0x40, 0x4c, 0x20, 0x00, 0x00] + flash_data[(i * page_size):(i * page_size + page_size)])
|
||||||
if self.progressCallback is not None:
|
if self.progress_callback is not None:
|
||||||
if self._has_checksum:
|
if self._has_checksum:
|
||||||
self.progressCallback(i + 1, load_count)
|
self.progress_callback(i + 1, load_count)
|
||||||
else:
|
else:
|
||||||
self.progressCallback(i + 1, load_count * 2)
|
self.progress_callback(i + 1, load_count * 2)
|
||||||
|
|
||||||
def verifyFlash(self, flash_data):
|
def verifyFlash(self, flash_data):
|
||||||
if self._has_checksum:
|
if self._has_checksum:
|
||||||
|
@ -120,8 +120,8 @@ class Stk500v2(ispBase.IspBase):
|
||||||
load_count = (len(flash_data) + 0xFF) / 0x100
|
load_count = (len(flash_data) + 0xFF) / 0x100
|
||||||
for i in range(0, int(load_count)):
|
for i in range(0, int(load_count)):
|
||||||
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.progress_callback is not None:
|
||||||
self.progressCallback(load_count + i + 1, load_count * 2)
|
self.progress_callback(load_count + i + 1, load_count * 2)
|
||||||
for j in range(0, 0x100):
|
for j in range(0, 0x100):
|
||||||
if i * 0x100 + j < len(flash_data) and flash_data[i * 0x100 + j] != recv[j]:
|
if i * 0x100 + j < len(flash_data) and flash_data[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