File Transfer via WiFi

The server part of the JavaScript is to talk to the touch screen over Wi-Fi. I believe there’s a separate part of the lube and code base that handles the serial connection.

If I try this, I get
Click YES on printer screen to continue…
however nothing appears on the touch screen…
If I add
C:\windows\System32\curl.exe -s http://%PRINTERIP%:8080/api/v1/status?token=%TOKEN% to see the actual returned results, I get:
Machine is not connected yet.
Is there a touchscreen setting to allow connections?
Thanks

This does happen from time to time. I was unable to transfer files for the first week (i have had my machine for 6 weeks), more reliable now.

  1. if the file doesn’t send restart luban (note wait about a minute from when you close the visible window, seems to take a while for all processes to quiesce)
  2. make sure you are on latest firmware and luban versions.
  3. power off printer for at least 15 seconds if the above doesnt work and make sure to do 1 if you if you do this.

I now don’t get asked on the touchscreen very often and when luban fails to send i just restart it.

I did find by going through the menu on the touchscreen I could get the connect question up, but I have not yet found a consistent way. I have read somewhere else a request to bea ble to permanently enable the connect, let’s hope this appears.

To re-adjust Z offset after a calibration, G1029 D x.xx where x.xx is how far you want the nozzle to go, negative down, positive up. Remains until your next calibration. You can adjust as much as you like, but has to be under 1mm at a time

I’ve released a command line tool that you can easily use to find devices and upload your gcode as well as .nc, .bin (yes you can upload the firmware bin)

I’m also adding feature to support J1 & Artisan.

2 Likes

Thank you, very cool. I always have to authorize on Snapmaker display. What do I do wrong.
This is my command line from the automator
‘/Users/fuchschr/Library/CloudStorage/Dropbox/3D Druck/Snapmaker_tools/sm2uploader-darwin-arm64/sm2uploader-darwin-arm64’ -host 10.0.0.113 ‘/Users/fuchschr/Library/CloudStorage/Dropbox/3D Druck/Projekte/Spielzeug/Elsa Stencil/aaX_Elsa_0.2mm_PLA_A350_5h9m.gcode’

It is send but I have to go to the printer.

Thanks for your help.
Christian

Check hosts.yaml file is generated in this directory, and if not, move the sm2uploader to a writable directory.

hosts.yaml will save the necessary data such as ip and tokens.

Could you please post an example of hosts.yaml. Discovery doesn’t work for some reason, I would add the printer to hosts manually.

You can use -host ip even without hosts.yaml file connect directly to the dest printer.

Here’s an example hosts.yaml

printers:
    - ip: 192.168.1.11
      id: A350
      model: Snapmaker 2 Model A350
      token: 593de41d-1111-2222-3333-f37412390f5c9
      sacp: false
    - ip: 192.168.1.22
      id: J1
      model: Snapmaker J1
      token: ""
      sacp: true
1 Like

Thank you, folder has everyone Read/Write. What has to be in the host.yaml?

That did it, with one caveat.
When running

 sm2uploader -octoprint :8833 -host A350

I got error:

listen tcp :8833: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

Turns out on Windows 10 there is a reserved range of ports you can check with command

netsh interface ipv4 show excludedportrange protocol=tcp
Protocol tcp Port Exclusion Ranges

Start Port    End Port
----------    --------
      5357        5357
      8435        8534
      8535        8634
      8635        8734
      8735        8834
      8835        8934
      8935        9034
     50000       50059     *

* - Administered port exclusions.

8844 or 8833 within the range so I had to use 6633 - that did it.

sm2uploader -octoprint :6633 -host A350
2023/05/21 12:01:04 Found printer in ~~\Utils\hosts.yaml
2023/05/21 12:01:04 Printer IP: 192.168.1.55
2023/05/21 12:01:04 Printer Model: Snapmaker 2 Model A350
2023/05/21 12:01:04 Starting OctoPrint server on :6633 ...
2023/05/21 12:01:04 Server started, now you can upload files to http://[::]:6633
2023/05/21 12:05:42 Request GET /api/version completed in 0s

Thank you @macdylan for the tool. I’ve added it to the GitHub - shurushetr/awesome-snapmaker: Curated list of things that help you make something awesome with Snapmaker machines.

1 Like

@macdylan, have you thought of implementing

api/v1/prepare_print
api/v1/start_print

In a way that would enable the Upload & Print button in prusa?

image

In sm printers, If you want to start print through the API, you must use the online printing APIs, but online printing need a heartbeat connection, if lost it will automatically pause.

This is dangerous because normally I exit PS after I’ve finished slicing.

Interesting, In my case machine displays a message

The machine has lost its connection with Luban. Only when you tap Stop the current job will be terminated.

I first noticed it with Lightburn sending files over wifi with api calls for laser jobs. And now just checked it with Luban for 3DP.
Machine will finish the job tho, unless you press stop button.

Pic of the message

M1005 firmware virsions

M1005
Marlin SM2-4.5.34
Compiled: Mar 9 2023, 17:08:07
PACKAGE: Snapmaker_V4.5.34
Module Ver:
Module 0x00C250C8: v1.13.12
Module 0x00C82A8A: v1.13.12
Module 0x00022D90: v1.13.12
Module 0x00C82A96: v1.13.12
Module 0x00C2520A: v1.13.12
Module 0x00C82A98: v1.13.12

We loose the status update on the touchscreen

On the other hand, I assumed Octoprint would be responsible for heartbeat connection not PS.
I guess I have to ask how do you run the sm2uploader in connection with PS, do they start and stop at the same time when you start and stop PS?

The way the snapmaker works if you use the API, is it fully uploads the gcode to a temporary storage on the controller. Then when the start_print API is called, it begins feeding that file into the motion system to begin printing.

The heartbeat (which is just a status call every second or so) is only required to keep the machine in a ‘connected’ state and the live updates in Luban. If you disconnect, it will keep going just fine, just don’t press the stop button on the touchscreen. You can reconnect Luban later to check the status as well.

I personally use my drag/drop files to run files, simply export the gcode, drag it ontop of the batch file, and it automatically uploads it to the snapmaker and starts it. Funfact; you can actually retrieve the files uploaded in this manner from the controller using the print_file API.

There’s no heartbeat connection with Octoprint, it’s simply feeding the gcode directly via serial. Octoprint would likely be the best option to integrate with prusaslicer’s upload/start option.

Unfortunately, Octoprint doesn’t work well with J1, causing the printer’s touchscreen to become unresponsive. Also, I don’t want the touchscreen of any sm printers to lose its function and it won’t work properly when operated through Octoprint.

You’re right, that prompt is very very stupid :poop: :poop:, you can’t go back to the previous screen until the work is done.

1 Like

Riskey shared the submit ticket link here (Discussion of Snapmaker 2.0 Firmware Updates - #685 by Riskey). I’ll go ahead and submit a ticket for this (add button to return to standalone mode on touchscreen), just to see what will happen.

1 Like