Welcome! Log In Create A New Profile

Advanced

Marlin v2 process flow. Tcode.

Posted by cat.farmer 
Marlin v2 process flow. Tcode.
January 20, 2021 12:26PM
I'm am trying to find where commands are sent to the printer, specifically the T commands. I have found multiple instances of active_extruder, and found where the Tcode is parsed in Gcode.cpp

int8_t GcodeSuite::get_target_extruder_from_command() {
if (parser.seenval('T')) {
const int8_t e = parser.value_byte();
if (e < EXTRUDERS) return e;
SERIAL_ECHO_START();
SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);
SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", int(e));
return -1;
}
return active_extruder;
}
but I'm not sure where that is actually applied to the printer in the stream.

What I am trying to accomplish is applying my code in Marlin v1 to the current version
In v1 I applied it to the marlin_main.cpp
here is what I had in v1

bool setTargetedHotend(int code){
tmp_extruder = active_extruder;
if(code_seen('T')) {
tmp_extruder = code_value();
Wire.begin();
Wire.beginTransmission (42); //wire added by me
Wire.write(tmp_extruder);
Wire.endTransmission();
tmp_extruder = 0; // tmp_extruder = code_value();

I need to send the T value via I2c to my extruder board of my design.
Thanks in advance for any help.
Sorry, only registered users may post in this forum.

Click here to login