MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.27k stars 19.23k forks source link

[FR] Allow GCODE echo to second serial when command is executed #25904

Open ElfyShort opened 1 year ago

ElfyShort commented 1 year ago

Is your feature request related to a problem? Please describe.

No response

Are you looking for hardware support?

Hardware unrelated

Describe the feature you want

Hi,

I would like to connect an extension board to a 3Dprinter board running marlin to enable controlling hardware that is not supported in Marlin in unison with printing. The idea is to echo the received Gcode line to serial1 (for example) to pick up this command with this custom board and execute the commands which are not intended for Marlin. In this way it will allow to avoid any gcode execution desynchronization due to serial buffer delay.

Ideally, The echo to serial1 should happen at the same time as marlin send "ok" feedback back to serial. Or just echo the command immediately if it is recognized as "unknown command".

Any advice on where I should start looking in marlin to potentially make this work?

Thank you.

Additional context

No response

ellensp commented 1 year ago

As in https://marlinfw.org/docs/gcode/M118.html but automatically

ElfyShort commented 1 year ago

As in https://marlinfw.org/docs/gcode/M118.html but automatically

Yes, similar to M118. I am currently using this, but it only send echo back to serial used to connect to pc. I need to send echo to another serial (serial1) to pick it up by another device.

DerAndere1 commented 1 year ago

the parameter P of the M118 command seems to dictate to which serial port it is sent, according to documentation

ElfyShort commented 1 year ago

@DerAndere1 Thanks for pointing this out, I seem to have missed this detail.

This will indeed allow me to do what I want. Although if there are many commands are sent to the serial1 the gcode could become a bit messy, carrying all these "M118 Pn2" in from of actual gcode line sent to the 2nd host.