Jump to content
neotko

Marlin M218 Extruder Offset.Documented as only X / Y but the code says also Z?

Recommended Posts

Posted (edited) · Marlin M218 Extruder Offset.Documented as only X / Y but the code says also Z?

Hi,

Another question for Marlin experts.

I was wondering how to change the Z offset by firmware for my dual extruder bla bla bla.

After googling and reading everywhere, Marlin on Ultimaker offset adjustment only says X & Y as posible adjustments. But after opening the Marlin_main.cpp to check what the M218 code actually does and as far as I can read-code it seems to be ready to use Z offset changes.

 

#if EXTRUDERS > 1   case 218: // M218 - set hotend offset (in mm), T X Y   {     if(setTargetedHotend(21){       break;     }     if(code_seen('X'))     {       extruder_offset[X_AXIS][tmp_extruder] = code_value();     }     if(code_seen('Y'))     {       extruder_offset[Y_AXIS][tmp_extruder] = code_value();     }     #ifdef DUAL_X_CARRIAGE     if(code_seen('Z'))     {       extruder_offset[Z_AXIS][tmp_extruder] = code_value();     }     #endif

 

Does that really means that I could do a M218 T1 Z0.3 (for example) and it should work? I mean, if only 'kick in' if there's DUAL_X_CARRIAGE, but I assume that if I kill that 'if' check, it should just allow it, or there will be more dual_x_carriage checks for this to kickin?

Edited by Guest

Share this post


Link to post
Share on other sites
Posted · Marlin M218 Extruder Offset.Documented as only X / Y but the code says also Z?

Hey. I was just wondering the same thing. I just built a dual x carrige printer and the heads have 0.5mm height difference. Did you figure it out?

Share this post


Link to post
Share on other sites
Posted · Marlin M218 Extruder Offset.Documented as only X / Y but the code says also Z?

No I didn't. For now until a more advancedfirmware/software it's out I just use simplify3d to set the z offset of the second extruder (or the first depends on who it's lower than the other to avoid the problem of the z stop).

Share this post


Link to post
Share on other sites
Posted · Marlin M218 Extruder Offset.Documented as only X / Y but the code says also Z?

And how do you do that? I can only see X and Y tool offsets

Share this post


Link to post
Share on other sites
Posted · Marlin M218 Extruder Offset.Documented as only X / Y but the code says also Z?

I change g code offset for each extruder processes, and level the bed to the higher extruder. Ofc on my system I have 2mm margin of error on the parking system and that helps, but it's good enough to avoid crash on the bed. For extruder 0 offset 0 and for extruder 1 I set a 0.8 offset, the bed lowers when it changes. Bless the software =)

Share this post


Link to post
Share on other sites
Posted (edited) · Marlin M218 Extruder Offset.Documented as only X / Y but the code says also Z?

Anyone get anywhere on this? I wish slic3r had this option, but for now I'm trying firmware implementation. When I comment out the ifs it seems to work (compiles/uploads fine) and when I send M218 T0 Xxxx Yyyy Zzzz (works fine), but when I send M218 T1 Xxxx Yyyy Zzzz (or even just M218 T0 Xxxx Yyyy) it freezes. I'm thinking there are other areas that have if statements that expect dual_x_carriage to be defined, and are therefor not working...

NEVERMIND I GOT IT! You just have to comment out another if here:

// Extruder offsets

#if EXTRUDERS > 1

#ifndef EXTRUDER_OFFSET_X

#define EXTRUDER_OFFSET_X { 0 }

#endif

#ifndef EXTRUDER_OFFSET_Y

#define EXTRUDER_OFFSET_Y { 0 }

#endif

float extruder_offset[][EXTRUDERS] = {

EXTRUDER_OFFSET_X,

EXTRUDER_OFFSET_Y

//#if ENABLED(DUAL_X_CARRIAGE)

, { 0 } // supports offsets in XYZ plane

//#endif

};

#endif

and the original, both in marlin_main:

#if EXTRUDERS > 1

/**

* M218 - set hotend offset (in mm), T X Y

*/

inline void gcode_M218() {

if (setTargetedHotend(218)) return;

if (code_seen('X')) extruder_offset[X_AXIS][target_extruder] = code_value();

if (code_seen('Y')) extruder_offset[Y_AXIS][target_extruder] = code_value();

//#if ENABLED(DUAL_X_CARRIAGE)

if (code_seen('Z')) extruder_offset[Z_AXIS][target_extruder] = code_value();

//#endif

SERIAL_ECHO_START;

SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);

for (int e = 0; e < EXTRUDERS; e++) {

SERIAL_CHAR(' ');

SERIAL_ECHO(extruder_offset[X_AXIS][e]);

SERIAL_CHAR(',');

SERIAL_ECHO(extruder_offset[Y_AXIS][e]);

//#if ENABLED(DUAL_X_CARRIAGE)

SERIAL_CHAR(',');

SERIAL_ECHO(extruder_offset[Z_AXIS][e]);

//#endif

}

SERIAL_EOL;

}

#endif // EXTRUDERS > 1

Edited by Guest
solved!
  • Like 1

Share this post


Link to post
Share on other sites
Posted · Marlin M218 Extruder Offset.Documented as only X / Y but the code says also Z?

Nice one!

Share this post


Link to post
Share on other sites
Posted (edited) · Marlin M218 Extruder Offset.Documented as only X / Y but the code says also Z?

ok, another year went by and there is another guy like to use the z offset... :-)

So IF I set all a.m. modifications

AND define a new variable EXTRUDER_OFFSET_Z in configuration.h in the area of offset definition

 

// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).// The offset has to be X=0, Y=0, Z=0 for the extruder 0 hotend (default extruder, T0).// For the other hotends it is their distance from the extruder 0 hotend.// #define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis// #define EXTRUDER_OFFSET_Y {0.0, 5.00}  // (in mm) for each extruder, offset of the hotend on the Y axis#define EXTRUDER_OFFSET_Z {0.0, 1.00}  // (in mm) for each extruder, offset of the hotend on the Z axis

 

AND put it in the correct area of marlin_main.ccp (incl. commenting out the dual stuff),

 

// Extruder offset#if EXTRUDERS > 1//#ifndef DUAL_X_CARRIAGE//  #define NUM_EXTRUDER_OFFSETS 2 // only in XY plane//#else #define NUM_EXTRUDER_OFFSETS 3 // supports offsets in XYZ plane//#endiffloat extruder_offset[NUM_EXTRUDER_OFFSETS][EXTRUDERS] = {#if defined(EXTRUDER_OFFSET_X) && defined(EXTRUDER_OFFSET_Y) && defined(EXTRUDER_OFFSET_Z) EXTRUDER_OFFSET_X, EXTRUDER_OFFSET_Y, EXTRUDER_OFFSET_Z#endif};#endif

 

it should be possible to define the z offset during compilation and no need for M218 - isn't??

Well, I'm using a Marlin version of 2014, so it might look a bit different now.

(but my UMO runs fine on it... so why change a running system) :-)

Edited by Guest

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Our picks

    • Ultimaker Cura 4.0 | Stable available!
      Ultimaker Cura 4.0 is mainly focused on the improved user interface and cloud integration.
      As always, we want to collect your user feedback for this release. If there are any improvements you can think of, feel free to mention it here and help us to shape the next release.
      • 96 replies
×
×
  • Create New...

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!