User Tools

Site Tools


communications

Communications


Commands


G-code

Standard Marlin compatible G-codes can be found at the RepRap wiki: G-code.
Not all standard G-code are supported by the MP Select Mini.

See the G-code page for information about software to use and how to send G-code.

Extended G-code

See the Extended G-code Table for G-code that is more or less specific to the MP Select Mini & Malyan printers.

Command Format

{CMD:PARAM}

Start byte: "{"

Command string: CMD. Please reference to available command list. 

Divide byte: ":"

Value string: PARAM

End byte: "}"


Available Commands

CMD PARAM function
P X Cancel print
H Homing
P Pause print
R Resume print
M Print cache.gc
C T0000 Set T0 temperature
P000 Set hotbed temperature
e e Return printing status
M Return mac address



Sample Code for Web UI


Send GCODE M565 to start print file cache.gc

function start_p(){
	$.ajax({
		url: "set?code=M565",
		cache: false
	}).done(function(html) {
	});
}


Get printing status

$.get("inquiry",function(data,status){
	$("#rde").text(data.match(/\d+/g)[0]);
	$("#rdp").text(data.match(/\d+/g)[2]);
	var c=data.charAt(data.length-1);
	if (c=='I')
	{
		$("#stat").text("Status: Idle");
		$("#pgs").css("width","0%");
	}
	else if (c=='P')
	{
		$("#stat").text("Status: Printing");
		$("#pgs").css("width",data.match(/\d+/g)[4]+"%");
	}
	else $("#stat").text("Status: ");
});


Send Control command {P:X} to cancel print

function cancel_p(){
    $.ajax({
		url: "set?cmd={P:X}",
		cache: false
	}).done(function(html) {
	});
}


Set extruder temperature

function pad(num, size) {
    var s = "000" + num;
    return s.substr(s.length-size);
}

var value=pad($("#wre").val(),3);
$.ajax({
	url: 'set?cmd={C:T0'+value+'}',
	cache: false
}).done(function(html) {
});


Stop preheat heat bed

$("#clrp").click(function(){
	$.ajax({
		url: "set?cmd={C:P000}",
		cache: false
	}).done(function(html) {
	});
});


Set printing speed

1X Speed: {C:S10}
1.5X Speed: {C:S15}
5X Max


REST

Using AJAX and REST a single line of code g-code can be sent without socket connection:

http://IP_ADDRESS/set?code=G28


Send gcode though websocket interface

<script>
var ws = new WebSocket('ws://192.168.20.164:81');
ws.onopen = function () {
  ws.send("G28");
}
</script>


Web UI Test Page

Moved to it's own page. Web UI Test Page


WebSocket Test Page

Moved to it's own page. WebSocket Test Page


TCP Interface

The printer also supports TCP interface to send G-code. Create a TCP socket on port 23 and send G-code as a string to a receive response.

  • Send empty line included LF/CR character to flush garbage in buffer.
  • Handle RST(reset) signal properly by closing the current connection and open a new socket to recover from disconnect.

The printer by default will accept two TCP connections. If a single connection sends a command, both connected sockets will receive same response message.

communications.txt · Last modified: 2017/02/12 14:39 by matthew_upp