Setting up the virtual printer for debugging¶
OctoPrint includes, by default, a virtual printer plugin. This plugin allows you to debug OctoPrint’s serial communication without connecting to an actual printer. Furthermore, it is possible to create certain edge conditions that may be hard to reproduce with a real printer.
Enabling the virtual printer¶
The virtual printer can be enabled through its Settings panel.
Virtual printer configuration options¶
There are many configuration options via config.yaml for the virtual printer that allow you to fine-tune its behavior:
Defaults¶
plugins:
virtual_printer:
ambientTemperature: 21.3
brokenM29: true
brokenResend: false
busyInterval: 2.0
capabilities:
AUTOREPORT_POS: false
AUTOREPORT_SD_STATUS: true
AUTOREPORT_TEMP: true
BUSY_PROTOCOL: false
CHAMBER_TEMPERATURE: false
EMERGENCY_PARSER: true
EXTENDED_M20: false
LFN_WRITE: false
commandBuffer: 4
echoOnM117: true
enable_eeprom: true
enabled: false
errors:
checksum_mismatch: Checksum mismatch
checksum_missing: Missing checksum
command_unknown: Unknown command {}
lineno_mismatch: expected line {} got {}
lineno_missing: 'No Line Number with checksum, Last Line: {}'
maxtemp: MAXTEMP triggered!
mintemp: MINTEMP triggered!
fanMaxSpeed: 4560
firmwareName: Virtual Marlin 1.0
forceChecksum: false
hasBed: true
hasChamber: false
includeCurrentToolInTemps: true
includeFilenameInOpened: true
klipperTemperatureReporting: false
locked: false
m105NoTargetFormatString: '{heater}:{actual:.2f}'
m105TargetFormatString: '{heater}:{actual:.2f}/ {target:.2f}'
m114FormatString: 'X:{x} Y:{y} Z:{z} E:{e[current]} Count: A:{a} B:{b} C:{c}'
m115FormatString: FIRMWARE_NAME:{firmware_name} PROTOCOL_VERSION:1.0
m115ReportArea: false
m115ReportCapabilities: true
m123PowerFormatString: '{fan}@:{power}'
m123RPMFormatString: '{fan}:{rpm} RPM'
numExtruders: 1
okAfterResend: false
okBeforeCommandOutput: false
okFormatString: ok
passcode: '1234'
pinnedExtruders: null
preparedOks: []
repetierStyleTargetTemperature: false
resend_ratio: 0.0
resetLines:
- start
- 'Marlin: Virtual Marlin!'
- "\x80"
- SD card ok
rxBuffer: 64
sdFiles:
longname: false
longname_quoted: true
size: true
timestamp: false
upper_case: false
sendBusy: false
sendWait: true
sharedNozzle: false
simulateReset: true
simulated_errors:
- 100:resend
- 105:resend_with_timeout
- 110:missing_lineno
- 115:checksum_mismatch
smoothieTemperatureReporting: false
supportF: false
supportM112: true
support_M503: true
throttle: 0.01
waitInterval: 1.0
Data model¶
Name |
Type |
Description |
Default |
|---|---|---|---|
|
|
Whether to enable the virtual printer and include it in the list of available serial connections. |
|
|
|
Whether to send an additional “ok” after a resend request (like Repetier) |
|
|
|
Whether to force checksums and line number in the communication (like Repetier), if set to true printer will only accept commands that come with linenumber and checksum and throw an error for lines that don’t |
|
|
|
Number of extruders to simulate on the virtual printer. Map from tool id (0, 1, …) to temperature in °C |
|
|
|
Allows pinning certain hotends to a fixed temperature |
unset |
|
|
Whether to include the current tool temperature in the M105 output as separate T segment or not.
|
|
|
|
Whether to include the selected filename in the M23 File opened response.
|
|
|
|
Whether the simulated printer should also simulate a heated bed or not |
|
|
|
Whether the simulated printer should also simulate a heated chamber or not |
|
|
|
If enabled, reports the set target temperatures as separate messages from the firmware
|
|
|
|
If enabled, ok will be sent before a commands output, otherwise after or inline (M105)
|
|
|
|
If enabled, reports the first extruder in M105 responses as T instead of T0
|
|
|
|
Whether to report the hotend temperatures as |
|
|
Settings related to the SD file list output General format:
|
||
|
|
Whether M20 responses will include filesize or not
|
|
|
|
Whether M20 responses will include timestamp or not (only if
|
|
|
|
Whether M20 responses will include longname or not (only if Mutually exclusive with
|
|
|
|
Whether M20 responses will include quoted longname or not (only if Mutually exclusive with
|
|
|
|
Whether to uppercase the filenames in M20 responses |
|
|
|
Forced pause for retrieving from the outgoing buffer |
|
|
|
Whether to send “wait” responses every “waitInterval” seconds when serial rx buffer is empty |
|
|
|
Interval in which to send “wait” lines when rx buffer is empty |
|
|
|
Size of the simulated RX buffer in bytes, when it’s full a send from OctoPrint’s side will block |
|
|
|
Size of simulated command buffer, number of commands. If full, buffered commands will block until a slot frees up |
|
|
|
Whether to support the M112 command with simulated kill |
|
|
|
Whether to send messages received via M117 back as “echo:” lines |
|
|
|
Whether to simulate broken M29 behaviour (missing ok after response) |
|
|
|
Whether to simulate broken resend behaviour (missing ok after response) |
|
|
|
Whether F is supported as individual command |
|
|
|
Firmware name to report (useful for testing firmware detection) Default:
|
see left |
|
|
Simulate a shared nozzle |
|
|
|
Send “busy” messages if busy processing something |
|
|
|
Interval in which to send “busy” lines while processing |
|
|
|
Simulate a reset on connect |
|
|
|
Lines to send on simulated reset Default:
|
see left |
|
|
Initial set of prepared oks to use instead of regular ok (e.g. to simulate mis-sent oks). Can also be filled at runtime via the debug command prepare_ok |
|
|
|
Format string for ok response. Placeholders:
Example format string for “extended” ok format: |
|
|
|
Format string for M115 output. Placeholders:
Default:
|
see left |
|
|
Whether to include capability report in M115 output |
|
|
|
Capabilities to report if capability report is enabled Default:
|
see left |
|
|
Whether to include area report in the M115 output (M115_GEOMETRY_REPORT in Marlin) |
|
|
|
Default:
|
see left |
|
|
Response to M105 when there is a target Placeholders:
Default:
|
see left |
|
|
Response to M105 when there is no target Placeholders:
Default:
|
see left |
|
|
Response to M123 for fan RPM Placeholders:
Default:
|
see left |
|
|
Response to M123 for fan power level Placeholders:
Default:
|
see left |
|
|
Simulated ambient temperature in °C |
|
|
|
The maximum speed (in RPM) the virtual printer’s virtual fans can spin at |
|
|
Format strings for various error types |
||
|
|
Default:
|
see left |
|
|
Default:
|
see left |
|
|
Default:
|
see left |
|
|
Default:
|
see left |
|
|
Default:
|
see left |
|
|
Default:
|
see left |
|
|
Default:
|
see left |
|
|
Enable virtual EEPROM If enabled, a file |
|
|
|
Support M503 |
|
|
|
Resend ratio to simulate noise on the line |
|
|
|
Whether the printer starts out as locked (active |
|
|
|
Passcode for unlocking the printer via |
|
|
|
Communication errors to simulate at specific line numbers, format Default:
|
see left |
Log file¶
Once activated, the virtual printer will log all serial communication in the plugin_virtual_printer_serial.log file
that can be found in the OctoPrint logs folder.
Debug commands¶
You can simulate certain conditions and communications through the terminal tab in OctoPrint’s interface.
All commands start with !!DEBUG: and are followed by the command you want to execute. For instance, sending
!!DEBUG:action_disconnect will disconnect the printer. Sending !!DEBUG without command will show a help
message with all the available commands:
OctoPrint Virtual Printer debug commands
help
?
| This help.
# Action Triggers
action_pause
| Sends a "// action:pause" action trigger to the host.
action_resume
| Sends a "// action:resume" action trigger to the host.
action_disconnect
| Sends a "// action:disconnect" action trigger to the
| host.
action_custom <action>[ <parameters>]
| Sends a custom "// action:<action> <parameters>"
| action trigger to the host.
# Communication Errors
dont_answer
| Will not acknowledge the next command.
go_awol
| Will completely stop replying
trigger_resend_lineno
| Triggers a resend error with a line number mismatch
trigger_resend_checksum
| Triggers a resend error with a checksum mismatch
trigger_missing_checksum
| Triggers a resend error with a missing checksum
trigger_missing_lineno
| Triggers a "no line number with checksum" error w/o resend request
drop_connection
| Drops the serial connection
prepare_ok <broken ok>
| Will cause <broken ok> to be enqueued for use,
| will be used instead of actual "ok"
# Reply Timing / Sleeping
sleep <int:seconds>
| Sleep <seconds> s
sleep_after <str:command> <int:seconds>
| Sleeps <seconds> s after each execution of <command>
sleep_after_next <str:command> <int:seconds>
| Sleeps <seconds> s after execution of next <command>
# SD printing
start_sd <str:file>
| Select and start printing file <file> from SD
select_sd <str:file>
| Select file <file> from SD, don't start printing it yet. Use
| start_sd to start the print
cancel_sd
| Cancels an ongoing SD print
# Misc
send <str:message>
| Sends back <message>
reset
| Simulates a reset. Internal state will be lost.