Are filament load and unload distances actually changed via configuration.Prusa.h?
 
Notifications
Clear all

Are filament load and unload distances actually changed via configuration.Prusa.h?  

  RSS
Bunny Science
(@bunny-science)
Noble Member
Are filament load and unload distances actually changed via configuration.Prusa.h?

I've dutifully added filament move changes for various extruders to the Prusa firmware. Basically, they involved changes to defines in this block in the variants files...

/*------------------------------------
LOAD/UNLOAD FILAMENT SETTINGS
*------------------------------------*/

// Load filament commands
#define LOAD_FILAMENT_0 "M83"
#define LOAD_FILAMENT_1 "G1 E70 F400"
#define LOAD_FILAMENT_2 "G1 E40 F100"

// Unload filament commands
#define UNLOAD_FILAMENT_0 "M83"
#define UNLOAD_FILAMENT_1 "G1 E-80 F7000"

However, while reading through the firmware to learn how to add an extra filament advance during unload, I cannot find anywhere in the rest of the firmware that uses those definitions. This is true in 3.7.3 and 3.8.0

Also, when I look at void unload_filament() in ultralcd.cpp, the extruder move distances are hard coded as numerical constants.

Can anyone else find the mechanism through which changes to LOAD_FILAMENT_1, LOAD_FILAMENT_2, or UNLOAD_FILAMENT_1 are used?

I simply can't find any using global search for those defines. If they don't show up anywhere else in the source code, I don't see how they do anything. I'm suspecting those defines actually don't work.

Somebody please tell me I am wrong.

 

Posted : 27/08/2019 6:38 am
Bunny Science
(@bunny-science)
Noble Member
Topic starter answered:
RE: Are filament load and unload distances actually changed via configuration.Prusa.h?

I'm getting more convinced that those defines for filament load and unload distances do nothing.

The procedure in Marlin_main.cpp for filament load has hard coded move distances....

 

void gcode_M701()
.
.
.

lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT));

current_position[E_AXIS] += 40;

plan_buffer_line_curposXYZE(400 / 60, active_extruder); //fast sequence

st_synchronize();

marlin_rise_z();

current_position[E_AXIS] += 30;

plan_buffer_line_curposXYZE(400 / 60, active_extruder); //fast sequence

load_filament_final_feed(); //slow sequence

st_synchronize();

    Sound_MakeCustom(50,500,false);

I can fix this by changing the distances and rates into defined symbols, but for now those defines in the variants file can't possibly work.

This post was modified 5 years ago by Bunny Science
Posted : 27/08/2019 6:54 am
Bunny Science
(@bunny-science)
Noble Member
Topic starter answered:
RE: Are filament load and unload distances actually changed via configuration.Prusa.h?

My development branch has new changes making filament load / unload distance and rate defines actually active.

https://github.com/guykuo/Prusa-Firmware/tree/0.9-development

Not yet tested other than verifying it compiles.

Posted : 27/08/2019 8:14 am
CybrSage liked
--
 --
(@)
Illustrious Member
RE: Are filament load and unload distances actually changed via configuration.Prusa.h?

The more I learn about Prusa firmware, the more worried I am one day my printer will simply explode in place.

ps: there are places I've found lurking that explain many of the weird crashes and odd happenings with the filament sensors related to the print recovery options, like power fail or filament out, and probably even crash recovery.   You read the code and just want to throw up your hands.

This post was modified 5 years ago by --
Posted : 27/08/2019 8:28 am
Bunny Science
(@bunny-science)
Noble Member
Topic starter answered:
RE: Are filament load and unload distances actually changed via configuration.Prusa.h?

Yes. This was a WTF discovery.

New defines in my variants completely replace the defines abandoned by Prusa.

/*------------------------------------

LOAD/UNLOAD FILAMENT SETTINGS

*------------------------------------*/

// Load filament distances and rates

#ifdef BONDTECH_PRUSA_UPGRADE_MK3

#define LOAD_FILAMENT_DIST_1 40 //Kuo BMG load

#define LOAD_FILAMENT_RATE_1 400

#define LOAD_FILAMENT_DIST_2 40 //10 mm farther

#define LOAD_FILAMENT_RATE_2 100

