Skip to content

Latest commit

 

History

History
30 lines (30 loc) · 10.5 KB

GCodeSpec.md

File metadata and controls

30 lines (30 loc) · 10.5 KB
GCode Description Params Example Details
G00 Rapid Positioning X Y Z G00 X1200 Y1300 Z0 Move from current position to X,Y,Z at full speed. Does not necessarily move in a straight line as each servo moves at full speed. In some circumstances the arm could hit the body so use with caution. G00 is rarely used. G01 is the preferred command for most operations.
G01 Linear Interpolation X Y Z G01 X1200 Y1300 Z1000G01 Z1000 This is the command to use for drawing. The arm will move from its current position to X,Y,Z in a straight line at the speed set using the Drawing Speed command. Note that the command can be used with a single coordinate. This leaves the other two coordinates unchanged and would most commonly be used to lift the pen without moving the arm using G01 Z1000.
G28 Home None G28 Return to the home position, which is (1000, 1000, 1000). Equivalent to G01 X1000 Y1000 Z1000
G31 Z Mapping S S100;200;150;0
Sclear
This command is used to calbrate the machine in the vertical plane (similar to bed levelling on a 3D printer). The four parameters are the heights for TopLeft;TopRight;BottomRight;BottomLeft. In general one of the values should be zero although strictly it doesn't have to be, but if it isn't you will lose Z travel.

As the calibration is a one time process it's probably easiest to just use the app! New machines come with a default calibration of 0;100;300;200 which we've found to be a good starting point.
G40 Uncompensated drawing X Y Z K G40 X1000 Y1500 Z0
G40 X1000 Y1500 Z0 Kxy
G40 X1000 Y1500 Z0 Kz
Ignore both the scale/origin set by the G54 command and all calibration data. The K option allows you to exclude xy or z, so for example Kz would use scaled/caibrated values for Z
G54 Set Scale and Origin X Y S G54 X100 Y0 S2.5 Sets a new offset and scale for subsequent commands. The scale is applied first, and then the offset added. For example, the point (200, 100) would translate to (350, 100) using the Example G54 X100 Y0 S2.5. The calculation for the X value is: (100 * 2.5) + 100 = 350. The parameter is set independently for each connection to Line-us, and is set to the default (X0 Y0 S1) for new connections.
G94 Drawing Speed S P G94 S3
G94 P6
Not really quite speed, but sets the maximum size (in drawing units) of a step in an interpolated move. For example, if you move from (0, 0) to (100, 100) using a G01 command with this parameter set to 3 the arm will make the move in 34 steps. This only affects speed in the pen down (drawing) position (i.e. Z < 500). The default speed is 5 and the parameter can be set to between 1 and 30. The value is set back to the default when Line-us restarts. The P option sets the speed for motions with the pen up and the default for this is 15.
M20 List memory files None G20 List the files stored in the Line-us internal drawing memory. The command will return list of files similar to FS:"/0000001.txt-9496;/0000002.txt-11323;" This example shows two drawings, with sizes 9496 and 11323 bytes.
M23 Memory Drawing and Subscriptions S K M23 S1
M23 S2 Kdefualt
This command controls drawing from memory and subscriptions and what (if anything) Line-us draws when you press the button. By default (M23 S0) in Red Mode (whether anyone is connected to the Line-us-Setup WiFi or not) pressing the button will draw from the internal drawing memory. Line-us comes with one drawing loaded, which is the Chicken drawing we use for quality testing on the production line. If you have more than one drawing each button press will cycle through the drawings. If Line-us is drawing from memory pressing the button will stop the drawing. In Blue mode the default is to draw the latest drawing from the cloud sketchbook that your Line-us is following. Clearly this will only work if your Line-us is connected to the Internet (solid Blue mode).

As a side note, if you're in flashing Blue mode then pressing the button will cycle trough the WiFi networks you have configured.

