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

Global variables for filament temperatures

Scheduled Pinned Locked Moved
Gcode meta commands
5
14
779
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.
  • undefined
    flobler
    last edited by 16 Feb 2022, 10:57

    Hello everyone 🙂

    I am currently considering to use global variables for setting filament temperatures (both hotend and bed).

    Printer: Bear MK3
    Board: Duet 3 Mini 5+
    Firmware: RRF 3.3 (upgrading to 3.4 as soon as a stable release is out)

    The problem I am trying to solve is that I am currently updating filament temperature in a range of macros when I want to modify the temperature, e.g.:

    • filament loading/unloading
    • PA calibration
    • first layer height calibration
    • etc....

    So the idea is to put something like this at the end of config.g:

    global ABShotend=240 ; ABS hotend temperature
    global ABSbed=110 ; ABS bed temperature
    global GreenTecProhotend=230 ; GreenTec Pro hotend temperature
    global GreenTecProbed=60 ; GreenTec Pro bed temperature
    global PChotend=270 ; GreenTec Pro hotend temperature
    global PCbed=110 ; GreenTec Pro bed temperature
    global PETGhotend=235 ; PETG hotend temperature
    global PETGbed=80 ; PETG bed temperature
    global PLAhotend=210 ; PLA hotend temperature
    global PLAbed=60 ; PLA bed temperature
    global TPUhotend=230 ; TPU hotend temperature
    global TPUbed=60 ; TPU bed temperature

    Then reference these variables in every macro where needed. Now these values only need to be changed in config.g and I don't need to remember every macro I used the temperature in.

    Would this be a recommended way to handle these temperatures? Am I missing a more logical approach?

    Thanks!!

    undefined 1 Reply Last reply 16 Feb 2022, 11:10 Reply Quote 0
    • undefined
      flobler @flobler
      last edited by 16 Feb 2022, 11:10

      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?

      undefined 1 Reply Last reply 16 Feb 2022, 11:17 Reply Quote 0
      • undefined
        jay_s_uk @flobler
        last edited by 16 Feb 2022, 11:17

        @flobler expansion of M291 is planned to be part of 3.5

        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

        undefined undefined 2 Replies Last reply 16 Feb 2022, 11:21 Reply Quote 2
        • undefined
          flobler @jay_s_uk
          last edited by 16 Feb 2022, 11:21

          @jay_s_uk that is amazing news, thank you! Is there a place to follow what will be considered for this? 🙂

          undefined 1 Reply Last reply 16 Feb 2022, 11:22 Reply Quote 0
          • undefined
            gregsaun @jay_s_uk
            last edited by 16 Feb 2022, 11:22

            @jay_s_uk awesome thank you 🙂

            github.com/gregsaun - Papa Bear

            1 Reply Last reply Reply Quote 0
            • undefined
              jay_s_uk @flobler
              last edited by 16 Feb 2022, 11:22

              @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
              • undefined
                mikeabuilder
                last edited by 16 Feb 2022, 18:26

                @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
                undefined 1 Reply Last reply 16 Feb 2022, 23:56 Reply Quote 1
                • undefined Phaedrux moved this topic from Tuning and tweaking 16 Feb 2022, 21:48
                • undefined
                  flobler @mikeabuilder
                  last edited by flobler 16 Feb 2022, 23:56

                  @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
                  • undefined
                    mikeabuilder
                    last edited by 17 Feb 2022, 00:37

                    Yes, that is precisely what I'm doing.

                    1 Reply Last reply Reply Quote 0
                    • undefined
                      mikeabuilder
                      last edited by 17 Feb 2022, 00:47

                      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.

                      undefined 1 Reply Last reply 17 Feb 2022, 08:55 Reply Quote 0
                      • undefined
                        OwenD @mikeabuilder
                        last edited by 17 Feb 2022, 08:55

                        @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

                        undefined 1 Reply Last reply 17 Feb 2022, 09:50 Reply Quote 2
                        • undefined
                          flobler @OwenD
                          last edited by 17 Feb 2022, 09:50

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

                          undefined 1 Reply Last reply 17 Feb 2022, 10:37 Reply Quote 0
                          • undefined
                            OwenD @flobler
                            last edited by 17 Feb 2022, 10:37

                            @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 )
                            undefined 1 Reply Last reply 17 Feb 2022, 12:07 Reply Quote 1
                            • undefined
                              flobler @OwenD
                              last edited by 17 Feb 2022, 12:07

                              @owend Thank you very much!

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