developer_guide_for_mm32_platform
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | developer_guide_for_mm32_platform [2024/10/31 15:26] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | !! This page is under construction !! | ||
+ | If you have questions or report bug, please send email to: support at malyansys dot com. | ||
+ | |||
+ | ===== MM32 Platform ===== | ||
+ | |||
+ | Malyan M200/ | ||
+ | |||
+ | MM32 platform include below blocks: | ||
+ | |||
+ | 1. 32-bit MCU with native high speed USB interface and 72Mhz and up clock frequency to support real-time operation during printing. | ||
+ | |||
+ | 2. Wireless network support including webUI, TCP/ | ||
+ | |||
+ | 3. LCD screen interface and changeable theme. | ||
+ | |||
+ | MM32+ board is planed which reserved more programmability, | ||
+ | |||
+ | ===== Command ===== | ||
+ | |||
+ | === G-code === | ||
+ | Please reference to [[extended_gcode_table]] for more information. | ||
+ | |||
+ | === Extended command === | ||
+ | |||
+ | Extended command is use to monitor status and control Gcode command flow. This group of command is sent though different channel to gcode and have priority. | ||
+ | |||
+ | == 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 ^ comment ^ | ||
+ | | 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 | | ||
+ | |||
+ | ===== Network interface ===== | ||
+ | |||
+ | === UDP discovery === | ||
+ | |||
+ | MM32 will response UDP broadcast or unicast on port 6000. | ||
+ | |||
+ | Command: " | ||
+ | |||
+ | Below is sample C# code for discovery MM32 in local network. | ||
+ | |||
+ | < | ||
+ | NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces(); | ||
+ | |||
+ | for (int i = 0; i < interfaces.Length; | ||
+ | { | ||
+ | if (interfaces[i].OperationalStatus != OperationalStatus.Up) continue; | ||
+ | IPInterfaceProperties property = interfaces[i].GetIPProperties(); | ||
+ | foreach (UnicastIPAddressInformation ip in property.UnicastAddresses) | ||
+ | { | ||
+ | // | ||
+ | |||
+ | if (ip.Address.AddressFamily == AddressFamily.InterNetworkV6) continue; | ||
+ | if (ip.Address.GetAddressBytes()[0] == 255 || ip.Address.GetAddressBytes()[0] == 0) continue; | ||
+ | |||
+ | UdpClient client = new UdpClient(new IPEndPoint(ip.Address, | ||
+ | IPEndPoint iep = new IPEndPoint(IPAddress.Broadcast, | ||
+ | byte[] buffer = Encoding.UTF8.GetBytes(" | ||
+ | client.Send(buffer, | ||
+ | Thread.Sleep(100); | ||
+ | while (client.Available != 0) | ||
+ | { | ||
+ | byte[] data = client.Receive(ref iep); | ||
+ | // | ||
+ | |||
+ | //if (Encoding.UTF8.GetString(data).Contains(" | ||
+ | | ||
+ | string str = Encoding.UTF8.GetString(data); | ||
+ | |||
+ | var regex = new Regex(@" | ||
+ | MatchCollection mc = regex.Matches(str); | ||
+ | |||
+ | if (mc.Count == 4) | ||
+ | { | ||
+ | notifyIcon1.Text = " | ||
+ | } | ||
+ | | ||
+ | toolStripComboBox1.Items.Add(iep.Address); | ||
+ | toolStripComboBox1.SelectedIndex = 0; | ||
+ | |||
+ | localIP = ip.Address; | ||
+ | } | ||
+ | |||
+ | client.Close(); | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | === TCP interface === | ||
+ | |||
+ | MM32 support TCP interface instead of com port to send gcode. Create TCP socket to MM32(port 23) and send gcode as string will receive response. | ||
+ | |||
+ | 1. Send empty line included LF/CR character to flush garbage in buffer. | ||
+ | |||
+ | 2. Handle RST signal properly. Close current connection and open new socket will recover from disconnect. | ||
+ | |||
+ | Note: MM32 default accept two TCP connections. If single connection send command, both connected sockets will receive same respond message. | ||
+ | |||
+ | Sample App 1: Telnet [[http:// | ||
+ | |||
+ | Sample App 2: Modified Repetier-host (To be added) | ||
+ | |||
+ | === Web socket === | ||
+ | |||
+ | Because most web browser lack of support of TCP socket, MM32 provide web socket for integrating control panel using web UI. Below sample code in Javascript is use to send G28 command though the web socket: | ||
+ | |||
+ | < | ||
+ | < | ||
+ | var ws = new WebSocket(' | ||
+ | ws.onopen = function () { | ||
+ | ws.send(" | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Using web socket with javascipt can implement web interface with MM32. | ||
+ | |||
+ | === REST method === | ||
+ | |||
+ | Using AJAX and REST method can send single line gcode without socket connection: | ||
+ | |||
+ | < | ||
+ | http:// | ||
+ | </ | ||
+ | |||
+ | Send extended command though REST: | ||
+ | |||
+ | < | ||
+ | http:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | === Upload new webUI === | ||
+ | |||
+ | To change original web UI, upload html file using browser to the 3rd upload box in address: http:// | ||
+ | |||
+ | If zero size file uploaded, original web page will recovered. | ||
+ | |||
+ | |||
+ | ==== Gcode uploading ==== | ||
+ | |||
+ | MM32 platform provide two methods to upload plain text format gcode file. MicroSD card must exist in card slot. All uploaded files will be cached in microSD card, saved as " | ||
+ | |||
+ | Make sure disable background polling thread/ | ||
+ | |||
+ | Recommend use fast mode before uploading using gcode: **M563 S6** | ||
+ | |||
+ | === HTTP post === | ||
+ | |||
+ | Upload gcode to url: http:// | ||
+ | |||
+ | Using web browser: | ||
+ | < | ||
+ | Dropzone.options.mydz = { | ||
+ | dictDefaultMessage: | ||
+ | accept: function(file, | ||
+ | if (file.name.contains(" | ||
+ | else done(" | ||
+ | }, | ||
+ | init: function() { | ||
+ | this.on(' | ||
+ | var errorMessage = response.errorMessage; | ||
+ | $(file.previewElement).find(' | ||
+ | }); | ||
+ | this.on(" | ||
+ | if (this.files[1]!=null){ | ||
+ | this.removeFile(this.files[0]); | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | <div id=" | ||
+ | </ | ||
+ | |||
+ | === Download from web server === | ||
+ | |||
+ | Using gcode M564 will download http file: | ||
+ | < | ||
+ | M564 http:// | ||
+ | </ | ||
+ | |||
+ | Gcode M565 will download and print http file: | ||
+ | < | ||
+ | M565 http:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | === To be continue === |
developer_guide_for_mm32_platform.txt · Last modified: 2024/10/31 15:26 by 127.0.0.1