Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Global variables for filament temperatures

    Scheduled Pinned Locked Moved
    Gcode meta commands
    5
    14
    780
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gregsaunundefined
      gregsaun @jay_s_uk
      last edited by

      @jay_s_uk awesome thank you 🙂

      github.com/gregsaun - Papa Bear

      1 Reply Last reply Reply Quote 0
      • jay_s_ukundefined
        jay_s_uk @flobler
        last edited by

        @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

        Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

        1 Reply Last reply Reply Quote 1
        • mikeabuilderundefined
          mikeabuilder
          last edited by

          @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
          
          floblerundefined 1 Reply Last reply Reply Quote 1
          • Phaedruxundefined Phaedrux moved this topic from Tuning and tweaking
          • floblerundefined
            flobler @mikeabuilder
            last edited by flobler

            @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.

            1 Reply Last reply Reply Quote 0
            • mikeabuilderundefined
              mikeabuilder
              last edited by

              Yes, that is precisely what I'm doing.

              1 Reply Last reply Reply Quote 0
              • mikeabuilderundefined
                mikeabuilder
                last edited by

                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.

                OwenDundefined 1 Reply Last reply Reply Quote 0
                • OwenDundefined
                  OwenD @mikeabuilder
                  last edited by

                  @mikeabuilder @flobler
                  You can access the loaded filament using move.extruders['nnn'].filament

                  I 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

                  floblerundefined 1 Reply Last reply Reply Quote 2
                  • floblerundefined
                    flobler @OwenD
                    last edited by

                    @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!

                    OwenDundefined 1 Reply Last reply Reply Quote 0
                    • OwenDundefined
                      OwenD @flobler
                      last edited by

                      @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 RRF

                      set 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 )
                      
                      floblerundefined 1 Reply Last reply Reply Quote 1
                      • floblerundefined
                        flobler @OwenD
                        last edited by

                        @owend Thank you very much!

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Unless otherwise noted, all forum content is licensed under CC-BY-SA