#elif defined(BONDTECH_PRUSA_UPGRADE_MK3S)

#define LOAD_FILAMENT_DIST_1 40 //Kuo BMG load

#define LOAD_FILAMENT_RATE_1 400

#define LOAD_FILAMENT_DIST_2 40 //10 mm farther

#define LOAD_FILAMENT_RATE_2 100

#else

#define LOAD_FILAMENT_DIST_1 40 //Kuo Prusa default load

#define LOAD_FILAMENT_RATE_1 400

#define LOAD_FILAMENT_DIST_2 30

#define LOAD_FILAMENT_RATE_2 100

#endif





// Unload filament distances and rates

#ifdef BONDTECH_PRUSA_UPGRADE_MK3

#define UNLOAD_FILAMENT_DIST_0 2 //Kuo extrude slightly first

#define UNLOAD_FILAMENT_RATE_0 100

#define UNLOAD_FILAMENT_DIST_1 -45 //Kuo BMG unload

#define UNLOAD_FILAMENT_RATE_1 5200

#define UNLOAD_FILAMENT_DIST_2 -15

#define UNLOAD_FILAMENT_RATE_2 1000

#define UNLOAD_FILAMENT_DIST_3 -40 //20 mm farther

#define UNLOAD_FILAMENT_RATE_3 1000

#else

#define UNLOAD_FILAMENT_DIST_0 2 //Kuo extrude slightly first

#define UNLOAD_FILAMENT_RATE_0 100

#define UNLOAD_FILAMENT_DIST_1 -45 //Kuo Prusa default unload

#define UNLOAD_FILAMENT_RATE_1 5200

#define UNLOAD_FILAMENT_DIST_2 -15

#define UNLOAD_FILAMENT_RATE_2 1000

#define UNLOAD_FILAMENT_DIST_3 -20

#define UNLOAD_FILAMENT_RATE_3 1000

#endif

This post was modified 5 years ago by Bunny Science
Posted : 27/08/2019 8:31 am
Bunny Science
(@bunny-science)
Noble Member
Topic starter answered:
RE: Are filament load and unload distances actually changed via configuration.Prusa.h?

Tested, made a couple adjustments and the changes are now merged into my main 0.9 support branch.

BMG load / unload distances should now actually do something.

Also, added my "mini ram" movement at start of filament unload. Extruder moves forward 2 mm and then does unload. That is what I usually do manually with every unload to create a smaller, easy to pull out, filament tip.

Posted : 27/08/2019 9:43 am
rmm200
(@rmm200)
Noble Member
RE: Are filament load and unload distances actually changed via configuration.Prusa.h?

Rule of thumb:

Any piece of code more than two years old has both sections of abandoned code - and comments that refer to the way the code used to work.

Maintaining old code is hard. I prefer a new project any day. Merlin is still basically the code that still runs on my Prusa Mendel.

Same Ramps board too.

Posted : 27/08/2019 6:36 pm
lowfat liked
Dave Avery
(@dave-avery)
Honorable Member
RE: Are filament load and unload distances actually changed via configuration.Prusa.h?

time to submit a pull request and github issue to get your fixes included in the code base

Posted : 28/08/2019 6:48 am
--
 --
(@)
Illustrious Member
RE: Are filament load and unload distances actually changed via configuration.Prusa.h?
Posted by: rmm200

Rule of thumb:

Any piece of code more than two years old has both sections of abandoned code - and comments that refer to the way the code used to work.

No rule of thumb about it.  It's a sign of poor coding practice.  Plain, simple, and irrefutable.   And maintaining it is only hard because the guy that did the damage - the guy that mangled the code in the first place - didn't do his job.  

Posted : 28/08/2019 3:19 pm
BrettG
(@brettg)
Estimable Member
sorry to pull up an old thread

Looking to be able to change load and unload distances when changing the length of the PTFE tubing from nozzle to gear on my prusa mini.

resulting in the filament falling short and not purging like it should and also retracting is a issue.

Is this now possible and if so would anyone mind helping me out if I know the length of the tube.

I know this is the mk3 sub but can't seem to find any info anywhere else.

Posted : 26/08/2021 10:47 am
Share: