Global variables for filament temperatures
-
To add to that I was really hoping that there would be a way for a pop-up on the PanelDue where a user could select a defined filament type for a macro.
Currently if I create a macro which I need for PLA but also for PETG, I need two macros. The ability to select a filament as part of the macro would simplify many things.
Does anyone know if something like this is planned or if it would be worth to submit as enhancement request?
-
@flobler expansion of M291 is planned to be part of 3.5
-
@jay_s_uk that is amazing news, thank you! Is there a place to follow what will be considered for this?
-
@jay_s_uk awesome thank you
-
@flobler there isn't at the moment. i believe they are planning to add the wishlist to github but i'm not sure on the timescales
-
@flobler - On my printer, I have a separate macro where I declare all my global variables and I call this macro as the first thing (after logging is turned on) in config.g. This way I can be assured that they have all been declared and use them in config.g. In a further anal-retentive move, I name my globals with a first part that is descriptive of their use. Examples
global config_X_endstop_offset = 2 global config_Y_endstop_offset = 2 global config_Z_negative_limit = 4
I also try to add them in alphabetical order.
About your filament types, I've just started writing some macros to help me with filament changes. I have a one generic macro for all unloading and a second for all loading. I keep this in my macros folder. Then in the filaments folder, the load.g and unload.g call the generic macro and pass them parameters. Not quite what you are looking to do, but similar.
; Generic macro for loading filament from a directly connected Mosquito hot end. ; Required input parameters ; T - the temperature (in C) the extruder must reach before the filament can be unloaded. ;Checks if !exists(param.T) ; see if a parameter "T" was provided with the macro M291 P"Must provide extruder temperature parameter - T" R"Loading Filament" S1 T10 M99 if {state.currentTool < 0} M291 P"No tool selected, must select a tool first" R"Loading Filament" S1 T10 M99 ; OK, we have a temperature target and a tool selected, lets get going. ;Prep for loading M568 S{param.T} ;set hotend temperature M291 P"Heating... " R"Loading Filament" S0 M116 P{state.currentTool} S2 ;wait for hot end (P) to heat up to within 2 degrees (S2) of the load temperature. ;Load M291 P"Insert new Filament into extruder and press OK, cancel to abort the load filament process." R"Load Filament" S3 T-1 ;grab and move the filament M83 ;set extruder to relative mode G1 E70 F{10*60} ;move the filament quickly to the hot break G1 E24 F{5*60} ;move slowler to get the filament to the nozzle G1 E10 F{5*60} ;squirt some out G4 S0 ; ask if it was successful while true M291 P"If new filament is not coming out, press OK. Press Cancel to stop/finish the loading process." R"Load Filament" S3 T-1 G1 E10 F{5*60} ;squirt some out G4 S0
-
-
@mikeabuilder Thank you for your reply!
I am debating with myself if I want to put the global variables in a separate file or into config.g. I am not sure I understand the differences/implications enough yet to make a decision about that. Good tip to put them in alphabetical order, thanks.
Yeah I do something similar, the filament load.g and unload.g only handle filament temperature and then call a different file to handle all the loading and unloading moves. As far as I understand that is what you are doing, correct?
My problem is a little bit different though I think, let me try to share an example:
I have a macro that helps to calibrate the first layer height with a print in the middle of the plate and then automatically stores these values in config-override.g. Currently I have this set for PLA and therefore defined 210C hotend temperature and 60C bed temperature. Now imagine I want to do the same for PETG (with 235C hotend temperature and 80C bed temperature).
This leaves me with the following options:
- modify the temperatures in the existing macro (either in the code or via a variable at the start of the macro
- have a separate macro defined with PETG temperatures
What I want though is to hit the "first layer height" macro and then be able to decide for which filament/temperature I am running it at the time.
-
Yes, that is precisely what I'm doing.
-
I suspect that there is something in the object model that says what the last filament selected from the filaments directory is.
However, I don't see it in the wiki page. There is a job.timesLeft.filament that returns a number, but I'm not sure this will return anything when a print job is not running.
I don't have access to my printer now but maybe using M409 can help you find it.
-
@mikeabuilder @flobler
You can access the loaded filament using move.extruders['nnn'].filamentI use that in conjunction with a global variable to achieve a system somewhat like @flobler is trying to do.
I put the temps, retractions etc in the config.g of the various filaments and use a universal load/unload file.If you poke around my setup here it may help.
https://github.com/owendare/RepRapFirmware-Macros -
@owend Thank you very much. Your macros are far more advanced than mine, this will be a good learning experience. I will certainly take a look at your repo!
Am I understanding correctly, that your system aims to use the temperatures of the currently loaded filament for macros you select? Meaning instead of my ideal approach where one would be able to select a filament on the PanelDue after issuing a macro, you would rely on first loading the filament you want to run a macro with, then issue the macro which will pick the temperatures needed for that filament?
This would be very close to what I want and definitely a good workaround until PanelDue provides more options for pop-ups.
Thanks again!
-
@flobler
Yes, that's pretty much the approach.
DWC uses M701, M702, M703
I just leverage that.
In my slicer (superslicer/prusa slicer) start G Code I have among other stuff, this section which relates to filaments or other macros I use for mesh probing.
I use the global variable to check if the filament I've sliced for matches what is loaded in RRFset global.minProbeX = {first_layer_print_min[0]} set global.maxProbeX = {first_layer_print_max[0]} set global.minProbeY = {first_layer_print_min[1]} set global.maxProbeY = {first_layer_print_max[1]} T[current_extruder] ; set global.LoadedFilament="[filament_type]" ; set the global filament name variable M98 P"0:/macros/filament/check-filament-type.g" M703 ; load config file for [filament_type] M568 P[current_extruder] R{"{heat.coldExtrudeTemperature+5}"} S[first_layer_temperature_0] ; (set standby and active temperatures for active tool. Standby is 5 degrees above cold extrude temp )
-
@owend Thank you very much!