126

Re: print gcode files to miniMaker

Whew, the network code has been giving me fits for a while, but I think I have a handle on it now.  I just checked in code that appears to be behaving well.  At least I can repeatably get the status information using the command line version of miniMover.  That works both on linux and windows as well!

I still have  a lot more testing to do, and some details to polish up before I can make a proper release, but I can see the light at the end of the tunnel now.

Networking by its very nature seems more fiddly than serial, and XYZ seems to have a few bugs in it that add to the difficulty.  On top of that the api's are just many times more complex so there are more ways to goof it all up.  Right now the big fix seems to be adding a wait around any transmissions to the printer so we don't flood it with data.  That and cleaning up my logic so I don't make unnecessary calls, that helps as well smile

127

Re: print gcode files to miniMaker

So while I was working on this it occurred to me that I could use this code to make a wifi to usb bridge without too much more work.  I could use a raspberry pi zero w to handle the conversion, that runs linux and comes with both a wifi adapter and usb port for $10 (if you skip out on a power supply and sd card).

128

Re: print gcode files to miniMaker

I'm still making progress on the wifi protocol, however it is proving difficult to make it reliable and fast at the same time.

For starters it is a frustrating protocol to implement.  When receiving a response from a message we sometimes get nothing in return, sometimes an ok, sometimes an ok with a $, and occasionally an error code.  Wifi usually returns less than the serial connection.  Some queries return json, some return raw values and one (query=a) returns a series of returns that may be terminated with a $ and may not.  All of that makes it difficult to know exactly how many bytes should be returned, and in turn leads to unnecessary delays.

On top of that the wifi protocol was written in an inefficient way.  It takes many cycles for it to respond to any request, even more cycles just to handle the initial connection.  And when it does communicate it sends way too many packets of data.  Network packets work best when you pack as much data as possible into a single packet.  However this protocol makes a new packet for every line of data, in the query=a case that means 30 or so packets for what could have taken only one.

Finally the wifi protocol is particularly bad at recovering from any error.  If I send a request too fast it locks up and refuses to take any other message, however there is no clear indicator of when the system is ready to receive a message.

In short any query to wifi is currently taking about a second to complete, and connecting to the machine takes up to 5 seconds.  Both of those should be in the tens of milliseconds even in its current form, something is really slowing things down.  I don't think this is  a byproduct of my code, the XYZWare application is just as sluggish over wifi.  It does give me hope that a serial to wifi bridge can be made that is much more efficient then there implementation.

Finally the socket library on windows is very complex and frankly a bit overwhelming.  There are three major ways you can use the library (and a few windows specific variants on the third way) and I have currently tried two of the three ways, both have proven to be unreliable.  I'm looking into writing something using the third variant, but that will require a complete refactoring of how I communicate with the printer.  That may end up being a good thing in the end, but it will add a lot of complexity.

In short, I'm frustrated and needed to vent a bit, however I am making progress.

129

Re: print gcode files to miniMaker

@ david. tucker
While i do not own a xyz printer i want to pop in and tell you your progress reports are being read and your work you are providing the community is appreciated.

Tin Falcon

Soliddoodle 4 stock w glass bed------Folger Tech Prusa 2020 upgraded to and titan /aero extruder mirror bed
FT5 with titan/ E3D Aero------MP mini select w glass bed
MP Utimate maker pro-W bondtech extruder
Marlin/Repetier Host/ Slic3r and Cura

130 (edited by lawrence_jeff 2018-06-30 18:14:41)

Re: print gcode files to miniMaker

Instead of reverse engineering the wifi protocol - what about integrating with octoprint in some way (for example moving your code into a plugin of some sort) so you can leverage octoprint for all the wifi part as well as the other benefits it provides (like video monitoring)

Here is an example plugin that does something similiar (proprietary protocol)
https://plugins.octoprint.org/plugins/gpx/

Either way just picked up a new Jr wifi for $110 so excited to try your stuff once I print a few times with the normal software to make sure i have a baseline

131

Re: print gcode files to miniMaker

I made some progress today, the UI is now working relatively smoothly over wifi.  I was able to measure the speed, wifi is in fact 10x slower than serial, at least for the simple commands.  I still need to test actually printing over wifi, we will see how slow that is.

132

Re: print gcode files to miniMaker

lawrence_jeff wrote:

Instead of reverse engineering the wifi protocol - what about integrating with octoprint in some way (for example moving your code into a plugin of some sort) so you can leverage octoprint for all the wifi part as well as the other benefits it provides (like video monitoring)

Here is an example plugin that does something similiar (proprietary protocol)
https://plugins.octoprint.org/plugins/gpx/

Either way just picked up a new Jr wifi for $110 so excited to try your stuff once I print a few times with the normal software to make sure i have a baseline

I have thought about making an octoprint plugin.  It is on my list to look into it.

Let me know how my code works with your Jr, I don't have any data yet from a Jr so I would be very curious to get any info you can on how it works with my code.

133

Re: print gcode files to miniMaker

I tried to dust off my old Raspberry Pi to install OctoPi on it, however I already canabalized the wifi dongle for another project.  So while I wait for the new dongle to arrive I went ahead and installed OctoPrint on my linux virtual drive.  I figured I may as well poke around and see what octoprint can do.

134

Re: print gcode files to miniMaker

Oh, and I think things are in a good spot for a new build release, however I want to take some time to test it before pushing it out.  And that means getting off my bum and actually printing with my 3D printer rather than just writing code for it.

135

Re: print gcode files to miniMaker

david.tucker wrote:

I tried to dust off my old Raspberry Pi to install OctoPi on it, however I already canabalized the wifi dongle for another project.  So while I wait for the new dongle to arrive I went ahead and installed OctoPrint on my linux virtual drive.  I figured I may as well poke around and see what octoprint can do.


Here is the source to that plugin that seems similiar in concept to what would be needed here
https://github.com/markwal/OctoPrint-GPX

Another plugin that shows how to add custom UI elements into the control panel. This would be where you could add the functions from the buttons in your app
https://plugins.octoprint.org/plugins/CR10_Leveling/

Again just a suggestion, not being trying to be pushy as an octoprint user as soon as I saw your app it just seemed such a good fit. A couple other benefits

  • You can print directly from cura if you have the extension (makes an octoprint connected printer show up as local)
    If you have multiple printers you can manage them with one octoprint instance so the workflow is basically the same and you could hide all this XYZ crazyness

I printed my first item today using stock code, will try your app soon

136

Re: print gcode files to miniMaker

Thanks for your notes Lawrence, I took a look at some of them and will try to work my way through the rest.

So I poked around a bit on this.  I managed to go through the octoprint plugin tutorial at least.  It is not clear where to go from there, but there is still a lot of documentation to dig through.

I also started poking into the GPX plugin, it is relatively complex, but there seems to be some promising hints in there.  I was hoping for something simpler, like a 'print this file' override, but that does not seem to be the case.  I guess anything worth doing is bound to be difficult smile

Finally I looked into hooking python up to c code.  It should not be too hard to wrap my base library with the python ctypes library.  I may need to make a pure C wrapper around my code, it is not clear to me if that is needed.  In any event that is all down to busy work, it should not be hard to pull off.

Anyway no guarantee that this will work, but it does have potential.

137

Re: print gcode files to miniMaker

http://soliforum.com/i/?SjDbPXM.png

Here is a screen shot of linux wifi working.

138

Re: print gcode files to miniMaker

Ive looked into getting octoprint to work with da vinci printers, it would be a complete rehaul on the code.

so I saw this.

http://www.soliforum.com/topic/16702/we … r-windows/

im using this as a web menu and modded both this and minimover to print & monitor over serial on a ARM cpu device.

139

Re: print gcode files to miniMaker

x1800MODMY360x wrote:

Ive looked into getting octoprint to work with da vinci printers, it would be a complete rehaul on the code.

so I saw this.

http://www.soliforum.com/topic/16702/we … r-windows/

im using this as a web menu and modded both this and minimover to print & monitor over serial on a ARM cpu device.

That looks interesting, out of curiosity in your attempts did you look at the plugin example I referenced. I glanced through the code (and the GPX conversion code it references) and it doesn't seem to difficult for the job at hand, it picks up the file from octoprint and converts it on the fly and then streams the converted file. The conversion details are different but that seems a solved problem with threedub and this utility.

140

Re: print gcode files to miniMaker

lawrence_jeff wrote:
x1800MODMY360x wrote:

Ive looked into getting octoprint to work with da vinci printers, it would be a complete rehaul on the code.

so I saw this.

http://www.soliforum.com/topic/16702/we … r-windows/

im using this as a web menu and modded both this and minimover to print & monitor over serial on a ARM cpu device.

That looks interesting, out of curiosity in your attempts did you look at the plugin example I referenced. I glanced through the code (and the GPX conversion code it references) and it doesn't seem to difficult for the job at hand, it picks up the file from octoprint and converts it on the fly and then streams the converted file. The conversion details are different but that seems a solved problem with threedub and this utility.

My issue is to code/recode octoprint with the da vinci printer communications and to me be a big hassle to achieve.

Plus my printer the vinci Pro can only list status, some conf changes and print(pause,resume, and cancel). Most of the commands dont work with it.

141

Re: print gcode files to miniMaker

david.tucker wrote:
lawrence_jeff wrote:

Instead of reverse engineering the wifi protocol - what about integrating with octoprint in some way (for example moving your code into a plugin of some sort) so you can leverage octoprint for all the wifi part as well as the other benefits it provides (like video monitoring)

Here is an example plugin that does something similiar (proprietary protocol)
https://plugins.octoprint.org/plugins/gpx/

Either way just picked up a new Jr wifi for $110 so excited to try your stuff once I print a few times with the normal software to make sure i have a baseline

I have thought about making an octoprint plugin.  It is on my list to look into it.

Let me know how my code works with your Jr, I don't have any data yet from a Jr so I would be very curious to get any info you can on how it works with my code.


Not having much luck with your app and the JR. It detects it correctly and lists the printer details upon startup. However Homing, positional controls, setting the buzzer all fail to work.
I was hoping to use a debug log to see what is being sent so I can repro manually - but the creation of the existence of the debug.txt file doesn't seem to trigger logging nor is their a cmdline. Is there an easy way to flip this on  without recompiling your exe?

142 (edited by lawrence_jeff 2018-07-03 18:03:51)

Re: print gcode files to miniMaker

david.tucker wrote:
lawrence_jeff wrote:

Instead of reverse engineering the wifi protocol - what about integrating with octoprint in some way (for example moving your code into a plugin of some sort) so you can leverage octoprint for all the wifi part as well as the other benefits it provides (like video monitoring)

Here is an example plugin that does something similiar (proprietary protocol)
https://plugins.octoprint.org/plugins/gpx/

Either way just picked up a new Jr wifi for $110 so excited to try your stuff once I print a few times with the normal software to make sure i have a baseline

I have thought about making an octoprint plugin.  It is on my list to look into it.

Let me know how my code works with your Jr, I don't have any data yet from a Jr so I would be very curious to get any info you can on how it works with my code.


Not having much luck with your app and the JR. It detects it correctly and lists the printer details upon startup. However Homing, positional controls, setting the buzzer all fail to work.
I was hoping to use a debug log to see what is being sent so I can repro manually - but the creation of the existence of the debug.txt file doesn't seem to trigger logging nor is their a cmdline. Is there an easy way to flip this on  without recompiling your exe? (This is using v.9 from your releases by the way)

EDIT: Printing also fails. But if I start it in XYZWare your app successfully pulls status and % complete. So it seems all cmd functions fail but all status functions work

143

Re: print gcode files to miniMaker

lawrence_jeff wrote:
david.tucker wrote:
lawrence_jeff wrote:

Instead of reverse engineering the wifi protocol - what about integrating with octoprint in some way (for example moving your code into a plugin of some sort) so you can leverage octoprint for all the wifi part as well as the other benefits it provides (like video monitoring)

Here is an example plugin that does something similiar (proprietary protocol)
https://plugins.octoprint.org/plugins/gpx/

Either way just picked up a new Jr wifi for $110 so excited to try your stuff once I print a few times with the normal software to make sure i have a baseline

I have thought about making an octoprint plugin.  It is on my list to look into it.

Let me know how my code works with your Jr, I don't have any data yet from a Jr so I would be very curious to get any info you can on how it works with my code.


Not having much luck with your app and the JR. It detects it correctly and lists the printer details upon startup. However Homing, positional controls, setting the buzzer all fail to work.
I was hoping to use a debug log to see what is being sent so I can repro manually - but the creation of the existence of the debug.txt file doesn't seem to trigger logging nor is their a cmdline. Is there an easy way to flip this on  without recompiling your exe? (This is using v.9 from your releases by the way)

EDIT: Printing also fails. But if I start it in XYZWare your app successfully pulls status and % complete. So it seems all cmd functions fail but all status functions work

If the commands for move or other options are not working then that means the printer don't support it. It should print a 3w file though.

144

Re: print gcode files to miniMaker

x1800MODMY360x wrote:

Ive looked into getting octoprint to work with da vinci printers, it would be a complete rehaul on the code.

so I saw this.

http://www.soliforum.com/topic/16702/we … r-windows/

im using this as a web menu and modded both this and minimover to print & monitor over serial on a ARM cpu device.

Thanks for that, somehow I missed this project.  It looks very interesting.

145

Re: print gcode files to miniMaker

lawrence_jeff wrote:

Not having much luck with your app and the JR. It detects it correctly and lists the printer details upon startup. However Homing, positional controls, setting the buzzer all fail to work.
I was hoping to use a debug log to see what is being sent so I can repro manually - but the creation of the existence of the debug.txt file doesn't seem to trigger logging nor is their a cmdline. Is there an easy way to flip this on  without recompiling your exe? (This is using v.9 from your releases by the way)

