diff --git a/plugins/USBPrinting/avr_isp/intelHex.py b/plugins/USBPrinting/avr_isp/intelHex.py index 4444006b3d..6e27595587 100644 --- a/plugins/USBPrinting/avr_isp/intelHex.py +++ b/plugins/USBPrinting/avr_isp/intelHex.py @@ -5,6 +5,8 @@ See: http://en.wikipedia.org/wiki/Intel_HEX This is a python 3 conversion of the code created by David Braam for the Cura project. """ import io +from UM.Logger import Logger + def readHex(filename): """ @@ -41,6 +43,6 @@ def readHex(filename): elif rec_type == 2: #Extended Segment Address Record extra_addr = int(line[9:13], 16) * 16 else: - print(rec_type, rec_len, addr, check_sum, line) + Logger.log("d", "%s, %s, %s, %s, %s", rec_type, rec_len, addr, check_sum, line) f.close() return data diff --git a/plugins/USBPrinting/avr_isp/ispBase.py b/plugins/USBPrinting/avr_isp/ispBase.py index fbd3bf091f..077cfc36e6 100644 --- a/plugins/USBPrinting/avr_isp/ispBase.py +++ b/plugins/USBPrinting/avr_isp/ispBase.py @@ -8,6 +8,7 @@ The ISP AVR programmer can load firmware into AVR chips. Which are commonly used """ from . import chipDB +from UM.Logger import Logger class IspBase(): """ @@ -22,11 +23,11 @@ class IspBase(): raise IspError("Chip with signature: " + str(self.getSignature()) + "not found") self.chipErase() - print("Flashing %i bytes" % len(flash_data)) + Logger.log("d", "Flashing %i bytes", len(flash_data)) self.writeFlash(flash_data) - print("Verifying %i bytes" % len(flash_data)) + Logger.log("d", "Verifying %i bytes", len(flash_data)) self.verifyFlash(flash_data) - print("Completed") + Logger.log("d", "Completed") def getSignature(self): """ diff --git a/plugins/USBPrinting/avr_isp/stk500v2.py b/plugins/USBPrinting/avr_isp/stk500v2.py index afdb50553e..3bbecb06c2 100644 --- a/plugins/USBPrinting/avr_isp/stk500v2.py +++ b/plugins/USBPrinting/avr_isp/stk500v2.py @@ -11,6 +11,7 @@ import time from serial import Serial from serial import SerialException from serial import SerialTimeoutException +from UM.Logger import Logger from . import ispBase, intelHex @@ -84,7 +85,7 @@ class Stk500v2(ispBase.IspBase): #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 flash_size = page_size * self.chip["pageCount"] - print("Writing flash") + Logger.log("d", "Writing flash") if flash_size > 0xFFFF: self.sendMessage([0x06, 0x80, 0x00, 0x00, 0x00]) else: @@ -151,7 +152,6 @@ class Stk500v2(ispBase.IspBase): raise ispBase.IspError("Timeout") b = struct.unpack(">B", s)[0] checksum ^= b - #print(hex(b)) if state == "Start": if b == 0x1B: state = "GetSeq" @@ -206,7 +206,7 @@ def main(): """ Entry point to call the stk500v2 programmer from the commandline. """ import threading if sys.argv[1] == "AUTO": - print(portList()) + Logger.log("d", portList()) for port in portList(): threading.Thread(target=runProgrammer, args=(port,sys.argv[2])).start() time.sleep(5)