Playing G-code files
The Player module allows you to play files from the SD card.
Files are read one line at a time, and each line is executed as if it had been received from a controlling host.
Mac users beware: it appears that the play function does not accept files that have a space in their name.
Files on sdcard MUST be line terminated by \n
ONLY, not \r
(Note for MAC users). On the very latest version of smoothieware it will tolerate \r\n
terminated lines.
Configuration
Here are all the available options for the Player module
Option | Example value | Explanation |
---|
Commands
Here are all the available commands for the Player module
play
You can use the Play command to execute files stored on the SD card.
You must specify a file name and its path, for example :
play /sd/gcodefile.gcode
By default, the command will be quiet. If you want the command to output every G-code in the file to the serial port ( the command was called from ), add the -v ( verbose ) parameter :
play /sd/gcodefile.gcode -v
Pronterface
Pronterface will ignore commands it does not understand, unless you prefix them with @.
Therefore, send your command as @play /sd/gcodefile.gcode and it will work
Repetier
Repetier will act kind of mean, and ignore any command it doesn't understand.
Unlike Pronterface it won't give you a method to pass commands anyway.
You can possibly use the M24 G-code instead.
progress
When a file is playing, you can use the Progress command to get a report of the current position in the file, and elapsed time.
abort
You can also use the Abort command to stop the execution of the file.
suspend
Can be used for either sd card playing or when streaming from Pronterface or Octoprint.
Will suspend a print in progress it does the following…
1. send pause to upstream host, or pause if printing from sd 2. wait for empty queue 3. save the current position, extruder position, temperatures - any state that would need to be restored 4. –retract by specified amount either on command line or in config– - not implemened yet 5. turn off heaters. (unless the config has Leave_heaters_on_suspend true) 6. optionally run after_suspend gcode (set in config defines gcode to run eg. After_suspend G91G0E20G90)
User may jog or remove and insert filament at this point, extruding or retracting as needed.
This could be triggered by a Switch module to setup a simple out of filament detector.
NOTE Issuing a home after a suspend will cancel the suspend and you will not be able to resume.
NOTE the queue must drain before it will suspend, if you need to have the system suspend quicker the only way to do it is to set the config variable mm_per_line_segment 1
this will mean it will stop within 32mm, but there is a performance penalty for segmenting when you do not need to.
Stopping Smoothie
These are the different ways of stopping Smoothie :
Command | G-code | Movement | Heaters | File playing | Recoverable | Documentation | Explanation |
---|---|---|---|---|---|---|---|
Abort | M26 | Stops an SDCARD print immediately | Not affected | Aborts | Position maintained, but file must be restarted | Player | Stops the execution of a file being played from SDCARD, it will complete the current gcode, but stop immediately after that, the rest of the queued commands are discarded. It attempts to maintain the correct position after the abort. |
Suspend | M600 | Stops once queue is empty | Turned off if option enabled (default) | Paused, can be resumed | Yes, with Resume or M601, position maintained | Player | Suspends the execution of a file being played from SDCARD or being streamed from a host (upstream support required currently pronterface and octoprint support it, otherwise host needs to be manually paused), all state is saved and jogging and extruding is allowed. Mainly used for mid print filament change, or filament out detection. M601 resumes the print or the Resume command |
No command, but there is a configurable «kill» button | M112 | Stops instantly if kill button pressed, if issued from host has to wait for the receive buffer to have room. | Turned off | aborted | No, position is lost, home will be required | supported-g-codes | Instantly stops all operations, printer fully halts until M999 is sent. Position is lost. |
Sending Control-X to smoothie over the serial port or USB serial port | should work at any time even when streaming, does the same as the kill button | Turned off | aborted | No, position is lost, home will be required | Instantly stops all operations, printer fully halts until M999 is sent (or $X). Position is lost. |
If the kill button is pressed (or there is a temperature fault, M112 is issued, a limit switch is hit or other error) the system enters the Halt state, in this state the play led flashes, and the state can be cleared by issuing M999 or holding the flashing kill button for 2 seconds (it can also be cleared from the LCD panel). While in the Halt state any command issued from the host will get a !! response (with a few exceptions). The PSU may be turned off when Halt is entered if there is a psu Switch defined.
All commands can be triggered by a button or a sensor if a Switch module is configured to do so.
You can read more about the kill button at Smoothie kill button
resume
Will resume a suspended print it does the following…
1. restore the temperatures and wait for them to get up to temp 2. optionally run before_resume gcode if specified 3. restore the position it was at and E and any other saved state 4. resume sd print or send resume upstream
G-codes
The following G-codes are supported by the Player module :
- M21 : Initialize the SD card. This does nothing in Smoothie but is kept for compatibility
- M23 : Select a file, for example : M23 file.gcode
- M24 : Start or resume SD card print
- M25 : Pause SD card print
- M26 : Abort a SD card print
- M27 : Report print progress
- M32 : Select a file, and start playing it, for example : M32 file.gcode
- M600 : Suspend print in progress (use console command resume or M601 to continue)
- M600.1 : Suspend print in progress, but leave heaters on
- M601 : Resume print after suspend