M23 S1 will set your Line-us to draw from memory in Blue mode (Whether connected to WiFi or not). M23 S2 controls following and M23 S2 Kdefault will re-set ypur machine to follow the default sketchbook (which is our daily drawing feed) M23 S3 will stop your machine from following any sketchbook. Setting up your machine to follow a sketchbook other than the default is beyond the scope of the API.
M28 Start drawing save S M28 S1 This command (along with M29) controls the saving of drawings to the Line-us memory. The S parameter sets the file number (from 1 to 32) and opens the file for saving (deleting it if it already exists). Any GCode command then sent to the Line-us over this connection will then be written to the file instead of being drawn. The file is closed and the machine returned to normal drawing mode using the M29 command. Whilst in generall you'll be saving drawing commands G01, S54 etc most other GCodes can be saved to files so for example you could use M550 to change the machine name if you wanted. GCodes M374, M997, M171 and M30 are disabled in this mode though.
M29 End drawing save None M29 See M28 above for description.
M30 Delete memory file S M30 S2 Deletes a drawing from the Line-us memory. The S parameter specifies the file number to delete. The files currently in the Line-us memory can be listed using the command M20
M39 Report drawing memory usage None M39 This command will report how much of the (currently approx 1.5MB) of inernal storage is in use. For example: FSUsed:356922 FSTotal:1562625 FSFree:1205703 FSPercent:22 The figures shown are in bytes.
M85 Timed drawing S P K M85 S3 P120 This command is really only for demonstration purposes. For example M85 S3 P120 will draw the first 3 seconds of the last drawing drawn from memory every 120 seconds but with the pen in the up position. The K parameter locks it to a specific drawing rather than the last one drawn.
M114 Get Position None M114 Returns the current position of the Line-us arm, for example: X:1200 Y:900 Z:0 This command can be used as a heartbeat to check that Line-us is connected.
M115 Get capabilities None M115 Returns machine capabilities. CONNECTMODE is either ST if Line-us is a WiFi Station or AP is it is an Access Point. MACHINENAME is the network name of the machine. For example: CONNECTMODE:ST MACHINENAME:line-us
M122 Diagnostics None M122 Returns diagnostic information.
M170 Reserved Reserved for internal use. Not available via websockets API
M171 Factory reset S M171 SCONFIRM
M171 SSPIFFS
Performs a factory reset. The SCONFIRM parameter is required so that we prevent accidental resets. This does the same as holding the button down while powering on your Line-us. The SPIFFS option clears the internal filesystem and is probably best avoided as backups of the caibration is stored there along with drawings saved with M28. To clear the drawings M30 is a much better option. Not available via websockets API
M172 Reserved Reserved for internal use.
M280 Servo reversal Reverses the travel direction of the servos. You definitely don't want to do this!
M291 Disable Gestures S M291 S2 Line-us does a little wave sometimes to confirm an action. M291 allows you to turn them off using M291 S2 or back on with M291 S1
M374 Save/clear Calibration None M374
M374 Sclear
Without parameters this command sets the XY calibration. The arm must be moved to the calibration point before this operation is performed. With the Sclear option the current calibration will be cleared.
M550 Set Machine Name P M550 Probs-lineusM550 Sets or retrieves the name of your Line-us machine. The name can include upper and lower case letters, numbers and hyphens. The example sets the name to robs-lineus. M550 without parameters returns the current machine name, for example MACHINENAME:robs-lineus
M552 Startup mode S P M552 S2
M552 P2
This command does two things, the S option sets the WiFi mode that the Line-us starts in. M552 S2 starts in AP (Red) mode, M552 S3 starts in AP mode and is locked so that you can't long press to get to Blue mode. M552 S1 gets you back to the default Blue mode startup. M552 S4 starts in Blue mode but extends the long press time from the default 1 second to 7 seconds to prevent accidental mode changes. The P option sets the WiFi name in Red mode. M552 P1 will always append the machine serial number to the AP name (the default is that the serial number gets appended if there is already a machine in Red mode using the Line-us-Setup WiFI). The M552 P2 option changes the AP name to machinename-Setup, so for example if your Line-us is called line-us-rob (set using M550) the AP name would be line-us-rob-Setup. This is useful if you have more than one Line-us operating in Red mode.
M587 Store/List WiFi Network S P M587
M587 Smy-ssid Pmypassword
M587 Smy-ssid
M587 without parameters lists the currently visible WiFi networks, returning SSID:PASSWORDKNOWN pairs for each network. PASSWORDKNOWN is a single digit indicating whether Line-us has a password for that network. So it reads my-ssid:1 for a network that is visible and the password is known, another-ssid:2 for a network that is visible but we don't have the password and yet-another-one:3 for a network that we have the password for but is not visible. M587 can also be used to store a WiFi network in Line-us using the S and P parameters. If you are connected to Line-us in Setup (Red) mode, immediately following receipt of new WiFi details Line-us will attempt to connect to the new network. If the connection is successful the SSID and password will be stored (Line-us will attempt to connect to this network when next re-started). If the connection fails because of an incorrect password the network will not be stored and Line-us will return to Setup (Red flashing) mode. Not available via websockets API
M588 Forget WiFi Network S M588
Smy-ssid
M558 S*
Line-us will forget the network with SSID specified in the S parameter. If * is given then all networks will be forgotten. Not available via websockets API
M997 Firmware update TBC M997 Downloads the latest firmware and re-starts. This command should only be used when a new firmware has been released.