Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching extruder (dondolo) without servo #24553

Merged

Conversation

EvilGremlin
Copy link
Contributor

@EvilGremlin EvilGremlin commented Jul 26, 2022

Description

Allow flipping dondolo extruder in purely mechanical way, by bumping tollhead into gantry sides. Thought it was already there for ages, but apparently not.
Maybe even expand for 3+ nozzles/extruders because why not? I can envision selector mechanicas for nearly infinite switching.
Should i add some tests?

P.S.: Config value changes that fail tests included intentionally for now.

@thinkyhead thinkyhead marked this pull request as draft July 28, 2022 05:44
@thinkyhead thinkyhead force-pushed the bugfix-2.1.x-dondolotest branch 8 times, most recently from c8ca7e8 to 8ec0ac1 Compare July 28, 2022 07:24
@EvilGremlin EvilGremlin changed the title [Preview] Switching extruder without servo [Draft] Switching extruder without servo Jul 28, 2022
Copy link
Contributor

@ansonl ansonl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EvilGremlin Should #define SWITCHING_NOZZLE_MECHANICAL in Configuration.h actually be #define MECHANICAL_SWITCHING_NOZZLE? I'm testing your changes with the corrected wording of MECHANICAL_SWITCHING_NOZZLE with a Ultimaker DXU dual mechanical switching extruder/nozzle and it works well so far.

@EvilGremlin
Copy link
Contributor Author

yep, Scott renamed it but forgot conf

@EvilGremlin EvilGremlin changed the title [Draft] Switching extruder without servo Switching extruder (dondolo) without servo Sep 1, 2022
@EvilGremlin
Copy link
Contributor Author

I wanted more people to test it and give opinons on config options/descriptions, but i guess we'll have to fix it in post :)

@EvilGremlin EvilGremlin marked this pull request as ready for review September 1, 2022 12:35
@ansonl
Copy link
Contributor

ansonl commented Sep 1, 2022

@EvilGremlin I'm waiting on a higher wattage PSU to fully test dual extruder functionality on my printer.
Using MECHANICAL_SWITCHING_NOZZLE the mechanical switching gcode that I have specified for tool changes work well with the T0/T1 commands.

I did notice that there doesn't seem to be a way to reset the feedrate/speed of the printer to what it was after the toolchange g-code completes. If the printer was printing with movements at a slower or faster speed and a custom speed is specified in the toolchange g-code, I believe the custom speed will be used for movements after the toolchange until set again in the printing g-code. This affects the other switching methods as well but probably is more important for mechanical switching that uses toolhead movements itself.

Since many mechanical switchers rely on gravity or springs, too slow or too fast of a movement speed inherited from the printing g-code may lead to a failure to properly switch due to friction (too slow) or mechanical stress (too fast?).

@EvilGremlin
Copy link
Contributor Author

Oh, this is indeed a concern. You can't omit F in toolchange gcode because chances are you print too slow or too fast at a moment. Though usually you'd set up toolchange gcode with feedrate in slicer, and change from menu will use safe default feedrate. I will look into this.

@ansonl
Copy link
Contributor

ansonl commented Sep 1, 2022

Do you know if there is an option in Cura to set toolchange speed? I couldn't find an option it makes sense since the slicer only calls T0/T1 to initiate the toolchange g-code which it lets the firmware handle.

I checked a test print with dual extrusion generated by Cura which outputs the below commands before and after toolchange.

G1 X48.45 Y139.1 E108.31521
G0 F5400 X48.65 Y139.1
G1 F1500 E101.81521
G1 F600 Z1.25
G92 E0
T0
G92 E0
M105
M109 S200
M104 T1 S0
G1 F600 Z0.25

Cura seems to specify the F for the printing command after the toolchange but I haven't looked into it enough to see if this is just coincidence. I haven't had any issues with varying movement speed for my switching mechanism with the current code which I think is ready for release but future improvement for ability to restore the previous F after toolchange would be a nice to handle all slicers.

@EvilGremlin
Copy link
Contributor Author

No idea, i don't use cura and advise everyone to do so too. Don't it have toolchange gcode script?

@ansonl
Copy link
Contributor

ansonl commented Sep 1, 2022

Not that I'm aware of, I just specify my 2 toolchange scripts in EVENT_GCODE_TOOLCHANGE_T0 and EVENT_GCODE_TOOLCHANGE_T1

@EvilGremlin
Copy link
Contributor Author

well this is it, write whatever you need there

@ansonl
Copy link
Contributor

ansonl commented Sep 1, 2022

I looked around some more and in Cura it is possible to set Extruder start gcode and Extruder end gcode for each extruder so it's similar to other slicers.

@DerAndere1
Copy link
Contributor

DerAndere1 commented Sep 13, 2022

Do you know if there is an option in Cura to set toolchange speed? I couldn't find an option it makes sense since the slicer only calls T0/T1 to initiate the toolchange g-code which it lets the firmware handle.

IIRC, Marlin uses the feedrate specified by XY_PROBE_FEEDRATE (in Configuration.h) during tool changes. this is how it works internally: file tool_change.cpp has the line REMEMBER(fr, feedrate_mm_s, XY_PROBE_FEEDRATE_MM_S);

