Hotfix release available: 2025-05-14b "Librarian".
upgrade now! [56.2] (what's this?)
Hotfix release available: 2025-05-14a "Librarian".
upgrade now! [56.1] (what's this?)
New release available: 2025-05-14 "Librarian".
upgrade now! [56] (what's this?)
sample_code_for_web_interface
Differences
This shows you the differences between two versions of the page.
| — | sample_code_for_web_interface [2024/10/31 15:26] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | More API will be add soon. | ||
| + | |||
| + | |||
| + | Send GCODE M565 to start print file cache.gc | ||
| + | < | ||
| + | function start_p(){ | ||
| + | $.ajax({ | ||
| + | url: " | ||
| + | cache: false | ||
| + | }).done(function(html) { | ||
| + | }); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Send GCODE M566 to rename file cache.gc | ||
| + | < | ||
| + | M566 newfilename.gc | ||
| + | </ | ||
| + | |||
| + | Get printing status | ||
| + | < | ||
| + | $.get(" | ||
| + | $("# | ||
| + | $("# | ||
| + | var c=data.charAt(data.length-1); | ||
| + | if (c==' | ||
| + | { | ||
| + | $("# | ||
| + | $("# | ||
| + | } | ||
| + | else if (c==' | ||
| + | { | ||
| + | $("# | ||
| + | $("# | ||
| + | } | ||
| + | else $("# | ||
| + | }); | ||
| + | </ | ||
| + | |||
| + | Send Control command {P:X} to cancel print | ||
| + | < | ||
| + | function cancel_p(){ | ||
| + | $.ajax({ | ||
| + | url: " | ||
| + | cache: false | ||
| + | }).done(function(html) { | ||
| + | }); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | Set extruder temperature | ||
| + | < | ||
| + | function pad(num, size) { | ||
| + | var s = " | ||
| + | return s.substr(s.length-size); | ||
| + | } | ||
| + | |||
| + | var value=pad($("# | ||
| + | $.ajax({ | ||
| + | url: ' | ||
| + | cache: false | ||
| + | }).done(function(html) { | ||
| + | }); | ||
| + | </ | ||
| + | |||
| + | |||
| + | Stop preheat heat bed | ||
| + | < | ||
| + | $("# | ||
| + | $.ajax({ | ||
| + | url: " | ||
| + | cache: false | ||
| + | }).done(function(html) { | ||
| + | }); | ||
| + | }); | ||
| + | </ | ||
| + | |||
| + | Set printing speed: | ||
| + | < | ||
| + | 1X Speed: {C:S10} | ||
| + | 1.5X Speed: {C:S15} | ||
| + | 5X Max | ||
| + | </ | ||
| + | |||
| + | Enable fast mode for web uploading: | ||
| + | < | ||
| + | GCode: S value can be 2~6 | ||
| + | M563 S6 | ||
| + | </ | ||
| + | |||
| + | Send gcode though websocket interface: | ||
| + | < | ||
| + | < | ||
| + | var ws = new WebSocket(' | ||
| + | ws.onopen = function () { | ||
| + | ws.send(" | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | High speed web downloading: | ||
| + | |||
| + | < | ||
| + | M563 S6 | ||
| + | </ | ||
