Welcome! Log In Create A New Profile

Advanced

Dual Extruder on a Servo, Probe on same servo in Marlin 2.x

Posted by L3D 
L3D
Dual Extruder on a Servo, Probe on same servo in Marlin 2.x
January 30, 2021 08:16PM
Hello all,

First time poster. I did do some searching and could not find my specific layout to draw from.

I am using a single servo (Servo 0) to control a dual extruder setup. Angle of about 70 brings T0 up and drops T1. Angle of 0 drops T0 and lifts T1.
My probe is positioned a few millimeters below both extruders when the servo position is roughly mid range of its stroke.
In Marlin 1.1.x I told Marlin it was a servo probe, not a fixed one. This let me control the extruder heights (though not within the native code, I had to create what is listed below to make it work).

I used in various positions of the firmware:

#define SERVO_UP_SCRIPT_M870 "M280 P0 S0" //L3D Added Line

case 870: gcode_M870(); break; // L3D Line Added M870: Servo Position UP

inline void gcode_M870() {
#ifdef SERVO_UP_SCRIPT_M870
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR("Servo Up Script: ", SERVO_UP_SCRIPT_M870);
#endif
planner.synchronize();
enqueue_and_echo_commands_P(PSTR(SERVO_UP_SCRIPT_M870));
#endif
}

Then in the G28 I used this:

/**
* Home an individual linear axis
*/
static void do_homing_move(const AxisEnum axis, const float distance, const float fr_mm_s=0) {
//L3D Raise Servo Added
planner.synchronize();
enqueue_and_echo_commands_P(PSTR(SERVO_UP_SCRIPT_M870));
//L3D Raise Servo End

I am not a programmer, I just mimicked some code already there to try to get my system to function. This worked fine in 1.1.x because the tool 0 or 1 was not called out again after G28, before G29.
(Marlin of course still thought the last called tool was properly in position so in the slicer I called a T1; T0; to be sure Marlin was cough up when it was time to print.

Not pretty but it got the job done.

Upgrading to 2.0.7 now, it seems I needed a new approach. I used :

//L3D START added servo move
#ifndef Set_Servo_Even
#define Set_Servo_Even "M280 P0 S33" //L3D Add servo location definition
#endif
gcode.process_subcommands_now_P(PSTR(Set_Servo_Even)); //L3D Run servo location
//L3D END added servo move

Again, not a programmer but mimicking the code found elsewhere did work for G28. (Well, I tried it in the G28 code and it didn't work but sticking it into the motion.cpp at the homing area did work.)

What I found out though was Marlin 2.x recalls the Tool after G28 before G29.
I tried several places in or around the G29 code and have had no success in making the final servo move to S33 remain active when the probing begins. It keeps recalling a tool at the time of probing.
That recall of course, drops one of the extruders below the probe.

What I am hoping someone can steer me to is:

1) What's the proper code to use in G28 and G29 to make the servo go to S33 so the probe has clearance.
2) In what file do I put that code for the G29. (I've tried in G29, ubl_G29, ubl_motion) I get either it does not work, or the code is bad for the area.

Being not a programmer, I suspect it can be done in one of those location but the code listed above either activates before a final tool call or shows as bad code in PlatformIO.

Any point in the direction of code and/or location would be great.

Thanks for listening.
L3D
Re: Dual Extruder on a Servo, Probe on same servo in Marlin 2.x
February 01, 2021 05:45AM
Issue resolved. I fount the Stow Probe function later in the motion planner. Commented that out and it now works as it did in 1.1.9.
Sorry, only registered users may post in this forum.

Click here to login