[Request] Allow plugins to send gcode starting with semicolon
The problem
Currently, plugins have no way (e.g., via octoprint.printer.CommonPrinterMixin.commands) to send commands starting with a semicolon, or more generally to send comments, to printers.
Specifically, MachineCom.sendCommand calls process_gcode_line, which strips comments:
Sending commands starting with a semicolon can be useful in very specific cases. For example, on some Prusa printers, there are "secret" commands to alter the firmware behavior that start with a semicolon.
My PrusaResetMode plugin is currently forced to use the deprecated get_transport() method to send such commands:
transport = self._printer.get_transport()
if transport is None:
return jsonify(
{
"error": "Printer transport not available, please check you are connected to your Prusa via a serial connection"
}
), 503
transport.write(semicolonCommand.encode() + b"\n")
self._printer.log_lines(_SEND_LOG_PREFIX + semicolonCommand)Proposed solution
Add a kwarg to octoprint.printer.CommonPrinterMixin.commands to send commands while skipping processing.
It is worth noting that MachineCom.sendCommand already supports a processed flag to skip processing, but it is not propagated up the chain to the APIs usable by plugins.
Alternative solutions
No response
Additional context
No response
Source: OctoPrint/OctoPrint