mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -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
|
@ -20,8 +20,8 @@ class Stk500v2(ispBase.IspBase):
|
|||
self.serial = None
|
||||
self.seq = 1
|
||||
self.last_addr = -1
|
||||
self.progressCallback = None
|
||||
|
||||
self.progress_callback = None
|
||||
|
||||
def connect(self, port = "COM22", speed = 115200):
|
||||
if self.serial is not None:
|
||||
self.close()
|
||||
|
@ -69,7 +69,7 @@ class Stk500v2(ispBase.IspBase):
|
|||
self.serial = None
|
||||
return ret
|
||||
return None
|
||||
|
||||
|
||||
def isConnected(self):
|
||||
return self.serial is not None
|
||||
|
||||
|
@ -79,7 +79,7 @@ class Stk500v2(ispBase.IspBase):
|
|||
def sendISP(self, data):
|
||||
recv = self.sendMessage([0x1D, 4, 4, 0, data[0], data[1], data[2], data[3]])
|
||||
return recv[2:6]
|
||||
|
||||
|
||||
def writeFlash(self, flash_data):
|
||||
#Set load addr to 0, in case we have more then 64k flash we need to enable the address extension
|
||||
page_size = self.chip["pageSize"] * 2
|
||||
|
@ -89,15 +89,15 @@ class Stk500v2(ispBase.IspBase):
|
|||
self.sendMessage([0x06, 0x80, 0x00, 0x00, 0x00])
|
||||
else:
|
||||
self.sendMessage([0x06, 0x00, 0x00, 0x00, 0x00])
|
||||
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)):
|
||||
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:
|
||||
self.progressCallback(i + 1, load_count)
|
||||
self.progress_callback(i + 1, load_count)
|
||||
else:
|
||||
self.progressCallback(i + 1, load_count * 2)
|
||||
|
||||
self.progress_callback(i + 1, load_count * 2)
|
||||
|
||||
def verifyFlash(self, flash_data):
|
||||
if self._has_checksum:
|
||||
self.sendMessage([0x06, 0x00, (len(flash_data) >> 17) & 0xFF, (len(flash_data) >> 9) & 0xFF, (len(flash_data) >> 1) & 0xFF])
|
||||
|
@ -120,8 +120,8 @@ class Stk500v2(ispBase.IspBase):
|
|||
load_count = (len(flash_data) + 0xFF) / 0x100
|
||||
for i in range(0, int(load_count)):
|
||||
recv = self.sendMessage([0x14, 0x01, 0x00, 0x20])[2:0x102]
|
||||
if self.progressCallback is not None:
|
||||
self.progressCallback(load_count + i + 1, load_count * 2)
|
||||
if self.progress_callback is not None:
|
||||
self.progress_callback(load_count + i + 1, load_count * 2)
|
||||
for j in range(0, 0x100):
|
||||
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))
|
||||
|
@ -141,7 +141,7 @@ class Stk500v2(ispBase.IspBase):
|
|||
raise ispBase.IspError("Serial send timeout")
|
||||
self.seq = (self.seq + 1) & 0xFF
|
||||
return self.recvMessage()
|
||||
|
||||
|
||||
def recvMessage(self):
|
||||
state = "Start"
|
||||
checksum = 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue