Jump to content

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


neotko

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
  • Link to post
    Share on other sites

    • 3 months later...
    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?

  • 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).

  • 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 =)

  • 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
    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!

  • 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
  • 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

      • Introducing the UltiMaker Factor 4
        We are happy to announce the next evolution in the UltiMaker 3D printer lineup: the UltiMaker Factor 4 industrial-grade 3D printer, designed to take manufacturing to new levels of efficiency and reliability. Factor 4 is an end-to-end 3D printing solution for light industrial applications
          • Thanks
          • Like
        • 3 replies
      • UltiMaker Cura 5.7 stable released
        Cura 5.7 is here and it brings a handy new workflow improvement when using Thingiverse and Cura together, as well as additional capabilities for Method series printers, and a powerful way of sharing print settings using new printer-agnostic project files! Read on to find out about all of these improvements and more. 
         
          • Like
        • 26 replies
    ×
    ×
    • Create New...