@DerAndere1
Copy link
Contributor

I would suggest to change tool_change.cpp

      #elif ENABLED(SWITCHING_NOZZLE) && !SWITCHING_NOZZLE_TWO_SERVOS   // Switching Nozzle (single servo)
        // Raise by a configured distance to avoid workpiece, except with
        // SWITCHING_NOZZLE_TWO_SERVOS, as both nozzles will lift instead.
        if (!no_move) {
          const float newz = current_position.z + _MAX(-diff.z, 0.0);

          // Check if Z has space to compensate at least z_offset, and if not, just abort now
          const float maxz = _MIN(TERN(HAS_SOFTWARE_ENDSTOPS, soft_endstop.max.z, Z_MAX_POS), Z_MAX_POS);
          if (newz > maxz) return;

          current_position.z = _MIN(newz + toolchange_settings.z_raise, maxz);
          fast_line_to_current(Z_AXIS);
        }
        move_nozzle_servo(new_tool);
      #endif

to this:

      #elif ENABLED(SWITCHING_NOZZLE) && !SWITCHING_NOZZLE_TWO_SERVOS   // Switching Nozzle (single servo)
        // Raise by a configured distance to avoid workpiece, except with
        // SWITCHING_NOZZLE_TWO_SERVOS, as both nozzles will lift instead.
        if (!no_move) {
          const float newz = current_position.z + _MAX(-diff.z, 0.0);

          // Check if Z has space to compensate at least z_offset, and if not, just abort now
          const float maxz = _MIN(TERN(HAS_SOFTWARE_ENDSTOPS, soft_endstop.max.z, Z_MAX_POS), Z_MAX_POS);
          if (newz > maxz) return;

          current_position.z = _MIN(newz + toolchange_settings.z_raise, maxz);
          fast_line_to_current(Z_AXIS);
        }
        #if EITHER(MANUAL_SWITCHING_NOZZLE, MANUAL_SWITCHING_EXTRUDER)
          if (ENABLED(EVENT_GCODE_TOOLCHANGE_ALWAYS_RUN) || !no_move) {
            #ifdef EVENT_GCODE_TOOLCHANGE_T0
              if (new_tool == 0)
                gcode.process_subcommands_now(F(EVENT_GCODE_TOOLCHANGE_T0));
            #endif

           #ifdef EVENT_GCODE_TOOLCHANGE_T1
             if (new_tool == 1)
               gcode.process_subcommands_now(F(EVENT_GCODE_TOOLCHANGE_T1));
           #endif
         }
       #else
         move_nozzle_servo(new_tool);
       #endif

and change the original section dealing with EVENT_GCODE_TOOLCHANGE_T# to something like this:

#if NONE(MANUAL_SWITCHING_NOZZLE, MANUAL_SWITCHING_EXTRUDER)
  if (ENABLED(EVENT_GCODE_TOOLCHANGE_ALWAYS_RUN) || !no_move) {
    #ifdef EVENT_GCODE_TOOLCHANGE_T0

...

#endif

@ansonl
Copy link
Contributor

ansonl commented Mar 4, 2023

@thinkyhead Bumping, this PR is tested and ready to merge. Thanks.

@thinkyhead thinkyhead force-pushed the bugfix-2.1.x-dondolotest branch from 40a9fd6 to 70bce1b Compare March 4, 2023 02:10
thinkyhead added a commit to MarlinFirmware/Configurations that referenced this pull request Mar 4, 2023
@thinkyhead thinkyhead merged commit e977232 into MarlinFirmware:bugfix-2.1.x Mar 4, 2023
@thinkyhead thinkyhead deleted the bugfix-2.1.x-dondolotest branch March 4, 2023 02:43
LMBernardo pushed a commit to LMBernardo/Marlin that referenced this pull request Mar 19, 2023
…ware#24553)

Co-authored-by: Anson Liu <ansonl@users.noreply.github.com>
thinkyhead pushed a commit that referenced this pull request Apr 7, 2023
Co-authored-by: Anson Liu <ansonl@users.noreply.github.com>
EvilGremlin added a commit to EvilGremlin/Marlin that referenced this pull request Apr 8, 2023
…ware#24553)

Co-authored-by: Anson Liu <ansonl@users.noreply.github.com>
thinkyhead pushed a commit that referenced this pull request Apr 10, 2023
Co-authored-by: Anson Liu <ansonl@users.noreply.github.com>
thinkyhead pushed a commit to thinkyhead/Marlin that referenced this pull request May 16, 2023
…ware#24553)

Co-authored-by: Anson Liu <ansonl@users.noreply.github.com>
EvilGremlin added a commit to EvilGremlin/Marlin that referenced this pull request May 17, 2023
…ware#24553)

Co-authored-by: Anson Liu <ansonl@users.noreply.github.com>
tspiva pushed a commit to tspiva/Marlin that referenced this pull request May 25, 2023
…ware#24553)

Co-authored-by: Anson Liu <ansonl@users.noreply.github.com>
Andy-Big pushed a commit to Andy-Big/Marlin_FB_Reborn that referenced this pull request Jul 9, 2023
…ware#24553)

Co-authored-by: Anson Liu <ansonl@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants