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

    M98 directory

    Scheduled Pinned Locked Moved
    Firmware wishlist
    5
    12
    655
    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.
    • DonStaufferundefined
      DonStauffer
      last edited by

      Would it be difficult to add a feature to M98 where beginning a macro filespec with "./":

      M98 P"./foo" ...
      

      would run macro foo in the same directory as the macro containing the M98 (if it's being done in a macro)? I know there's no such thing as the "current directory", but does a macro "know where it came from"?

      This would really clean up some of my macros and make them readable.

      In a perfect world, one could extend that path as in:

      M98 P"./bar/foo" ...
      

      but even just allowing "./filename" would be wonderful for groups of macros to call one another without something like

      M98 P"0:/macros/In/Deeply/Nested/Folders/Make/Long/Lines/To/DoSomething"
      

      Obviously that leaves open the question of what beginning a filespec with "./" would mean when not running a macro from a macro, but that could be stripped out, just be meaningless or illegal, or some logical thing I haven't thought of. Whatever it does now would probably be fine.

      T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
      • T3P3Tonyundefined T3P3Tony moved this topic from Tuning and tweaking
      • T3P3Tonyundefined
        T3P3Tony administrators @DonStauffer
        last edited by

        @DonStauffer I have moved this to the firmware wishlist for further discussion.

        I can see how it would be useful but not sure how much more memory ti would use to keep track of where the macros were from, especially in a set of nested macros.

        www.duet3d.com

        DonStaufferundefined 2 Replies Last reply Reply Quote 0
        • DonStaufferundefined
          DonStauffer @T3P3Tony
          last edited by

          @T3P3Tony I can understand if the path of the currently running macro isn't already stored it would take a byte for every character plus a little overhead to save it. That could be substantial on a Duet2 especially. But if it's already there, I think very little memory would be needed.

          Presumably, a pointer to the string containing the filespec for a nested macro call gets passed to a function to begin reading the file. I'm imagining in the calling scope that string wouldn't get freed until the nested call returns, though it's certainly possible it's freed sooner. But if it's not freed until after return, and there's a pointer to it, storing that pointer would only take a few bytes.

          1 Reply Last reply Reply Quote 0
          • oliofundefined
            oliof
            last edited by

            it would be a couple bytes per nested call, and since this feature would most likely be used by people doing more complex macros, it would be more memory than just a few bytes sooner rather than later...

            <>RatRig V-Minion Fly Super5Pro RRF<> V-Core 3.1 IDEX k*****r <> RatRig V-Minion SKR 2 Marlin<>

            DonStaufferundefined 1 Reply Last reply Reply Quote -1
            • DonStaufferundefined
              DonStauffer @T3P3Tony
              last edited by DonStauffer

              @T3P3Tony For the heck of it, I looked at the code on GitHub. Hard to get a handle on it looking at it briefly, so I may be way off base, but a question:

              Does the GCodeBuffer object for the M98 continue to live until the macro is fully done executing? It seems like it would, and it's the GetString method that returns the filename (which seems to actually be a filespec), so that makes me hopeful.

              I'm curious if I'm anywhere in the right vicinity.

              PS: I love C++!

              T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
              • DonStaufferundefined
                DonStauffer @oliof
                last edited by DonStauffer

                @oliof Yes, that's true. Still, I wonder if a pointer may already be stored indirectly, in the form of a pointer to an object which can return the pointer. Maybe. IDK, I could be way off base, but if a pointer is already sitting there ...

                dc42undefined 1 Reply Last reply Reply Quote 0
                • T3P3Tonyundefined
                  T3P3Tony administrators @DonStauffer
                  last edited by

                  @DonStauffer that's a question for @dc42 or @chrishamm .

                  www.duet3d.com

                  1 Reply Last reply Reply Quote 0
                  • dc42undefined
                    dc42 administrators @DonStauffer
                    last edited by

                    @DonStauffer RRF has no concept of a current directory. For every command that takes a filename argument there is a default directory that is used if the specified filename does not include an a absolute path.

                    Currently, RRF does not remember the names of macro files currently executing. I am planning to add this (except on Duet 2 because of memory constraints) in order that error messages can include the filename. So in principle we could have M98 accept a relative path when M98 is invoked from another macro file. However, there is another issue with using "./" as a prefix for this, which is that using that prefix is the same as not using it. That is the convention for path names and I am fairly sure is how the FatFs filesystem used by RRF behaves. I would not want to deviate from that behaviour.

                    Duet WiFi hardware designer and firmware engineer
                    Please do not ask me for Duet support via PM or email, use the forum
                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                    DonStaufferundefined 1 Reply Last reply Reply Quote 0
                    • DonStaufferundefined
                      DonStauffer @dc42
                      last edited by DonStauffer

                      @dc42 The ability to change that default directory might be just as good.

                      Unfortunately my Railcore has a Duet2 (with Duex & PanelDue). I've thought about replacing it with a Duet3 but I don't have time to evaluate form factor and connections to be sure I could just drop it in my Railcore.

                      oliofundefined 1 Reply Last reply Reply Quote 0
                      • oliofundefined
                        oliof @DonStauffer
                        last edited by

                        @DonStauffer two Duet 3 mini would be drop in replacements for Duet2 and Duex foot print wise, running one of the minis as CAN expansion board. Whether that has all the IO you need depends on your machine specifics.

                        <>RatRig V-Minion Fly Super5Pro RRF<> V-Core 3.1 IDEX k*****r <> RatRig V-Minion SKR 2 Marlin<>

                        DonStaufferundefined 1 Reply Last reply Reply Quote 0
                        • DonStaufferundefined
                          DonStauffer @oliof
                          last edited by DonStauffer

                          @oliof This is up to date for my dual-extruder Railcore, except that since then I've been playing with the LED output and the I2C output, and I have in mind adding a thermistor to measure ambient temperature:

                          Ports are listed in order from left to right and top to bottom.
                          Duet 2 WiFi

                          Power (Middle Right)
                          USB (Middle Left)

                          Stepper Motors (Top Right)
                          Drive 4 E1 MOTOR Secondary extruder
                          Drive 3 E0 MOTOR Primary extruder
                          Drive 0 X MOTOR Back XY stepper
                          Drive 1 Y MOTOR Front XY stepper
                          Drive 2 Z MOTOR (unused)
                          End Stops (Middle)
                          E1 STOP e1stop filament sensor
                          E0 STOP e0stop filament sensor
                          X STOP xstop Build area Left Rear
                          Y STOP ystop On carriage
                          Z STOP (unused)
                          Heaters (Top Left, Bottom Right)
                          E1 HEATER e1heat Secondary hot end
                          E0 HEATER e0heat Primary hot end
                          HEATED BED bedheat Bed heater MOSFET control

                          Thermistors (Middle Left, Bottom Right)
                          THERMISTOR2 E1 e1temp Secondary Hot End
                          THERMISTOR1 E0 e0temp Primary Hot End
                          THERMISTOR0 BED bedtemp Bed
                          Fans (Middle Right)
                          PWM:
                          FAN2 (unused)
                          FAN1 fan1 Secondary Part Fan
                          FAN0 fan0 Primary Part Fan
                          Always On:
                          Secondary Heat Sink Fan
                          Primary Heat Sink Fan
                          Z Probe (Bottom Left)
                          Z PROBE zprobe.in BLTouch

                          Duex

                          Power (Middle Right)
                          Stepper Motors (Bottom)
                          Drive 9 E6 MOTOR (unused)
                          Drive 8 E5 MOTOR (unused)
                          Drive 7 E4 MOTOR Right Z stepper
                          Drive 6 E3 MOTOR Back Left Z stepper
                          Drive 5 E2 MOTOR Front Left Z stepper
                          Servos (Lower Left)
                          PWM5 E6_PWM (unused)
                          PWM4 E5_PWM (unused)
                          PWM3 E4_PWM (unused)
                          PWM2 E3_PWM duex.pwm2 LED lights (white, not NeoPixels)
                          PWM1 E2_PWM duex.pwm1 BLTouch
                          End Stops (Upper Center)
                          E6 STOP E1 STOP (unused)
                          E5 STOP E0 STOP (unused)
                          E4 STOP X STOP (unused)
                          E3 STOP Y STOP (unused)
                          E2 STOP Z STOP (unused)
                          Heaters (Upper Right)
                          E2 HEATER (unused)
                          E3 HEATER LED lights wiring
                          E4 HEATER (unused)
                          E5 HEATER (unused)
                          E6 HEATER (unused)
                          Thermistors (Middle)
                          E4 THERMISTOR5 (unused)
                          E3 THERMISTOR4 (unused)
                          E2 THERMISTOR3 (unused)
                          E6 THERMISTOR7 (unused)
                          E5 THERMISTOR6 (unused)
                          Fans (Upper Left)
                          FAN8 (unused)
                          FAN7 (unused)
                          FAN6 (unused)
                          FAN5 (unused)
                          FAN4 duex.fan4 (unused)
                          FAN3 duex.fan3 Case fan

                          droftartsundefined 1 Reply Last reply Reply Quote 0
                          • droftartsundefined
                            droftarts administrators @DonStauffer
                            last edited by

                            @DonStauffer I think there's enough drivers and I/O on a Duet 3 Mini 5+ with Duet 3 expansion Mini 2+ (to give 7 motor drivers) to drive your setup.

                            Ian

                            Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

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