Back to the Gcode Dictionary
M118: Send Message to Specific Target
Supported in RepRapFirmware 1.21 and later.
- Pnnn Message type (0 = Generic [default], 1 = USB, 2 = PanelDue/UART, 3 = HTTP, 4 = Telnet, 5 = second UART) (optional)
- S"msg" Message to send
- Lnnn Log level of this message (0 = do not log this line, 1 = log as WARN, 2 = log as INFO, 3 = log as DEBUG (default)) (RRF >= 3.2.0-beta3)
M118 S"Hello Duet" M118 S"Hello Logfile" L1 M118 P0 S"Hello Logfile and DWC" L1 M118 S"Don't log me" L0
This code may be used to send messages to a specific target. Basically it is a simple wrapper for RepRapFirmware's Platform::Message method.
Note that the implementation in RepRapFirmware always requires the S-parameter to be passed. If it is omitted, an error will be reported.
The second example shows how to send a message to the log file in log level WARN instead of the default log level DEBUG.
The third example shows how to prevent a message from being logged.
Note that a message only having the Lnnn parameter but no Pnnn parameter will only go to the log file (if the log level matches the current log level of the system) and will not be sent to other outputs. If you want it to show on DWC as well then send:
M118 P0 S"message" L1