Lightburn + Wifi on XTool D1 Pro Howto

It’s a really nice workflow once you get it down. :slight_smile: Hopefully it works out.

1 Like

Hi @Skreelink ,
Used your technique for the past 12 months with my old D1 pro, worked like a charm.

I just upgraded to an xTool S1, and I was wondering if this workaround for sending jobs from Lightburn via WiFi would work with this machine too.

I have simply tried to use the same .bat file and adjust to the new ip-address of my S1. Would have been too good to be true, but of course, it doesn’t work, I only get this message back from the command prompt:
“This URI does not exist”.

I suppose the new S1 needs a different command. Could you point out to me how I can go about it, in order to find out the correct approach to get it to work with this machine too?

Sadly, I don’t have an S1 to try figuring it out. However, if you can connect to it with XCS over wifi, you can use wireshark or other packet sniffing software to intercept the API URLs and then adjust them as needed if they still use that method.

2 Likes

Allright, I seem to have managed to capture the packet that XCS sends to the S1 when you want to start a job. But I am unsure which part of it I should use to create my .bat file to use with a .gcode created in Lightburn.

Can I ask you to take a look at it, please?
(Sorry, I am an absolute noob with 0 experience in anything “behind the curtains”).

Enclosed a screenshot of the Transfer Protocol of the packet and a .txt with the entire text-content.
packet_txt.txt (1,1 KB)
Screenshot 2024-10-24 134531

Am I correct in assuming that the .bat file should look like this:
@echo on
curl -X POST -F file=@“%~1” “http://192.168.0.20:8080/upload?filename=tmp.gcode
pause

Appreciate your help.

Does look like it should work. give it a go. :slight_smile:

EDIT: I played with it a little bit despite not having an S1 and kept getting errors until I modified it a bit and then got an ok response from my D1. However, it might just be difference in machines, as the file didn’t upload to my D1 SD card to actually run, so feel free to try it out on the S1. I have two versions;

@echo on
curl -d @"%~1" http://192.168.0.20:8080/upload?filename=tmp.gcode
pause

and

@echo on
copy "%~1" "tmp.gcode"
curl -d @tmp.gcode http://192.168.0.20:8080/upload?filename=tmp.gcode
pause

The second one makes a copy of the gcode file and names it tmp.gcode so it’s pre-named. Might not be necessary, but it’s an option if the first one doesn’t work.

This works! :metal:

@echo on
curl -X POST -F file=@“%~1” “http://192.168.0.20:8080/upload?filename=tmp.gcode
pause

At first, it seemed like it didn’t. Got an “ok” result in the command prompt, but nothing happened when I hit the button on the S1 to start the job. Tried a couple different things (restarting the machine, resending the gcode, sending it while XCS was connected to the machine via WiFi, restarting my PC…). Still no reaction. Then, out of frustration, I just angry-tapped the Start-Button of the machine multiple times in quick sucession…and the job started :joy:

No idea why you need a double-click for this to work. But it does.
Thanks @Skreelink

What I couldn’t figure out yet is how to create a .gcode file that will set in motion the autofocus function for the z-axis. Within Lightburn, the macro simply executes the command M368, but inserting that into a “blank” .gcode file does not produce any result. (You are probably laughing and thinking “of course not”, again, I have no idea what I am doing :man_shrugging:). Any ideas if it is possible to launch the autofocus process via a file uploaded with this technique?

It may need to home Z first, try using a gcode file with

M111 S2
M368

I found the home Z command from here:

EDIT: If XCS has a button to find thickness, do the same thing to try capturing the URI packet.

Tried to use your recommendation for homing Z first, and the run the focus command. But it’s still not working, I can send the .gcode via wifi to S1, but it doesn’t do anything upon running the job.

I suspect it doesn’t work because the laser and the software (both XCS or Lightburn) are in constant communication while executing the M368 command. It seems to be sending information back and forth during the whole process, and I am assuming it doesn’t start to focus if it just gets the M368 on it’s own, without a “partner” to communicate with.

Try adding M17 to the header and in your gcode. On the D1, it’s required to enable the stepper motors, maybe it’s the same on the S1.