Jump to content
Ultimaker Community of 3D Printing Experts
neotko

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

Recommended Posts

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

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

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Our picks

    • How to 3D print with reinforced engineering materials
      Ultimaker is hosting a webinar where we explain how you can achieve and maintain a high print success rate using these new reinforced engineering materials. Learn from Ultimaker's Product Manager of Materials and top chemical engineer Bart van As how you can take your 3D printing to that next level.
      • 0 replies
    • "Back To The Future" using Generative Design & Investment Casting
      Designing for light-weight parts is becoming more important, and I’m a firm believer in the need to produce lighter weight, less over-engineered parts for the future. This is for sustainability reasons because we need to be using less raw materials and, in things like transportation, it impacts the energy usage of the product during it’s service life.
        • Like
      • 12 replies
×

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!