EDIT: Printing also fails. But if I start it in XYZWare your app successfully pulls status and % complete. So it seems all cmd functions fail but all status functions work

Right, as x1800... said, only the mini w, miniMaker, and micro seem to support the majority of commands.  The other printers only support converting files, printing, and monitoring status.  That is all you can do with XYZWare as well.

It should be the case that you can print with my code, assuming your linking over serial/usb and not wifi, wifi is not printing yet.

Anyway the command line version is called miniMover.exe and you can get it from this link: https://github.com/reality-boy/miniMover/releases

If you run that and pass the -r command you will get a raw dump of the printer status.  Send me that output and I can double check that I'm using the right target printer when converting the file from gcode to 3w.  I suspect I may have something wrong there and that is stopping the printer from accepting the file.

146

Re: print gcode files to miniMaker

So to get wifi going I picked up a very abused mini w machine.  Some user had completely stripped it apart, probably after jamming it up good, and managed to break or loose a good number of parts in the process.  The good news is I can swap parts over from my miniMaker, and of course I only had to pay $60 for it...

Anyway my wifi communication has been so slow (with my code) that I was suspecting the wifi module may be damaged.  So as a test I swapped parts around and got the printer fully up and running and did some test prints using XYZWare (both wifi and usb) and my own program.  It turns out that XYZWare can send a print over wifi to my mini w in 9 seconds, but my code was taking close to 20 minutes!  Clearly I still have some more work to do.

The odd bit is that I have other tools I can use to send code to the printer and they are just as slow as my code (within 80% of the speed at least).  Anyway its back to the drawing board for me...

147

Re: print gcode files to miniMaker

Inspired by this thread I started on working on yet another approach to this problem that I would like to share, I started going down the path of a Octoprint plugin which seems like it could be made to work but very specific to octoprint so instead started a python script that acts like a more standard GCODE to XYZv3 protocol translator, so for instance if you send the app the GCODE M105 command to report temperature it makes the request using XYZv3 format over serial to the printer and then translates the info in a standard GCODE way, if it receives an XYZv3 cmd it passes the request/response over as is.

Exposing this app as a virtual serial port on a Pi lets Octoprint think it is talking to a standard printer. So far I only have a few things working with octoprint :
Initial Serial connection
Extruder Temperature reporting
Firmware/model reporting

Next is to get actual printing and printing status working, currently thinking to get the SD Card function emulated and have the app behind the scenes receive the gcode, convert it and then send it over to the printer. It would then cache that file and report it over the M20 SD Content cmd for future print requests. using the native Gcode streaming might also be possible but the app would have to receive it all, then create a file, convert it and then send it over. I really wish XYZ had just used standard Gcode and encrypted each line which would have made this much easier now that the key is known.

I think this would hide all the XYZ complexity and make it appear as a 'standard' printer with a minimal cmd set so things like octoprint or any other app intended for a more standard control set could use the device without any modification.

At this point its just a learning experience and it might not work out as I am a hack programmer and not that familiar with Python but wanted to share the approach

148

Re: print gcode files to miniMaker

Well shoot, I tried to print to my mini w today over wifi and it worked in a timely fashion.  The ui is still a bit unstable and there are some odd quirks but the command line tool is working quite well.

One quirk is that when I print over wifi the printer is returning part of the mac address as the calibration value.  I don't see how that is my fault, it seems to be a bug in the printer itself.

Thinking it over, I don't think I have ever forced a firmware update on the mini w, it is possible I am running a very old firmware.

149 (edited by david.tucker 2018-07-11 03:59:11)

Re: print gcode files to miniMaker

So up to now I have only tested a limited subset of functions over wifi.  Last night I decided to do a comprehensive survey of the wifi commands and found that almost none of the commands work like there serial counterparts.  You send out the same command, but what is returned is usually nothing at all. 

In most cases that is ok, you don't really need to wait around for the return value.  However some that absolutely need a return value don't return anything at all and force you to poll for the machine status in order to see what is going on.  This appears to all be in the name of speeding up the relatively slow wifi communication, but by forcing you to poll for status it actually slows things down even more. Not to mention making sharing code between both protocols difficult.

150

Re: print gcode files to miniMaker

I got tired of swapping parts between my two printers for testing, so I am attempting to replace the broken pieces of my mini w. 

So far I replaced a guide tube in the extruder that also acts as a run-out sensor.  I tried to make the run-out sensor work but eventually gave up and just set it to always detect filament.  It seems to work just fine that way.

I also am attempting to replace the hot end with an e3dv6 clone.  The clone is quite a bit bigger than the default hotend, so I am printing up a new mounting bracket.  I have it about half finished, hopefully it works in the end.