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

On-device start gcode handling

Scheduled Pinned Locked Moved Solved
Gcode meta commands
3
6
165
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
    SanderLPFRG
    last edited by 30 Apr 2024, 12:48

    Hi all,

    I am trying to handle all of the pre-printing gcode checks as well as starting sequences on-device.

    To achieve this, I want to use the parameters sent with M98 which I set in the slicer.

    Currently I have;

    ;Prusaslicer section;
    ; Define prusaslicer variables
    {
    local xmin = (max(print_bed_min[0], first_layer_print_min[0] - 20));
    local xmax = (min(print_bed_max[0], first_layer_print_max[0] + 20));
    local ymin = (max(print_bed_min[1], first_layer_print_min[1] - 20));
    local ymax = (min(print_bed_max[1], first_layer_print_max[1] + 20));
    }
    ; called with M98 P"0:/macros/print-start"
    M98 P"0:/macros/print-start"A{first_layer_temperature[0]} B{first_layer_temperature[1]} C{first_layer_bed_temperature[0]} D{xmin[0]} E{xmax[0]} F{ymin[0]} H{ymax[0]} I{initial_tool} J"{is_extruder_used[0]}" K"{is_extruder_used[1]}" L"{filament_type[0]}" O"{filament_type[1]}" P{nozzle_diameter[0]} Q{nozzle_diameter[1]}

    And the duet macro will start with;

    ;Duet section
    ; Retrieve and define variables
    ; Temperature variables
    set var.lefttemp = param.A ; Extruder temperature
    set var.righttemp = param.B ; Extruder temperature
    set var.bed = param.C ; Bed temperature
    ; Print variables
    set var.printxmin = param.D ; Left boundry
    set var.printxmax = param.E ; Right boundry
    set var.printymin = param.F ; Front boundry
    set var.printymax = param.H ; Back boundry
    set var.purgelength = 15
    ; Machine variables
    set var.initialtool = param.I ; initial tool
    set var.leftused = param.J ; is right tool used yes/no
    set var.rightused = param.K ; is right tool used yes/no
    set var.leftfilament = param.L ; loaded filament type left
    set var.rightfilament = param.O ; loaded filament type right
    set var.leftnozzlesize = param.P ; nozzle diameter left
    set var.rightnozzlesize = param.Q ; nozzle diameter right

    After this I can use the variables to move and check the machine

    However, if I test the macro by sending;

    M98 P"0:/macros/variable-test-printstart" A215 B215 C0 D254.127 E333.118 F221.901 H278.099 I0 J"true" K"false" L"PLA" O"PLA" P0.4 Q0.4
    

    I get the error

    Error: in file variable-test-printstart line 34: in file macro line 0: unknown parameter 'P'

    While the P parameter is clearly defined in the code.

    Can anybody tell me why this is happening?

    Testing macro is;

    var lefttemp = 0
    var righttemp = 0
    var bed = 0
    var printxmin = 0
    var printxmax = 600
    var printymin = 0
    var printymax = 500
    var purgelength = 0
    var initialtool = 0
    var leftused = "false"
    var rightused = "false"
    var leftfilament = "none"
    var rightfilament = "none"
    var leftnozzlesize = 0
    var rightnozzlesize = 0
    ; Temperature variables
    set var.lefttemp = param.A ; Extruder temperature
    set var.righttemp = param.B ; Extruder temperature
    set var.bed = param.C ; Bed temperature
    ; Print variables
    set var.printxmin = param.D ; Left boundry
    set var.printxmax = param.E ; Right boundry
    set var.printymin = param.F ; Front boundry
    set var.printymax = param.H ; Back boundry
    set var.purgelength = 15
    ; Machine variables
    set var.initialtool = param.I ; initial tool
    set var.leftused = param.J ; is right tool used yes/no
    set var.rightused = param.K ; is right tool used yes/no
    set var.leftfilament = param.L ; loaded filament type left
    set var.rightfilament = param.O ; loaded filament type right
    set var.leftnozzlesize = param.P ; nozzle diameter left
    set var.rightnozzlesize = param.Q ; nozzle diameter right
    echo var.lefttemp
    echo var.righttemp
    echo var.bed
    echo var.printxmin
    echo var.printxmax
    echo var.printymin
    echo var.printymax
    echo var.purgelength
    echo var.initialtool
    echo var.leftused
    echo var.rightused
    echo var.leftfilament
    echo var.rightfilament
    echo var.leftnozzlesize
    echo var.rightnozzlesize
    undefined 1 Reply Last reply 30 Apr 2024, 13:06 Reply Quote 0
    • undefined
      jay_s_uk @SanderLPFRG
      last edited by 30 Apr 2024, 13:06

      @SanderLPFRG see here https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands#macro-parameters

      You cannot use P as a parameter (as P is already used to reference the gcode file that is being called by M98)
      When using a macro as custom gcode, do not use G, M, N, or T as parameters in a custom 'G' gcode file. Do not use G, M, or N as parameter in a custom 'M' gcode file. There are no standard G or M commands that use these parameters and RRF will treat the parameter as being the start of the next command.

      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 1 Reply Last reply 30 Apr 2024, 14:09 Reply Quote 1
      • undefined
        SanderLPFRG @jay_s_uk
        last edited by 30 Apr 2024, 14:09

        @jay_s_uk I have, but I do not see any issues. I have not used G, M, N, or T and I do not see a max specified

        what do you mean exactly?

        undefined undefined 2 Replies Last reply 30 Apr 2024, 14:10 Reply Quote 0
        • undefined
          jay_s_uk @SanderLPFRG
          last edited by 30 Apr 2024, 14:10

          @SanderLPFRG you can't use P and that'll probably be throwing the command out

          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 1 Reply Last reply 30 Apr 2024, 14:20 Reply Quote 1
          • undefined
            sebkritikel @SanderLPFRG
            last edited by 30 Apr 2024, 14:17

            @SanderLPFRG said in On-device start gcode handling:

            @jay_s_uk I have, but I do not see any issues. I have not used G, M, N, or T and I do not see a max specified

            what do you mean exactly?

            The section he quoted below regarding not using ā€˜P’

            bbf58827-a07d-4b28-b7bc-9e1a6b3edd54-image.jpeg

            Large(ish?) IDEX - 6HC, 1HCL
            Stratasys Dimension 1200es to 6HC Conversion

            1 Reply Last reply Reply Quote 0
            • undefined
              SanderLPFRG @jay_s_uk
              last edited by 30 Apr 2024, 14:20

              @jay_s_uk Wow I seriously have read over that 10 times I think. sorry for the unnessecary question
              Thanks all!

              1 Reply Last reply Reply Quote 3
              • undefined SanderLPFRG has marked this topic as solved 30 Apr 2024, 14:20
              3 out of 6
              • First post
                3/6
                Last post
              Unless otherwise noted, all forum content is licensed under CC-BY-SA