MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.22k stars 19.22k forks source link

Homing issue big bug ! In 1.1.3 and not in RC8 #7198

Closed ghost closed 6 years ago

ghost commented 7 years ago

Hi When homing with 1.1.3 , and boundaries setted like ' XMIN=30 , when the carriage is on the xmin switch , then firmware is on XMIN , on the lcd we can see ' 30 ' and we are on the switch in the zero position , i have made my printer on december with RC8 , today i decide to finish with the last stable marlin , and i make all parameters , BIG BUG OF HOMING with software limits

RC8 WORKS FINE

I have tried three times , with three new clean 1.1.3 , to set the minimum parameters to be sure it's me or the software

A fix ?

fiveangle commented 7 years ago

please try RCBugFix1.1.x to see if a fix already exists

ghost commented 7 years ago

HOMING ISSUE CONFIRMED

The software endstops are unfunctionnals

Return to RC8

Very sad ... i loved the new axis move menu

Thks

Bob-the-Kuhn commented 7 years ago

Did you try bugfix-1.1.x (https://github.com/MarlinFirmware/Marlin/tree/bugfix-1.1.x)?

It has some bug fixes that are not in 1.1.3

Did you transfer all the machine specific items to the new config files? Using the one from RC8 can cause some strange problems if used (without modifications) with 1.1.3 or bugfix-1.1.x.

Can you describe the failure mode in more detail? A copy of the log with your notes added would be very helpful in understanding the issue.

You could also ZIP up configuration.h & configuration_adv.h and attach them to the reply.

ghost commented 7 years ago

I have downloader , the 1.1.x version zip and make a new clean firm I have entered with my keyboard all parameters ' some basics ' directions of motors , bltouch , filament runout , and my software bed limits

When i make the homing , the carriage is on the switch ' x ' and it's the zero hardware position , but , the firmware show ' 11 ' , 11 is my xmin limit I have switched off the safe homing , i have switched all is possible but nothing happened I'm working on RC8 since december 2016 Now i have finished my 400x400x400 printer , and i want to have the last software , but , i'm very sad lolll RC8 is stable , perfect !!! But , i love the new menus and options

Bob-the-Kuhn commented 7 years ago

The configuration.h file doesn't give the whole story on the min/max positions. Here's my notes:

#define X_MIN_POS -50  // if homing in the - direction, G28 sets X position to this value after homing
#define Y_MIN_POS -70  // if homing in the - direction, G28 sets Y position to this value after homing
#define Z_MIN_POS 0    // if homing in the - direction, G28 sets Z position to this value after homing
#define X_MAX_POS 330  // if homing in the + direction, G28 sets X position to this value after homing
#define Y_MAX_POS 280  // if homing in the + direction, G28 sets Y position to this value after homing
#define Z_MAX_POS 430  // if homing in the + direction, G28 sets Z position to this value after homing
ghost commented 7 years ago

okkkkkkkkkkkkkkkkkkkkkkkkkkkkkk

ghost commented 7 years ago

Explaination Cartesian printer , x0 is on the left , and switch on the left Y0 is on the front , and the switch is on the back Settings of directions homing are x --> -1 and y --> -1 If i want a xmin software limit , i have to set ' xmin_pos=-11 ..... ??? I have a print running , i will try later

thkyou

Bob-the-Kuhn commented 7 years ago

I'm assuming that X_MIN_POS is set to -11 because the nozzle needs to move 11 mm to the right in order to be at the bed's beginning position.

If that case MIN_SOFTWARE_ENDSTOPS won't keep the nozzle within the bed.

ghost commented 7 years ago

I ve tried it now , it's perfect , i prefer like this But write a PR , to have the coments , if not , you will flood this forum just for this

I'm happy , i don't want to sleep , i make my new release

THK YOU VERY MUCH

ghost commented 7 years ago

It's ok , i have worked on this release , i have some suggestions for you 1-) If we put a negative x min its ' of course ' to place a ' PERFECT X ZERO LINE' , so if we just need the area from 'zero' , the homing have to make this G1 X0 or G1Y0 or G1X0Y0 just after the probing , and without go down with z axis Because , we have to fly over the clamps on the bed that are in the negative zone 2-) The lcd move axis must have ' zero ' as limit 'min' , just to avoid to go in the negative zone 3-) the max software endstop works fine , no need to modify 4-) In this release , The endstopsoftware ' only the min ' have no utility because the switch on the printer have the same position, the software will never stop the carriage , cause the switch will be activated at the same time

You have to make the new ' SAFE HOMING' , that have a gcode script just after , to positionate the carriage on the positive area homing x + script x0 Homing y + script yo For z there is never a negative zone ' lolll ' And now it's a sure technology

If all is respected in the slicer , the gcode will never go in negative zone

ghost commented 7 years ago

For my personnal use , i have just set the min ' lcd moves x and y ' to zero , and it's perfect , the lcd cannot' move in negative zone , the slicer have only positive values so , for me , all is ok

Bob-the-Kuhn commented 7 years ago

Glad to hear you've worked out a useable system for your application.


Right now there is no method of keeping the nozzle within the printable area if a bad command is issued.

I took a look around the code and found out that there are multiple functions that use the travel limit. Creating/modifying code to keep the nozzle safely within the print area is a non-trivial task.

There are cases where you want the nozzle to be able to travel outside the printable area. G28 and G29 fall into this class.

I'll open an issue just for this discussion.

ghost commented 7 years ago

to have the perfect use for me

The liberty of the probe : Conditional post.h line after 800 , min to max 'conversion' lol For lcd move restriction : ultralcd cpp , line 2391 .. Min = 0 lol and LIFE IS BEAUTIFULL

thinkyhead commented 7 years ago

I'm assuming that X_MIN_POS is set to -11 because the nozzle needs to move 11 mm to the right in order to be at the bed's beginning position.

That is the correct way to handle it.

[In] that case MIN_SOFTWARE_ENDSTOPS won't keep the nozzle within the bed.

The software endstops are designed to prevent movement outside the physical limits, not the bed, so you're all good.

ghost commented 7 years ago

@thinkyhead

Yes , hours after hours i understand the true functionnality of the MIN/MAX_SOFTWARE_ENDSTOPS and i understand now , one of this have no utility in some configurations

I realize the true problem is the way we understand this functionnality 7 May be , some comments to avoid many people here with the exactly same problem Like this :: Be carreful , MIN/MAX_SOFTWARE_ENDSTOPS not made for make a bed safe area , but just to make a movement limitation in the homing blind direction that have no hardware switch or probe. And you must understand that only one software limitation by axis is effective , the other direction is limited by the endstop switch ' of course '. The configuration of your slicer is the only way to not go outside of the bed , and don't forget the security perimeter of your carriage , sometimes the slicers make some ' skirt or brim ' and go out of the safe zone , and your extruder can explode ...

And now , All people are searching the way to make this safe area , but not possible in the new release

Now , we don't have bed safe area software limiter as the old RC8 , please create this .... 4 lines of boundaries and no possibility for the machine to cross these

Really important , too much risks of damage , in this release

Thks

ghost commented 7 years ago

Thk you very much to @Bob-the-Kuhn , that have given me the solution to keep alive my 1.1.3 and use it now !

ghost commented 7 years ago

@Bob-the-Kuhn @thinkyhead

Can you make us for this release :

// #DEFINE  SOFTWARE_BED_EDGE_CROSSING  
// Is to set a software axis movement limitation for the defined bed area
// works like this , bed edges x and y  are zero to maxpos 'defined in boudaries'
// Need to correctly define your travel limits to have the desired bed edges
// Use negative or positive values  to set your bed edges to the zero pos
// Usefull to protect the machine, bed with clamps, endstopswitch not positionned perfectly 
// Usefull if your slicer add ' skirts, brim , prime tower ' outside of bed 
// Machine act only in a SAFE AND SECURE BED AREA
// Enjoy !

Apply a movement to be in the bed , just after homing ๐Ÿ‘ When homed , impossible to go outside of these , lcd or gcode or nothing But only the bltouch have the right of crossing

Just one switch , and all users are happy , and user that migrate to new release will have a similar protection functionnality So many problems , risks and many damages will disapear just with this

very usefull

Bob-the-Kuhn commented 7 years ago

I can't promise this idea will be accepted.

I will start a discussion on it.

It'll be at least a week before it's implemented. Usually in the 2-4 week time frame.

I'll update this thread as progress happens.

ghost commented 7 years ago

hI , i'm trying this new firm , I LOVE IT baby step , linear pressure , and firm retract , all the menus are now more easy and more and more

How , to ?

I love the firmware retract ok for it , but i want to know how to call the firmware tool change retract , i use the old way but , with my ' Y ' dual extruder , the recovery retract must be adjusted and i need to have the possibility to set it during a print

Can you tell me how to .... G10 and G11 ok ...' 3mm ' for me , but if i want to make a tool change retractation i need 60mm retract and recovery , how to call the firmware swap tool recovery by gcode please

Thks

Bob-the-Kuhn commented 7 years ago

Sorry - firmware retract, G10 & G11 is something I've never worked with.

Best thing to do would be to open up a new issue specifically for that. That'll get the people with more printing experience looking at it.

ghost commented 7 years ago

I ask you to try this amazing thing Replace all your retract gcode by g10 and g11 and see what happens We set our retract parameters without a true idea of what will happen With this g0 g11 you can change retract in real time and test all setting you want to find what is perfect for you I will search in marlin.cpp , what are the parameters of g10 g11 to see if i can have informations

Thks you

ghost commented 7 years ago

g10 s1 to have tool change big retract , g11 to recover ' same as g10 ' because recover is just recovering to zero

Yeah , i try it tomorow

thinkyhead commented 7 years ago

Can you make us for this releaseโ€ฆ?

With both MIN_SOFTWARE_ENDSTOPS and MAX_SOFTWARE_ENDSTOPS enabled, all G0 and G1 movement is constrained to the values set for *_MIN_POS and *_MAX_POS. You will find that with these options set you cannot initiate a bad movement with these commands, or using your host's movement buttons.

That constraint is performed at a high level as part of parsing the G-code coordinates. It is simpler and easier to constrain movement there, because at that point it's always a single linear movement.

In order to constrain movement for every type of move, we would need to do so at the planner level, and here we fall into a dangerous area, where the lower-level position stored in terms of stepper steps loses synchronization with the high level current_position variable that allows us to know where the nozzle is positioned.

While in theory it would be a cool thing to add a constraint on movement at the lowest level, in practice this opens up various complex difficulties and increases computational load. So we have only opted to concatenate movements by G0 and G1 so that we can continue to know the position of the nozzle without needing to re-poll the planner and stepper classes.

thinkyhead commented 7 years ago

When testing your software endstops, use M211โ€ฆ

/**
 * M211: Enable, Disable, and/or Report software endstops
 *
 * Usage: M211 S1 to enable, M211 S0 to disable, M211 alone for report
 */
ghost commented 7 years ago

@thinkyhead Thks for the explanations ๐Ÿ‘ But physical edges and bed edges are two separates data . When we set the MIN_SOFTWARE_ENDSTOPS , on the same side of the endstop switch , but with a bed that not start on the ' ZERO , the position of the endstop switch' , all is different The manual lcd go on this negative zone , because LCD MANUAL MOVE don't stop at zero 'i have fixed this ' ๐Ÿ‘ to avoid the risk to be in negative zone For a dual extruder in line , the MAX_SOFTWARE_ENDSTOPS , is for the max position of extruder 2 to have secure movement of all the carriage, but if we have BLTOUCH between extruder1 and extruder 2 , we dream of the probe can reach the extruder 2 coordonates for probing at the maxe 'I have fixed by changing the ' max choosen selection ' of the probe movement

I ve tried the slicer and no risk with it , when we define the area in the setttings , the slice don't produce negative coordonates , it runs only between coordonates ,

ghost commented 7 years ago

@Bob-the-Kuhn @thinkyhead

hI , here are my results , MARLIN works !!!!

Tested :

I'll explain: If I want to initialize an extruder with my own gcode, I can use G1 E40 "because positive" If i want to push G1 E-40, the firmware replaces it with G10, and G10 = G1 E-3.

For the moment it's not a problem because I only use G10/G11 and G10 S1 / G11 S1.

Solution: For the swap feedrate recover of a G11 S1, make a new line for the LCD menus, add this value in the swap recovery retract engine, and don't forget to make a place in EEPROM โ€” LOLLLLL.

For the Negative extrusion replaced by G10, when "firmware retract" is turned on, I trust Marlin to repair this.

AND TO FINISH

I LOVE MARLIN , it's a beautiful job I want to thank all who worked on this project, it's a big big job!

Thanks everyone, I have my printer with MARLIN INSIDE!!! Marlin Inside!!! Yes!

ghost commented 7 years ago

@Bob-the-Kuhn @thinkyhead New results:

The FWRETRACT and AUTORETRACT features are separate and that explains the trigger phenomenon that I mentioned earlier.

Please add these comments on firmware retract to inform all users:

  1. FWRETRACT will cause reversed extruder movement to be converted into an automated retraction if the movement is larger than or equal to MIN_RETRACT. For example, a G1 E-2, is larger than MIN_RETRACT = -0.2 so it will be replaced by a G10 "firmware retract". In the case of a positive extrusion, do nothing.
  2. G10 and G11 are the normal retract and recover.
  3. G10 S1 and G11 S1 are for tool-change retract and recovery. The feedrates are the same as normal retract and recover.
  4. Be careful using FWRETRACT with Z height movement because some slicers may sometimes include a G92 Z0 in the starting G-code and your Z axis will be wrong for the rest of the print.

Please, for all users, add these comments. I have lost a week trying to understand this beautiful functionality.

thanks

ghost commented 7 years ago

I'm forced to make a new issue for g10 and g10 Too much problems ...

ghost commented 7 years ago

I have worked all night long , to learn language , and make war with each line of code that never works ... G10 and G11 are so bugged , or may be ' not finish ' , i can finish it , but i need to see the variables of the software , each time i write something , it's in blind mode , i write a line of code , i must upload the firmware and try it , it's too much I want to put some codes that permit me to see the value of all the variables i work with , because , in blind mode , it's impossible to see what really happen and the flow of the values that i need to process in my code

Can you give me a way to have an echo of all the variables i need , if i can see all the values i can understand why i can't make a functionnal line of code

Thks

ghost commented 7 years ago

I have found an idea to debugg ๐Ÿ‘

Roxy-3D commented 7 years ago

You can put SERIAL_ECHO() macros at points in the code to print out values. That is how most of us debug difficult issues.

ghost commented 7 years ago

@Bob-the-Kuhn @thinkyhead

Here is the new ' DEBUGGED FIRMWARE RETRACT PROCESS ' Only for 2 extruders , but , the work is done , to make the code for 4 extruders is now more easy 25 hours of war !!

The G10/G11 seem to be functionnal in only one config , one extruder , no zlift , but when you try to use it with ' singlenozzle' , or ' dualextrusion' and the worst ' with the ZLIFT + singlenozzle'2 extruders' ... It's a drama ! Using a singlenozzle system force to have a long swapping to load and unload , using zlift force the firmware to be very serious about zheight

Firmware retract/swap + linear advance are the most beautifull options i have seen on a printer , i felicitate the owners of this idea , and today , i give you a DEBUGGED version of FIRMWARE RETRACT ' for 2 extruders only and specially for singlenozzle with 2 extruders ' The worst is done , adapt the code for other configuration is now easy

Thks for help

Code Snippet ```cpp #if ENABLED(FWRETRACT) void retract(const bool retracting, const bool swapping = false) { static float hop_height; // debugging /*SERIAL_ECHOLNPAIR("hop height ",hop_height); SERIAL_ECHOLNPAIR("retracting ",retracting); SERIAL_ECHOLNPAIR("swapping ",swapping); SERIAL_ECHOLNPAIR("active extruder ",active_extruder); SERIAL_ECHOLNPAIR("retracted 0 ",retracted[0]); SERIAL_ECHOLNPAIR("retracted 1 ",retracted[1]); SERIAL_ECHOLNPAIR("retracted_swap0 ",retracted_swap[0]); SERIAL_ECHOLNPAIR("retracted_swap1 ",retracted_swap[1]); SERIAL_ECHOLNPAIR("current_position z ",current_position[Z_AXIS]);*/ //can retract if not retracted and swap not active if(retracting == retracted[active_extruder] &&(retracted_swap[0]==0) &&(retracted_swap[1]==0)) return; // cannot recover if not the active extruder or the active swap if(!retracting &&!retracted[active_extruder] &&!retracted_swap[active_extruder]) return; const float old_feedrate_mm_s = feedrate_mm_s; set_destination_to_current(); if (retracting) { feedrate_mm_s = retract_feedrate_mm_s; current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder]; sync_plan_position_e(); prepare_move_to_destination(); if (retract_zlift > 0.01) { hop_height = current_position[Z_AXIS]; // Pretend current position is lower current_position[Z_AXIS] -= retract_zlift; SYNC_PLAN_POSITION_KINEMATIC(); // Raise up to the old current_position prepare_move_to_destination(); } } else { // If the height hasn't been lowered, undo the Z hop if (retract_zlift > 0.01 && hop_height <= current_position[Z_AXIS]) { // Pretend current position is higher. Z will lower on the next move current_position[Z_AXIS] += retract_zlift; SYNC_PLAN_POSITION_KINEMATIC(); // Lower Z prepare_move_to_destination(); } if (retract_zlift > 0.01 && hop_height > current_position[Z_AXIS]) { //If on a slicer with no firmware retract compatibility and // you use a batch processing , sometimes , a G10 can appear before // a Z MOVE ' simplify3d' and it is need to actualise the hop_height current_position[Z_AXIS] += retract_zlift; ; hop_height = 0; see below SYNC_PLAN_POSITION_KINEMATIC(); prepare_move_to_destination(); // or hop_height = current_position[Z_AXIS]; not needed but more close to the reality } //adding of a retract multipilier ' to add in your config.h ' // To increase swapping recover by multiplying the recover feedrate // Because not implemented in marlin , the retract recover feedrate for swapping // is the same as the normal recover but too slow in the case of swapping recover // The solution ' easy' is to add a multiplier and set your own value feedrate_mm_s = swapping ? RETRACT_RECOVER_FEEDRATE_SWAP : retract_recover_feedrate_mm_s ; //feedrate_mm_s = retract_recover_feedrate_mm_s ; Original feedrate const float move_e = swapping ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length; current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder]; sync_plan_position_e(); // Recover E prepare_move_to_destination(); } feedrate_mm_s = old_feedrate_mm_s; retracted[active_extruder] = retracting; // to set the same state ' swapping' to all the extruders // Because of Zlift ' very usefull in dual color ', // all extruders must be synchronised on ONLY ONE ZLIFT if (swapping ) { if (retracting){retracted_swap[0] = 1;retracted_swap[1] = 1; } else {retracted_swap[0] = 0;retracted_swap[1] = 0; } } // debugging /*SERIAL_ECHOLNPAIR("-hop height ",hop_height); SERIAL_ECHOLNPAIR("-retracting ",retracting); SERIAL_ECHOLNPAIR("-swapping ",swapping); SERIAL_ECHOLNPAIR("-active extruder ",active_extruder); SERIAL_ECHOLNPAIR("-retracted 0 ",retracted[0]); SERIAL_ECHOLNPAIR("-retracted 1 ",retracted[1]); SERIAL_ECHOLNPAIR("-retracted_swap0 ",retracted_swap[0]); SERIAL_ECHOLNPAIR("-retracted_swap1 ",retracted_swap[1]); SERIAL_ECHOLNPAIR("-current_position z ",current_position[Z_AXIS]);*/ } // retract() #endif // FWRETRACT ```
thinkyhead commented 7 years ago

Thanks for looking more closely. I will use your sample as a guide to making FWRETRACT work correctly on more types of setups.

ghost commented 7 years ago

I have leaved comments , and debugging lines The code is made to be easy to understand and all conditions is written like a child , all is made for the engineer who want to implement it in the future release without wasting hours to try and understand

Thks for Marlin , this firmware is a very BIG JOB !

thinkyhead commented 7 years ago

Soโ€ฆ to extend for more extruders, it looks like in the first if block it needs to check whether retracted_swap is set for any extruder, not just 0 and 1. Does that make sense?

thinkyhead commented 7 years ago

for the engineer who want to implement it in the future release without wasting hours to try and understand

Always appreciated. In my 40 years of coding, I find that very few coders write good comments.

ghost commented 7 years ago

The rule for many extruders is simple ๐Ÿ‘ Only one zheight/zlifting for all , all can normal recover , you can be strict but , to avoir some risks of bad gcode that push or forget a g10 Only one can swap recover , because ' in the case of single nozzle , need to load and unload '

For more extruders , use ' do while ' , and loop the extruders[i] loll good luck The 0 and 1 is for a better visibility of the process , if i made a very short compressed and compacted code , impossibe to gain time to implement it All is made to be transmitted without wasted time You can work quickly with this type of writting !

I have past 25 hours , one night without sleeping , just for somes lines ..... I don't want to imagine , the big job marlin is ........

Roxy-3D commented 7 years ago

I doubt it is too low of resources. If you turn on the M100 Free Memory Checker, you will know for sure. Initialize the M100 Free Memory Checker after boot up... Let it print 10 layers. And see how much free memory it finds.

I don't know... But this kind of feels like how a 'Bad Pointer' problem feels. It would be worth while to make sure every where you are passing pointers, you are doing it correctly.

fiveangle commented 7 years ago

800 steps on Z does not seem like much, but you should be able to drop this in half to 400 and still get excellent layer height / bed levelling control. I dropped my PB from 2020 to 507 steps/mm and can now run aggressive Z-lift with LIN_ADVANCE, LCD, and MBL (still working on getting BILINEAR working) at 120mm/s with 1,000mm/s^2 print acceleration and no print slowdown set in slicer.

Calcs show it should be hitting 120mm/s through the middle 2" radius on bed traverse paths, and it definitely prints around 2x speed of standard 40mm/s speed with same quality. Nice thing is it doesn't realy increase noise when it's just the Z-axis since it's still high steps/mm (400 in your case).

Give it a try if your steppers support going 1/2 down from where you are now.

EDIT:

I have 800 steps my z axis ...and 2 motors

Same stepper driver for both or dual drivers ? If Dual, can you rewire them to a single ?

fiveangle commented 7 years ago

I don't see your config* files anywhere here. Please share them (you may have to zip them to upload).

ghost commented 7 years ago

๐Ÿฅ‡ all is ok , code works It was an overjerk/feedrate drops failure :-)

So , My last code is good , but not needed , marlin works , but , the g10/g10s1/g11 , have a special behavior and need to be initialised7

My code , solve this ,

You can add , but not very needed , it's just a code , to avoid to see many users come here and cry because of a very special behavior

I'm not engineer , and to code just one line , it costs 20h ... 10 hour of UPLOADING !!! and 9h of headache and test to see i have bad written the ' )' and the conditionnals have another behavior ๐Ÿ‘Ž and one hour to hate me just for one syntax bad placement !!!!!!!!!!!!!!!!! THKS FOR HELP

here's my new code Compressed and fewer processing conditionals

Code Block ```cpp #if ENABLED(FWRETRACT) void retract(const bool retracting, const bool swapping = false) { static float hop_height; static bool zlift_activated=0;// because hop_height don't tell me the true status of the carriage up or down , it's why i have created ' one bool ' it's not a crime : // debugging /*SERIAL_ECHOLNPAIR("hop height ",hop_height); SERIAL_ECHOLNPAIR("retracting ",retracting); SERIAL_ECHOLNPAIR("swapping ",swapping); SERIAL_ECHOLNPAIR("active extruder ",active_extruder); SERIAL_ECHOLNPAIR("retracted 0 ",retracted[0]); SERIAL_ECHOLNPAIR("retracted 1 ",retracted[1]); SERIAL_ECHOLNPAIR("retracted_swap0 ",retracted_swap[0]); SERIAL_ECHOLNPAIR("retracted_swap1 ",retracted_swap[1]); SERIAL_ECHOLNPAIR("current_position z ",current_position[Z_AXIS]); SERIAL_ECHOLNPAIR("ZLIFT ",zlift_activated);*/ // cause the firmware make no swap status to all extruders // need to allow the swap load and unload in singlenozzle if (retracted_swap[0]||retracted_swap[1] ) { retracted_swap[0] = 1;retracted_swap[1] = 1; } if(retracting) { //IF ALREADY RETRACTED and retract asked ---then return because not needed and if retract_zlift exist of course if( zlift_activated ) return; //can retract up if retracted and swap active and reinitilise the status lost ' cause the firmware low the swap status if(!swapping ) {if (retracted_swap[0]||(retracted_swap[1])){retracted[active_extruder]=0; retracted_swap[0] = 1;retracted_swap[1] = 1;return;}} } else { //IF ALREADY RETRACTEDDOWN and retract asked ---then return because not needed and if retract_zlift exist of course if( !zlift_activated && retract_zlift) return; // can retract the other ' for bad slicer or batch' if(!swapping) { if (!retracted[active_extruder]) retracted[active_extruder]=1;retracted[!active_extruder]=1;// can retract the other ' for bad slicer or batch' .May cause a bad restart but its better that keep ' retracted ' and the print continue. If we keep the ' up ' status , if the slicer make a swap it will be aborted. For print security it's better to allow some little g11 but not our fault if the slicer make shit code : } } const float old_feedrate_mm_s = feedrate_mm_s; set_destination_to_current(); if (retracting) { feedrate_mm_s = retract_feedrate_mm_s; current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder]; sync_plan_position_e(); prepare_move_to_destination(); if (retract_zlift > 0.01) { hop_height = current_position[Z_AXIS]; // Pretend current position is lower current_position[Z_AXIS] -= zlift_activated ? 0: retract_zlift;// ONLY ONE ZLIFT ABSOLUTE CONDITION zlift_activated=1; //CARRIAGE UP SYNC_PLAN_POSITION_KINEMATIC(); // Raise up to the old current_position prepare_move_to_destination(); } } else { // If the height hasn't been lowered, undo the Z hop if (retract_zlift > 0.01 && hop_height <= current_position[Z_AXIS]) { // Pretend current position is higher. Z will lower on the next move //current_position[Z_AXIS] += retract_zlift; current_position[Z_AXIS] += zlift_activated ? retract_zlift :0;// ONLY ONE ZLIFT ABSOLUTE CONDITION SYNC_PLAN_POSITION_KINEMATIC(); // Lower Z prepare_move_to_destination(); } if (retract_zlift > 0.01 && hop_height > current_position[Z_AXIS]) { //If on a slicer with no firmware retract compatibility and // you use a batch processing , sometimes , a G10 can appear before // a Z MOVE ' simplify3d' and it is need to actualise the hop_height current_position[Z_AXIS] += zlift_activated ? retract_zlift :0;// ONLY ONE ZLIFT ABSOLUTE CONDITION SYNC_PLAN_POSITION_KINEMATIC(); prepare_move_to_destination(); hop_height = current_position[Z_AXIS]; } //adding of a retract multipilier ' to add in your config.h ' // To increase swapping recover by multiplying the recover feedrate feedrate_mm_s = swapping ? RETRACT_RECOVER_FEEDRATE_SWAP : retract_recover_feedrate_mm_s ; //feedrate_mm_s = retract_recover_feedrate_mm_s ; Original feedrate const float move_e = swapping ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length; current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder]; sync_plan_position_e(); // Recover E prepare_move_to_destination(); zlift_activated=0; //CARRIAGE DOWN } feedrate_mm_s = old_feedrate_mm_s; retracted[active_extruder] = retracting; // ONLY FOR SINGLENOZZLE and 2 or more extruders // to set the same state ' swapping' to all the extruders // Because of Zlift and LOAD/UNLOAD that not allow all extruders LOAD TOGETHER // all extruders must be synchronised on ONLY ONE ZLIFT and Same swap status ' ABSOLUTE CONDITION' if (swapping ) { if (retracting){retracted_swap[0] = 1;retracted_swap[1] = 1; } //not needed but , If we are here and we have no swap command or unswap , it means that it's impossible to have swap status activated and we confirm it else {retracted_swap[0] = 0;retracted_swap[1] = 0; } } //debugging /* SERIAL_ECHOLNPAIR("-hop height ",hop_height); SERIAL_ECHOLNPAIR("-retracting ",retracting); SERIAL_ECHOLNPAIR("-swapping ",swapping); SERIAL_ECHOLNPAIR("-active extruder ",active_extruder); SERIAL_ECHOLNPAIR("-retracted 0 ",retracted[0]); SERIAL_ECHOLNPAIR("-retracted 1 ",retracted[1]); SERIAL_ECHOLNPAIR("-retracted_swap0 ",retracted_swap[0]); SERIAL_ECHOLNPAIR("-retracted_swap1 ",retracted_swap[1]); SERIAL_ECHOLNPAIR("-current_position z ",current_position[Z_AXIS]); SERIAL_ECHOLNPAIR("ZLIFT ",zlift_activated);*/ } // retract() #endif // FWRETRACT ```
ghost commented 7 years ago

Here is the video of the code ๐Ÿ‘

I have made this system with Ultimaker FAN , cutted and screw on the ' Y ' dual Dual extruder Y ' 3dsway' Bl touch Light ' roof bulb of car ' Flexion extruder the best of the best , WHAT ELSE ! Volcano Hotend for more melt materials and long lines possible And MARLIN AMAZING FIRMWARE flexion2.zip

thinkyhead commented 7 years ago

Thanks for the fix, @studiodyne. I'm trying to adapt your changes so that it correctly handles up to 5 extruders, but I will have to study your patch more so that I can make sure all potential situations are properly handled.

Here's the code as I've cleaned it up so far, trying not to change its behaviorโ€ฆ

Modified retract() function ```cpp #if ENABLED(FWRETRACT) void retract(const bool retracting, const bool swapping = false) { static float hop_height; static bool zlift_activated = 0; // hop_height doesn't contain the true carriage lifted status, so add a static bool /* // debugging SERIAL_ECHOLNPAIR("hop height ", hop_height); SERIAL_ECHOLNPAIR("retracting ", retracting); SERIAL_ECHOLNPAIR("swapping ", swapping); SERIAL_ECHOLNPAIR("active extruder ", active_extruder); SERIAL_ECHOLNPAIR("retracted[0] ", retracted[0]); SERIAL_ECHOLNPAIR("retracted[1] ", retracted[1]); SERIAL_ECHOLNPAIR("retracted_swap[0] ", retracted_swap[0]); SERIAL_ECHOLNPAIR("retracted_swap[1] ", retracted_swap[1]); SERIAL_ECHOLNPAIR("current_position[z] ", current_position[Z_AXIS]); SERIAL_ECHOLNPAIR("zlift_activated ", (int)zlift_activated); //*/ const bool any_swap = retracted_swap[0] || retracted_swap[1], has_zhop = retract_zlift > 0.01; // Because the firmware has no swap status for all extruders, // we need to allow the swap load and unload in singlenozzle if (any_swap) retracted_swap[0] = retracted_swap[1] = true; if (retracting) { // Don't retract if already retracted if (zlift_activated) return; // Can retract up if retracted and swap active and reinitialize the lost status - lost because the firmware cleared the swap status if (!swapping && any_swap) { retracted[active_extruder] = false; return; } } else { // Don't recover if already lowered if (!zlift_activated && has_zhop) return; // can retract the other 'for bad slicer or batch' if (!swapping && !retracted[active_extruder]) retracted[active_extruder] = retracted[!active_extruder] = true; // May cause a bad restart but it's better than staying "retracted" while the print continues. // If we retain the "up" status, if the slicer does a swap it will be aborted. // For print security it's better to allow some small G11. It's not Marlin's fault if the slicer produces bad code } const float old_feedrate_mm_s = feedrate_mm_s; set_destination_to_current(); if (retracting) { // RETRACT // Retract by moving from a faux E position back to the current E position feedrate_mm_s = retract_feedrate_mm_s; current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder]; sync_plan_position_e(); prepare_move_to_destination(); // Is a Z hop set? if (has_zhop) { // Save the current position as the height before doing the Z hop hop_height = current_position[Z_AXIS]; // Pretend current position is lower. Z will raise on the next move. if (!zlift_activated) { zlift_activated = true; // carriage is up current_position[Z_AXIS] -= retract_zlift; // Only one zlift, an absolute condition SYNC_PLAN_POSITION_KINEMATIC(); // Tell the planner the new position prepare_move_to_destination(); // Raise up to the old current_position } } } else { // RECOVER // If the height hasn't been lowered, undo the Z hop if (has_zhop) { if (hop_height <= current_position[Z_AXIS]) { // Pretend the current position is higher. Z will lower on the next move. if (zlift_activated) { current_position[Z_AXIS] += retract_zlift; // Only one zlift, an absolute condition SYNC_PLAN_POSITION_KINEMATIC(); // Lower Z prepare_move_to_destination(); } } else { // If on a slicer with no firmware retract compatibility and // you use batch processing, sometimes a G10 can appear before // a Z MOVE. 'Simplify3D' and it is needed to actualise the hop_height if (zlift_activated) { current_position[Z_AXIS] += retract_zlift; // Only one zlift, an absolute condition SYNC_PLAN_POSITION_KINEMATIC(); prepare_move_to_destination(); hop_height = current_position[Z_AXIS]; } } } // A retract multiplier has been added here to get faster swap recovery // To increase swapping recover by multiplying the recover feedrate feedrate_mm_s = swapping ? RETRACT_RECOVER_FEEDRATE_SWAP : retract_recover_feedrate_mm_s; //feedrate_mm_s = retract_recover_feedrate_mm_s // Original feedrate const float move_e = swapping ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length; current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder]; sync_plan_position_e(); // Recover E prepare_move_to_destination(); zlift_activated = false; // The carriage is down } feedrate_mm_s = old_feedrate_mm_s; retracted[active_extruder] = retracting; // ONLY FOR SINGLENOZZLE and 2 or more extruders // to set the same state ' swapping' to all the extruders // Because of Zlift and LOAD/UNLOAD that not allow all extruders LOAD TOGETHER // all extruders must be synchronised on ONLY ONE ZLIFT and Same swap status ' ABSOLUTE CONDITION' if (swapping) retracted_swap[0] = retracted_swap[1] = retracting; /* // debugging SERIAL_ECHOLNPAIR("hop height ", hop_height); SERIAL_ECHOLNPAIR("retracting ", retracting); SERIAL_ECHOLNPAIR("swapping ", swapping); SERIAL_ECHOLNPAIR("active_extruder ", active_extruder); SERIAL_ECHOLNPAIR("retracted[0] ", retracted[0]); SERIAL_ECHOLNPAIR("retracted[1] ", retracted[1]); SERIAL_ECHOLNPAIR("retracted_swap[0] ", retracted_swap[0]); SERIAL_ECHOLNPAIR("retracted_swap[1] ", retracted_swap[1]); SERIAL_ECHOLNPAIR("current_position[z] ", current_position[Z_AXIS]); SERIAL_ECHOLNPAIR("zlift_activated ", (int)zlift_activated); //*/ } // retract() #endif // FWRETRACT ```
ghost commented 7 years ago

For better reading and better future of this firmware

it's just and idea , because , the 2/3/4 in one extruder come in the 3d stores everywhere and marlin must be ready and

For example ' SIMPLIFY3D ' have a big problem with initialisation I have asked them to fix it

If you work with a singlenozzle ' you have to load and unload ' , but simplify3d don't have the process for that , but only for a multi nozzle system I explain

You make a dual color , the first extruder is loaded by you , the first extrusion can start , but , when the second extruder is called , simplify3d don't make ' A LOADING ' , and just make a simple extrusion and initilialise the extruder position to E0 , If you have single nozzle , you have to add a G11 or a G1 E50 to load

I have asked them , to make something easy , i asked them to put ' a comment ' just before the first extrusion of each first time extruder run , and with the script we can add ' G11 ' or G1EXX

SINGLENOZZLE IS MY WAR loll

Simplify3d need to implement firmware retract too !!! It's my war too !

Thks for the pr

thinkyhead commented 7 years ago

SINGLENOZZLE IS MY WAR loll

It's a feature that some forks have had for years, but the main fork only got it last Autumn. Hopefully this will spur on the slicer makers. Probably the "Prusa Control" slicer is going to have the best current support.

Simplify3d need to implement firmware retract too !!! It's my war too !

Recently firmware retraction got some fixes. In particular, it should handle "autoretract" better. With this option, Marlin intercepts any reverse E-only movements and replaces them with Firmware Retraction according to settings instead. Then the next forward E-only move is replaced with a recover move according to settings. This can also be used to prevent retract/recover moves if you want to filter out retraction in existing G-code.

If Simplify3D won't generate G10/G11 and the Autoretract option doesn't work with the G-code that Simplify3D produces, post a sample of the G-code so we can see where it's confusing Marlin.

ghost commented 7 years ago

@thinkyhead I will try to give you all comprehensive Help i have modified the code because , the retractation is corrupted if a G1 Zx movement appears between a G10/G11 , the zlift can not recover , and stay hight , it's just a zlift problem You don't have this problem , because you use slic3r

see the simplify 3d Gcode .


G10                          ----------->  RETRACT
G1 Z0.300 F1320     -----------> **move z AFTER retract**
; process Process1
; layer 1, Z = 0.300
T0                            -----------> tool change
; tool H0.300 W0.600
; skirt
G1 X190.646 Y148.822 F9000 -----------> move x/y
G11 ;                                       -----------> recover

Compared to SLIC3R ' that move z before a retract and don't reveal the bug '

G1 Z0.350 F7800.000   -----------< **move z BEFORE retract**
G10 ; retract
G92 E0
G1 X70.203 Y70.257 F7800.000
G11 ; unretract
G92 E0

This conditionnals breaks the ZLIFT ' if activated '," works without zlift ", but if zlift , the carriage will never go down to origin before hop

if (hop_amount && NEAR(hop_height, destination[Z_AXIS]))

It's why i have replaced by if (hop_amount) {

You have the other comment to know other problems

Only one zlift allowed , ' Not a problem but it's better if only one possible '

Lcd Menu for Swap recover Feedrate , yes because to perform a perfect recover during a print , i have made it by myself and it's a good to have it

I love marlin , and if these corrections are made , you will have the most advanced retraction system. Please read my comment about the fixes , all is true , tested , and need you work on it for details , look at my original comment , you will have all

FHeilmann commented 7 years ago

because Marlin is the only firmware that have this ,

RepRapFirmware, Repetier and Smoothie also supports it

btw. if you really want to use retraction in S3D, you can do so via three lines of post processing script that you can set within S3D to replace all G1 retracts and retracts with G10/G11. I'll dig them up when I'm home from work and share them.

ghost commented 7 years ago

Script to replace the retraction in simplify by G10 G10S1 and G11 I have a single nozzle extruder that need 50mm to load and unload , it's why you see a big tool change value

{REPLACE "G1 E-2.0000 F1800" "G10\n"}
{REPLACE "G1 E0.2000" "G11 ;\n "}
{REPLACE "G1 E-50.0000 F1800\n" "G10 S1 \n"}
{REPLACE "G1 E-5.0000 F1800" "G11 \n "}

Yes i use it since 3 monthes , all is perfect I have simplify3d since 2013 , i know this software

FHeilmann commented 7 years ago

There seems to be a typo in your script.

You are replacing a negative E-Move with a G11 (which is unretract) shouldn't your last line be

{REPLACE "G1 E+5.0000 F1800" "G11 \n "}

? And BTW, S3D likes to insert one Retract at the very beginning of the G-Code at a fraction of your normal retract speed. That was one issue that took me forever to find. In case it gives you (or anyone else that's reading this in the future) trouble, look at the g-codes S3D generates and add an additional REPLACE for the reduced-speed retract in the beginning of the G-Code.

ghost commented 7 years ago

No , because with my single nozzle , + volcano , when i make a tool change , the filament go out and is cooled , when it recovers , it push strongly and make a blob , it's why , i have reduced the return

Don't worry about my settings , i use it every day If i use you script , i will make a soccer ball in my buildplate loll