1 (edited by pricecg44 2015-01-26 03:42:11)

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.

2

Re: python comm with davinci

Haven't tried this but it seems very interesting. Are you running stock firmware or Repetier?

Davinci Duo, Repetier 0.92, OctoPi

3

Re: python comm with davinci

Just xyzware firmware. Don't want to touch firmware yet. Just playing with code.

4 (edited by pricecg44 2015-02-01 06:30:31)

Re: python comm with davinci

I will try the alternative wifi sd card. Unfortunately there is no local micro sd card wifi (anywhere too small?)
I got a standard sd wifi card and attempted a diy micro to sd card convertor. It failed with no card initiation.
But have just ordered this
http://www.dx.com/p/sd-to-microsd-trans … M3Hryjq9Wa

5

Re: python comm with davinci

If that doesn't work for you and you have a raspberry pi lying around, you can always go the OctoPrint route and effectively use the Pi as a print server. I believe OctoPrint is actually already written in Python, so they've already dealt with the communication to the printer. However, if you want to play, you can always ssh in to the Pi and write to the serial port attached to the USB comm.

Davinci Duo, Repetier 0.92, OctoPi

6 (edited by pricecg44 2015-02-01 23:46:00)

Re: python comm with davinci

Can I ssh from a mac to the xyz printer on the usb?  Now where's that cd from the xyzprinting box to install it on the mac (pc scripting environment is lacking)?
The pi route I will not try. Once I have a wifi connection to the printer I hope to have a perl script that monitors the
offline gcode file, note any modification date change and then do any gcode file change, upload it before the firmware reads the file
if that is possible. 

But I still would like to do sd card upload and print inititation without the xyzware crappoware.
I want the xyzware on the mac so i can
sniff its usb traffic a bit more than that previous thread did. I've got a python usb library for that.

7 (edited by carl_m1968 2015-02-02 00:22:42)

Re: python comm with davinci

Why not just load the gcode to sdcard and then print from the printers LCD? Just name the gcode one of the sample file names like SAMPLE01 and then call it up on the LCD and print it. There is no altering firmware or software and you can use any slicer you want. You just have to change all the G0 commands to G1 as the firmware does not understand G0 which is fast moves.

Just get an extension cable and route it so the card is inside the print area where you can get to it easily.

Printing since 2009 and still love it!
Anycubic 4MAX best $225 ever invested.
Voxelabs Proxima SLA. 6 inch 2k Mono LCD.
Anycubic Predator, massive Delta machine. 450 x 370 print envelope.

8 (edited by pricecg44 2015-02-02 00:35:52)

Re: python comm with davinci

Absolutely will not muck around grabbing the micro SD card from the back of the print every time I need to change something. It must be wifi or usb.

9 (edited by carl_m1968 2015-02-02 02:07:15)

Re: python comm with davinci

pricecg44 wrote:

Absolutely will not muck around grabbing the micro SD card from the back of the print every time I need to change something. It must be wifi or usb.


You are somewhat of a selective reader?

I said get an sd card extension cable and relocate the card to inside of the print area. Mine is just below the bed where I can easily reach it. I have to print from the card all the time due to a weird bug with my version of Repetier host that won't allow a print that goes over 20 minutes.

They do make them for micro SD, you just have to order on Ebay from China.

Printing since 2009 and still love it!
Anycubic 4MAX best $225 ever invested.
Voxelabs Proxima SLA. 6 inch 2k Mono LCD.
Anycubic Predator, massive Delta machine. 450 x 370 print envelope.

10

Re: python comm with davinci

pricecg44 wrote:

The pi route I will not try.

I don't really understand why - you get that the Pi just connects to the USB port, right? Might want to take a moment and actually check out Octoprint before ruling it out.

In any case, best of luck to ya.

Davinci Duo, Repetier 0.92, OctoPi

11

Re: python comm with davinci

sorry for mis reading you. I have an post attention deficit syndrome. I occassionally do not read fully, skip  or simply miscomprehend posts.
Again sorry.

12

Re: python comm with davinci

I presume the xyzware binaryies up its gcode file for transmission to the printer with the checksum etc.
So one approach is to intercept the sent gcode when it is translated to the ascii on the sd card, but before it is
feed to the printer operation. Specifically the first use for me is to set the bed to 110.
Regards Pi, its all good but I have other hardware to use.