Topic: python comm with davinci
Has anyone tried the python communication script?
I tried to use it to send the minimal.gcode file to the
printer but it came back with the checksum failure.
It does the reporting stuff fine.
I found on the repetier sites a mention of the fletcher-16 being the
checksum algo. heres a python impl:
def checksumByXOR(text):
cs = 0
for x in str(text):
cs ^= ord(x)
return cs
def readn(fin, n):
s = 0
for ti in fin.read(n):
s = s * 256 + ord(ti)
return s
def fletcher(fin, k):
if k not in (16, 32, 64):
raise ValueError("Valid choices of k are 16, 32 and 64")
nbytes = k // 16
mod = 2 ** (8 * nbytes) - 1
s = s2 = 0
t = readn(fin, nbytes)
while t:
s += t
s2 += s
t = readn(fin, nbytes)
return s % mod + (mod + 1) * (s2 % mod)Still having the checksum failure, suspect it is where you place the checksum in the transmission.
