Close



Results 1 to 10 of 89

Hybrid View

  1. #1
    Technician
    Join Date
    Oct 2013
    Location
    South Australia
    Posts
    50
    Update:
    I used the latest Marlin and made changes to suite my machine. After a few more changes to direction, stop positions and filament travel, I managed to get it all working nicely and then made a small print.
    The first print came out very skewed to one direction, so I made some more changes, reduced the acceleration down a lot, and then made another print. This time it came out fine.

    How I got the system working was to first nudge the nozzle down until it opened the micro switch. That would be the zero point as far as the machine is concerned. This is actually below the bed level, so in the firmware I would have to put a positive offset. I raised the nozzle in very small increments until the probing micro switch closed again, checking at each increment to make sure it was either open or closed. When it closed I read the value from the screen and then added 0.3mm for the amount for lift above the bed (this I could experiment with) Altogether I had to lift 0.7mm to get the printing position I needed.
    Tried it out and it works. Now I will change the sensing head to a lower pressure design that I have made and test again. No other changes have been made to Marlin to this point, it is all standard code.

  2. #2
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    Quote Originally Posted by regpye View Post
    Update:
    I used the latest Marlin and made changes to suite my machine. After a few more changes to direction, stop positions and filament travel, I managed to get it all working nicely and then made a small print.
    The first print came out very skewed to one direction, so I made some more changes, reduced the acceleration down a lot, and then made another print. This time it came out fine.

    How I got the system working was to first nudge the nozzle down until it opened the micro switch. That would be the zero point as far as the machine is concerned. This is actually below the bed level, so in the firmware I would have to put a positive offset. I raised the nozzle in very small increments until the probing micro switch closed again, checking at each increment to make sure it was either open or closed. When it closed I read the value from the screen and then added 0.3mm for the amount for lift above the bed (this I could experiment with) Altogether I had to lift 0.7mm to get the printing position I needed.
    Tried it out and it works. Now I will change the sensing head to a lower pressure design that I have made and test again. No other changes have been made to Marlin to this point, it is all standard code.
    All right!!! Good! OK, here is what I think: I think we have two main issues to deal with. First, we need to make sure that any Z_Probing leaves the nozzle in a good (safe) position. And the second thing I think is going to happen is the Z-Probe is going to get fired during the middle of a print because of the edges curling upwards.

    Now that everybody is on the same version of the firmware, we can probably make progress pretty quickly.

    OK... First, lets try to get any Z-Probing to leave the nozzle at a safe height. There are a couple problems with this. G28 and G29 use different support functions to do their work right now. (I think they will get cleaned up eventually to use the same stuff. But right now, they do the work differently.)

    We need to have

    #define Z_RAISE_BETWEEN_PROBINGS 10.0

    defined in configuration.h Probably 10 is excessive right now, but it will let you see if it is doing the right thing.

    Now let's change run_z_probe() to leave the nozzle up. Right now it looks like this:

    static void run_z_probe() {
    plan_bed_level_matrix.set_to_identity();
    feedrate = homing_feedrate[Z_AXIS];
    ...
    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
    st_synchronize();

    current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
    // make sure the planner knows where we are as it may be a bit different than we last said to move to
    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
    }

    Lets change the very end of it to:

    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
    st_synchronize();

    current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
    // make sure the planner knows where we are as it may be a bit different than we last said to move to
    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);

    SERIAL_PROTOCOLLNPGM( "At end of run_z_probe() raising nozzle." );
    do_blocking_move_relative( 0.0, 0.0, (float) Z_RAISE_BETWEEN_PROBINGS );
    SERIAL_PROTOCOLLNPGM( "At end of run_z_probe() done raising nozzle." );

    }

    That should handle the bulk of the G29 code. Now for the G28 code, lets make sure

    #define Z_SAFE_HOMING

    is enabled in configuration.h . There are a million different code paths depending upon what options are turned on. In this case, the Z-Axis is treated with extra care. So... probably it makes sense to start with that. I'm not 100% certain this next change is going to do what we want, but it is the cleanest way to do this if it works. Be sure to have your finger ready to press the reset button when you test it. I think what we want to do is go find:

    static void homeaxis(int axis) {
    #define HOMEAXIS_DO(LETTER) \
    ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))

    if (axis==X_AXIS ? HOMEAXIS_DO(X) :
    axis==Y_AXIS ? HOMEAXIS_DO(Y) :
    axis==Z_AXIS ? HOMEAXIS_DO(Z) :
    0) {
    int axis_home_dir = home_dir(axis);


    At the very end of this function (Macro Defination) is this code:

    #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
    if (axis==Z_AXIS) retract_z_probe();
    #endif
    }
    }

    Let's change it to:


    #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
    if (axis==Z_AXIS) retract_z_probe();
    #endif
    }

    if (axis==Z_AXIS) {
    SERIAL_PROTOCOLLNPGM( "At end of homeaxis(Z) raising nozzle." );
    do_blocking_move_relative( 0.0, 0.0, (float) Z_RAISE_BETWEEN_PROBINGS );
    SERIAL_PROTOCOLLNPGM( "At end of homeaxis(Z) done raising nozzle." );
    }

    }


    If the G28 modification does not work right, we can do the changes right in the G28 code itself. Please compile and load these changes. And of course report back what is and isn't working right. Once we get the Positive Z_PROBE_OFFSET handled, we need to make sure the print doesn't stop because the Z-Probe gets fired in the middle of a print.
    Last edited by Roxy; 04-28-2014 at 09:21 AM.

  3. #3
    Technician
    Join Date
    Oct 2013
    Location
    South Australia
    Posts
    50
    Quote Originally Posted by Roxy View Post
    All right!!! Good! OK, here is what I think: I think we have two main issues to deal with. First, we need to make sure that any Z_Probing leaves the nozzle in a good (safe) position. And the second thing I think is going to happen is the Z-Probe is going to get fired during the middle of a print because of the edges curling upwards.

    Now that everybody is on the same version of the firmware, we can probably make progress pretty quickly.

    OK... First, lets try to get any Z-Probing to leave the nozzle at a safe height. There are a couple problems with this. G28 and G29 use different support functions to do their work right now. (I think they will get cleaned up eventually to use the same stuff. But right now, they do the work differently.)

    We need to have

    #define Z_RAISE_BETWEEN_PROBINGS 10.0

    defined in configuration.h Probably 10 is excessive right now, but it will let you see if it is doing the right thing.

    Now let's change run_z_probe() to leave the nozzle up. Right now it looks like this:

    static void run_z_probe() {
    plan_bed_level_matrix.set_to_identity();
    feedrate = homing_feedrate[Z_AXIS];
    ...
    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
    st_synchronize();

    current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
    // make sure the planner knows where we are as it may be a bit different than we last said to move to
    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
    }

    Lets change the very end of it to:

    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
    st_synchronize();

    current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
    // make sure the planner knows where we are as it may be a bit different than we last said to move to
    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);

    SERIAL_PROTOCOLLNPGM( "At end of run_z_probe() raising nozzle." );
    do_blocking_move_relative( 0.0, 0.0, (float) Z_RAISE_BETWEEN_PROBINGS );
    SERIAL_PROTOCOLLNPGM( "At end of run_z_probe() done raising nozzle." );

    }

    That should handle the bulk of the G29 code. Now for the G28 code, lets make sure

    #define Z_SAFE_HOMING

    is enabled in configuration.h . There are a million different code paths depending upon what options are turned on. In this case, the Z-Axis is treated with extra care. So... probably it makes sense to start with that. I'm not 100% certain this next change is going to do what we want, but it is the cleanest way to do this if it works. Be sure to have your finger ready to press the reset button when you test it. I think what we want to do is go find:

    static void homeaxis(int axis) {
    #define HOMEAXIS_DO(LETTER) \
    ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))

    if (axis==X_AXIS ? HOMEAXIS_DO(X) :
    axis==Y_AXIS ? HOMEAXIS_DO(Y) :
    axis==Z_AXIS ? HOMEAXIS_DO(Z) :
    0) {
    int axis_home_dir = home_dir(axis);


    At the very end of this function (Macro Defination) is this code:

    #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
    if (axis==Z_AXIS) retract_z_probe();
    #endif
    }
    }

    Let's change it to:


    #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
    if (axis==Z_AXIS) retract_z_probe();
    #endif
    }

    if (axis==Z_AXIS) {
    SERIAL_PROTOCOLLNPGM( "At end of homeaxis(Z) raising nozzle." );
    do_blocking_move_relative( 0.0, 0.0, (float) Z_RAISE_BETWEEN_PROBINGS );
    SERIAL_PROTOCOLLNPGM( "At end of homeaxis(Z) done raising nozzle." );
    }

    }


    If the G28 modification does not work right, we can do the changes right in the G28 code itself. Please compile and load these changes. And of course report back what is and isn't working right. Once we get the Positive Z_PROBE_OFFSET handled, we need to make sure the print doesn't stop because the Z-Probe gets fired in the middle of a print.
    I have an error on compiling.



    Marlin_main.cpp: In function 'void run_z_probe()':
    Marlin_main.cpp:921: error: 'do_blocking_move_relative' was not declared in this scope




    Section of code.

    static void run_z_probe() {
    plan_bed_level_matrix.set_to_identity();
    feedrate = homing_feedrate[Z_AXIS];


    // move down until you find the bed
    float zPosition = -10;
    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
    st_synchronize();


    current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
    // make sure the planner knows where we are as it may be a bit different than we last said to move to
    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);


    SERIAL_PROTOCOLLNPGM( "At end of run_z_probe() raising nozzle." );
    do_blocking_move_relative( 0.0, 0.0, (float) Z_RAISE_BETWEEN_PROBINGS );
    SERIAL_PROTOCOLLNPGM( "At end of run_z_probe() done raising nozzle." );
    }


    static void do_blocking_move_to(float x, float y, float z) {
    float oldFeedRate = feedrate;


    feedrate = XY_TRAVEL_SPEED;


    current_position[X_AXIS] = x;
    current_position[Y_AXIS] = y;
    current_position[Z_AXIS] = z;
    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder);
    st_synchronize();


    feedrate = oldFeedRate;
    }


    static void do_blocking_move_relative(float offset_x, float offset_y, float offset_z) {
    do_blocking_move_to(current_position[X_AXIS] + offset_x, current_position[Y_AXIS] + offset_y, current_position[Z_AXIS] + offset_z);
    }


    static void setup_for_endstop_move() {
    saved_feedrate = feedrate;
    saved_feedmultiply = feedmultiply;
    feedmultiply = 100;
    previous_millis_cmd = millis();


    enable_endstops(true);
    }


    static void clean_up_after_endstop_move() {
    #ifdef ENDSTOPS_ONLY_FOR_HOMING
    enable_endstops(false);
    #endif


    feedrate = saved_feedrate;
    feedmultiply = saved_feedmultiply;
    previous_millis_cmd = millis();
    }

  4. #4
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    Quote Originally Posted by regpye View Post
    I have an error on compiling.



    Marlin_main.cpp: In function 'void run_z_probe()':
    Marlin_main.cpp:921: error: 'do_blocking_move_relative' was not declared in this scope
    ...
    }
    My bad...

    But it isn't my fault. This is one of those times life isn't fair. Scroll down 5 or 6 lines... That is where the definition for do_blocking_move_relative() is. A simple quick fix would be to cut and past the do_blocking_move_relative() function up above run_z_probe(). Then it will be declared when run_z_probe() needs to reference it. Its a shame to mess up the order of things, but if you want to keep making forward progress... That will do it. (But I have to get some sleep!!!! I'll check back in the morning.)
    Last edited by Roxy; 04-28-2014 at 10:19 PM.

  5. #5
    Technician
    Join Date
    Oct 2013
    Location
    South Australia
    Posts
    50
    Quote Originally Posted by Roxy View Post
    My bad...

    But it isn't my fault. This is one of those times life isn't fair. Scroll down 5 or 6 lines... That is where the definition for do_blocking_move_relative() is. A simple quick fix would be to cut and past the do_blocking_move_relative() function up above run_z_probe(). Then it will be declared when run_z_probe() needs to reference it. Its a shame to mess up the order of things, but if you want to keep making forward progress... That will do it. (But I have to get some sleep!!!! I'll check back in the morning.)
    Not sure what to do about this, so I will leave it until I get further instructions.
    I will work on another machine build ready to test this out on. I want to keep a machine for each version so I can compare the differences between them.

  6. #6
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    Here is the 'right' way to fix that forward reference issue that is keeping it from compiling. It is literally a one line fix.
    Make the declaration for run_z_probe() have the forward declaration for do_blocking_move_relative() just in front of it.
    Usually there is a header file where this would go, but the best place to put this is just in front of the run_z_probe() function so it stays close to where it is needed. That way all the changes are together if you need to move your changes to a more current code base in the future. This time I actually changed my code to verify it would compile! (and then changed it back)

    With these changes the run_z_probe() function knows everything about do_blocking_move() that it needs to know. It knows what type (and how many) parameters it takes and it knows what type (none) of value it returns. The compiler can generate a 'call' to the function even though it doesn't know what the function looks like yet.


    #endif // AUTO_BED_LEVELING_GRID

    static void do_blocking_move_relative(float , float , float ) ; // New line to fix forward reference issue

    static void run_z_probe() {
    plan_bed_level_matrix.set_to_identity();
    feedrate = homing_feedrate[Z_AXIS];

    Last edited by Roxy; 04-29-2014 at 08:32 AM.

  7. #7
    Technician
    Join Date
    Oct 2013
    Location
    South Australia
    Posts
    50
    Quote Originally Posted by Roxy View Post
    Here is the 'right' way to fix that forward reference issue that is keeping it from compiling. It is literally a one line fix.
    Make the declaration for run_z_probe() have the forward declaration for do_blocking_move_relative() just in front of it.
    Usually there is a header file where this would go, but the best place to put this is just in front of the run_z_probe() function so it stays close to where it is needed. That way all the changes are together if you need to move your changes to a more current code base in the future. This time I actually changed my code to verify it would compile! (and then changed it back)

    With these changes the run_z_probe() function knows everything about do_blocking_move() that it needs to know. It knows what type (and how many) parameters it takes and it knows what type (none) of value it returns. The compiler can generate a 'call' to the function even though it doesn't know what the function looks like yet.


    #endif // AUTO_BED_LEVELING_GRID

    static void do_blocking_move_relative(float , float , float ) ; // New line to fix forward reference issue

    static void run_z_probe() {
    plan_bed_level_matrix.set_to_identity();
    feedrate = homing_feedrate[Z_AXIS];

    OK, done that and tried it oiut.
    Nozzle really lifts high now ha..ha..

    Here is a printout of what appeared on the screen as it was working.

    Printer is now online.
    echo:Home X/Y before Z
    At end of homeaxis(Z) raising nozzle.
    At end of homeaxis(Z) done raising nozzle.
    SENDING:G29
    At end of run_z_probe() raising nozzle.
    At end of run_z_probe() done raising nozzle.
    Bed x: 1.00 y: 1.00 z: 6.92
    At end of run_z_probe() raising nozzle.
    At end of run_z_probe() done raising nozzle.
    Bed x: 158.00 y: 1.00 z: 4.12
    At end of run_z_probe() raising nozzle.
    At end of run_z_probe() done raising nozzle.
    Bed x: 158.00 y: 160.00 z: 4.15
    At end of run_z_probe() raising nozzle.
    At end of run_z_probe() done raising nozzle.
    Bed x: 1.00 y: 160.00 z: 6.53
    Eqn coefficients: a: -0.02 b: -0.00 d: 6.84
    planeNormal x: 0.02 y: 0.00 z: 1.00
    echo:endstops hit: Z:-3.47

    I haven't tried a print yet, it is nearly 1.00 am here in Australia, so I am off to the shower and then to bed. Will have another look at it ion the morning (later in the morning)
    Thanks for all your effort, much appreciated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •