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

    Time estimates from PrusaSlicer

    Scheduled Pinned Locked Moved Solved
    Tuning and tweaking
    5
    22
    2.7k
    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.
    • oliofundefined
      oliof @Exerqtor
      last edited by oliof

      @Exerqtor add T0 P0 to the start gcode of your files, or to the end of config.g to get rid of that error.

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

      Exerqtorundefined 1 Reply Last reply Reply Quote 0
      • Exerqtorundefined
        Exerqtor @oliof
        last edited by

        @oliof Yeah i found the "issue" i have the first extruder set via a global variable in my start macro, but it that apparently don't work in simulations.

        1 Reply Last reply Reply Quote 1
        • Phaedruxundefined
          Phaedrux Moderator
          last edited by

          So the time estimate from the slicer matches fairly close to the actual simulated time, but the actual print time is much longer?

          At this point I'd say share all your system files and macros so we can take a close look at what is happening.

          Z-Bot CoreXY Build | Thingiverse Profile

          Exerqtorundefined 1 Reply Last reply Reply Quote 0
          • Exerqtorundefined
            Exerqtor @Phaedrux
            last edited by

            @Phaedrux

            That's what i saw too, i was surprised the simulation being that close to the estimate ngl.

            Well this is going to be a longass post with all the system files, but here we go:

            config.g:

            ; Configuration file for Duet 3 Mini 5+ with Duet 3 Expansion Mini 2+ and 1LC (firmware version 3.4.x)
            ; executed by the firmware on start-up
            
            ; For E3D Revo Micro ----------------------------------------------------------
            
            ; ====================---------------------------------------------------------
            ; Basic setup
            ; ====================
            
            ; General preferences
            M575 P1 S1 B57600                                                              ; enable support for PanelDue
            ;M111 S0                                                                       ; debugging off
            G21                                                                            ; work in millimetres
            G90                                                                            ; send absolute coordinates...
            M83                                                                            ; set extruder to relative mode
            M550 P"Voron Trident"                                                          ; set printer name
            G4 S2                                                                          ; wait a moment for the CAN expansion boards to start
            
            ; Kinematics
            M669 K1	X-1:-1:0 Y1:-1:0 Z0:0:1                                                ; select CoreXY mode and set kinematics matrix
            
            ; Network
            M552 S1                                                                        ; enable network
            G4 S1                                                                          ; wait a second
            M586 P0 S1                                                                     ; enable HTTP (for DWC)
            M586 P1 S1                                                                     ; enable FTP (for remote backups)
            M586 P2 S0                                                                     ; disable Telnet
            
            ; ====================---------------------------------------------------------
            ; Driver config
            ; ====================
            
            ; Drives for Z
            M569 P0.2 S0                                                                   ; Z1 (physical drive 2) goes backwards
            M569 P0.3 S0                                                                   ; Z2 (physical drive 3) goes backwards
            M569 P0.4 S0                                                                   ; Z3 (physical drive 4) goes backwards
            
            ; --- Z drive map ---
            ;    -------
            ;   |  0.2  |
            ;   |-------|
            ;   |0.3|0.4|
            ;    ---+---
            ;     front
            
            ; Drives for XY
            M569 P0.0 S0                                                                   ; X (physical drive 0) goes backwards
            M569 P0.1 S0                                                                   ; Y (physical drive 1) goes backwards
            
            ; Drive for extruder
            M569 P121.0 S0                                                                 ; E (physical drive 121.0) goes backwards
            
            ; Motor mapping and steps per mm
            M584 X0.0 Y0.1 Z0.2:0.3:0.4 E121.0                                             ; set drive mapping
            M350 X16 Y16 Z16:16 E16 I1                                                     ; configure microstepping with interpolation
            M92 X80.00 Y80.00 Z800.00                                                      ; set XYZ steps per mm (1.8deg motors)
            M92 E568.83                                                                    ; set Extruder steps per mm (Bondtech LGX Lite 562 stock)
            
            ; Drive currents
            M906 X1750 Y1750 Z1170 E550                                                    ; set XYZ motor currents (mA)
            M906 I30                                                                       ; set ide current percentage
            M84 S30                                                                        ; Set idle timeout
            
            ; ====================---------------------------------------------------------
            ; Movement
            ; ====================
            
            ; Axis Limits
            M208 X-2,5 Y0 Z0 S1                                                            ; set axis minima
            M208 X348 Y359 Z300 S0                                                         ; set axis maxima
            
            ; Endstops
            M574 X2 S1 P"io1.in"                                                           ; configure switch-type (e.g. microswitch) endstop for high end on X via pin io1.in
            M574 Y2 S1 P"io2.in"                                                           ; configure switch-type (e.g. microswitch) endstop for high end on Y via pin io2.in
            M574 Z0 P"nil"                                                                 ; no endstop
            
            ; Z-probe (klicky probe)
            M558 K0 P8 C"^121.io2.in" H2 R0.2 F600:180 T18000 A5 S0.01                     ; set Z probe type to switch and the dive height + speeds
            G31 K0 P500 X0 Y18 Z7.50                                                       ; set Z probe trigger value, offset and trigger height (higher Z value = nozzle closer to bed)
            
            ; Z microswitch (mechanical Z pin)
            M558 K1 P8 C"io3.in" H1 R0 F600:180 T18000 A10 S0.005                          ; set Z probe type to switch and the dive height + speeds
            G31 K1 P500 X0 Y0 Z0.0                                                         ; set Z probe trigger value, offset and trigger height (higher Z value = nozzle closer to bed)
            
            ; Bed leveling
            M671 X175:388:-38 Y416.6:1.5:1.5 S10                                           ; leadscrew locations (Rear, Right, Left)
            M557 X25:315 Y25:325 P6                                                        ; define default mesh grid ( positions include the Z offset!)
            
            ; Accelerometer
            M955 P121.0 I05                                                                ; configure accelerometer
            M593 P"zvd" F49.3                                                              ; use ZVD input shaping to cancel ringing at 49.3Hz
            
            ; ====================---------------------------------------------------------
            ;  Heaters
            ; ====================
            
            ; Bed heater
            ;M307 H0 R1.223 K0.599:0.000 D7.69 E1.35 S1.00 B0
            ;M307 H0 B0 R0.750 C228.2 D3.40 S1.00 V0                                        ; Bed heater tuned for 85�C with 230v 750w heater
            ;M308 S0 P"temp0" Y"thermistor" T104400 B4138 A"Bed"                            ; configure sensor 0 as thermistor on pin temp0
            M308 S0 P"temp0" Y"thermistor" T100000 B3950 A"Bed"                            ; configure sensor 0 as thermistor on pin temp0
            M950 H0 C"out0" T0 Q5                                                          ; create bed heater output on out0, map it to sensor 0 and set PWM frequency(Hz)
            M307 H0 B0 S1.00                                                               ; disable bang-bang mode for the bed heater and set PWM limit
            M140 H0                                                                        ; map heated bed to heater 0
            M143 H0 S110                                                                   ; set temperature limit for heater 0 to 110�C
            M143 H0 A2 C0 S110                                                             ; make sure bed heater stays below 110�C
            M143 H0 A1 C0 S125                                                             ; make sure bed heater shuts down at 125�C
            
            ; Hodend heater
            M308 S1 P"121.temp0" Y"thermistor" T100000 B4725 C7.060000e-8 A"Hotend"        ; configure sensor 1 as thermistor on pin 121.temp0
            M950 H1 C"121.out0" T1                                                         ; create nozzle heater output on 121.out0 and map it to sensor 1
            M307 H1 B0 S1.00                                                               ; disable bang-bang mode for heater  and set PWM limit
            M143 H1 S300                                                                   ; set temperature limit for heater 1 to 300�C
            
            ; Chamber heater
            M308 S4 P"121.temp1" Y"thermistor" T9600 B3950 A"Chamber"                      ; configure sensor 4 as thermistor on pin e1temp
            ;M950 H2 C"out1" T4                                                            ; create a heater, but not actually anything connected to this output
            ;M141 H2                                                                       ; map heated chamber to heater 2
            ;M143 H2 S100                                                                  ; set temperature limit for heater 2 to 100�C
            ;M141 S35                                                                      ; set chamber to 35�C (to avoid heater faults)
            
            M308 S2 Y"mcu-temp" A"MCU"                                                     ; configure sensor 2 as MCU temperature
            M912 P0 S-2.9                                                                  ; MCU temp calibration parameters
            M308 S3 Y"drivers" A"DRIVERS"                                                  ; configure sensor 3 as drivers temperature
            
            ; ====================---------------------------------------------------------
            ;  Fans
            ; ====================
            
            ;Part cooling
            M950 F0 C"121.out1" Q500                                                       ; create fan 0 on pin 121.out1 and set its frequency
            M106 P0 S0 H-1 C"Part Cooling"                                                 ; set fan 0 value. Thermostatic control is turned off
            ;Hotend fan
            M950 F1 C"121.out2" Q500                                                       ; create fan 1 on pin 121.out2 and set its frequency
            M106 P1 S1 H1 T45 C"Hotend Fan"                                                ; hotend fan @ 100%, turns on if temperature sensor 1 reaches 45�C
            ;Electronics fan
            M950 F2 C"out5" Q500                                                           ; create fan 2 on pin out3 and set its frequency
            M106 P2 L0.15 H2:3 T45:50 C"Electronics Fans"                                  ; electronics fans start @ 30% when temperature sensor 2 reaches 45�C or sensor 3 (drivers report over temp)
            ;M106 P2 H2:3 L0.15 X1 B0.3 T40:70                                             ; set fan 2 value, electronics cooling, starts to turn on when the MCU temperature(H2) reaches 45�C and reaches full speed when the MCU temperature reaches 70�C or if any TMC2660 drivers(H3) report that they are over-temperature.
            ;Exhaust fan
            M950 F3 C"out6" Q500                                                           ; create fan 3 on pin out4 and set its frequency
            ;M106 P3 S1 H2 T75 Q500 C"Exhaust fan"                                         ; Exhaust fan @ 100%, turns on if temperature sensor 1 reaches 75�C
            M106 P3 H-1 Q500 C"Exhaust fan"                                                ; Exhaust fan 3 value. Thermostatic control is turned off
            ; Tools
            M563 P0 S"Revo Micro" D0 H1 F0                                                 ; define tool 0
            G10 P0 X0 Y0 Z0                                                                ; set tool 0 axis offsets
            G10 P0 R0 S0                                                                   ; set initial tool 0 active and standby temperatures to 0�C
            
            ; ====================---------------------------------------------------------
            ;  Other
            ; ====================
            
            ; Filament monitoring
            ;M591 D0 P1 C"e0stop" S0                                                       ; filament monitor for extruder0, simple sensor (high signal when filament present), connected to e0stop and it's disabled
            
            ; Miscellaneous
            M950 P0 C"out2"	                                                               ; create output Port0 attached to out2 connector for LED lights 
            M911 S10 R11 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000"                             ; set voltage thresholds and actions to run on power loss
            M572 D0 S0.0                                                                   ; Disable Pressure Advance
            M98 P"/sys/lib/init.g"                                                         ; iniate external configs
            M501                                                                           ; load config-override.g
            T0                                                                             ; select tool 0
            

            init.g:

            ; /sys/lib/init.g
            ; Called in the end of config.g
            ; Used to setup more stuff during the boot process
            
            M98 P"/sys/lib/globals.g"                                                      ; setup global variables
            M98 P"/sys/lib/speed/speed_printing.g"                                         ; set normal speed & accel
            M98 P"/sys/lib/current/xy_current_high.g"                                      ; set normal xy currents
            M98 P"/sys/lib/current/z_current_high.g"                                       ; set normal z currents
            M98 P"/sys/lib/fw_retraction.g"                                                ; set firmware retraction settings
            M98 P"/sys/lib/klicky/klicky_status.g"                                         ; refresh klicky status
            
            Exerqtorundefined 1 Reply Last reply Reply Quote 0
            • Exerqtorundefined
              Exerqtor @Exerqtor
              last edited by

              globals.g:

              ; /sys/lib/globals.g
              ; Called by init.g
              ; Used to initialize global variables
              
              ; Global declarations and defaults values
              
              ; ====================---------------------------------------------------------
              ; Temperature
              ; ====================
              
              if !exists(global.bed_temp)
                global bed_temp = 0
              
              if !exists(global.hotend_temp)
                global hotend_temp = 0
              
              if !exists(global.chamber_temp)
                global chamber_temp = 0
              
              ; ====================---------------------------------------------------------
              ; Stepper currents
              ; ====================
              
              if !exists(global.xy_current)
                global xy_current = move.axes[0].current
              
              if !exists(global.z_current)
                global z_current = move.axes[2].current
              
              if !exists(global.e_current)
                global e_current = move.extruders[0].current
              
              ; ====================---------------------------------------------------------
              ; Mechanical Z pin
              ; ====================
              
              if !exists(global.z_pin_x)
                global z_pin_x = 194
              
              if !exists(global.z_pin_y)
                global z_pin_y = 355.5
              
              ; ====================---------------------------------------------------------
              ; Klicky probe
              ; ====================
              
              ; Setup the klicky status
              if !exists(global.klicky_status)
                global klicky_status = "none"
              
              ; The distance from the body of the klicky probe to it's own trigger point
              if !exists(global.klicky_offset)
                global klicky_offset = -1.49  ; a larger values makes the nozzle closer to the bed after running Z calibration
              
              ; The Z distance from nozzle to bed surface
              if !exists(global.klicky_clearance)
                global klicky_clearance = 20 ; going lower than 8 will make the probe scary-close to the bed in most setups!
              
              
              ; Dock settings:
              
              ; The absolute X location of the klicky while docked
              if !exists(global.klicky_dock_x)
                global klicky_dock_x = 19.4
              
              ; The absolute Y location of the klickywhile docked
              if !exists(global.klicky_dock_y)
                global klicky_dock_y = 356.4
              
              ; The relative disance and direction of the klicky docking move	
              if !exists(global.klicky_wipe)
                global klicky_wipe = 35  ; -30 for a left wipe 30 for a right wipe
              
              ; ====================---------------------------------------------------------
              ; Bed
              ; ====================
              
              ; Define the bed size on x-axis(print area from 0 to max)
              if !exists(global.bed_x)
                global bed_x = 350
                
              ; Define the bed size on y-axis(print area from 0 to max)
              if !exists(global.bed_y)
                global bed_y = 350
              
              ; If the bed has been leveled or not
              if !exists(global.bed_leveled)
                global bed_leveled = false
              
              ; ====================---------------------------------------------------------
              ; Print area
              ; ====================
              
              ; Setup the variables for min/max print area
              if !exists(global.paMinX)
                global paMinX = "N/A"
                
              if !exists(global.paMaxX)
                global paMaxX = "N/A"
              
              if !exists(global.paMinY)
                global paMinY = "N/A"
              
              if !exists(global.paMaxY)
                global paMaxY = "N/A"
              
              ; ====================---------------------------------------------------------
              ; MISC
              ; ====================
              
              if !exists(global.RunDaemon)
                global RunDaemon = true
              
              if !exists(global.initial_extruder)
                global initial_extruder = 0
              
              if !exists(global.first_layer_height)
                global first_layer_height = "none"
              
              ; The length needed to clear the meltzone of the extruder (as speced by E3D for the Revo)
              if !exists(global.unload_length)
                global unload_length = 18
              
              if !exists(global.job_completion)
                global job_completion = 0
              
              if !exists(global.debug_mode)
                global debug_mode = true
              
              if !exists(global.chamber_leds)
                global chamber_leds   = "off"
              
              if !exists(global.sb_leds)
                global sb_leds        = "boot"
              
              if !exists(global.Z_cal)
                global Z_cal          = false
              
              if !exists(global.Print_Probe)
                global Print_Probe = false
              
              if !exists(global.Adaptive_Probing)
                global Adaptive_Probing = false
                
              if !exists(global.Adaptive_Purge)
                global Adaptive_Purge = true
              
              ; ====================---------------------------------------------------------
              ; Output current values
              ; ====================
              
              echo "Klicky probe is: " , global.klicky_status
              

              speed_printing.g:

              ; /sys/lib/speed/speed_printing.g
              ; called to set speed and accelerations settings for printing
              
              ; Axis accelerations and speeds
              M566 X700.00 Y700.00 Z30.00 P1                                                 ; set maximum instantaneous speed changes (mm/min) and jerk policy
              M203 X18000.00 Y18000.00 Z900.00                                               ; set maximum speeds (mm/min)
              M201 X2000.00 Y2000.00 Z150.00                                                 ; set accelerations (mm/s²)
              
              ; Extruder accelerations and speeds
              M566 E8000.00 P1                                                               ; set maximum instantaneous speed changes (mm/min) and jerk policy
              M203 E15000.00                                                                 ; set maximum speeds (mm/min)
              M201 E1800.0                                                                   ; set accelerations (mm/s²)
              
              ; Printing and travel accelerations
              M204 P1500 T2000                                                               ; Set printing acceleration and travel accelerations (mm/s²)
              

              xy_current_high.g:

              ; /sys/lib/current/xy_current_high.g
              ; Called when printing
              ; Used to set X Y motor currents for printing
              
              M913 X100 Y100                                                                 ; Set X Y motors to 100% of their max current
              set global.xy_current = move.axes[0].current
              

              z_current_high.g:

              ; /sys/lib/current/z_current_high.g
              ; Called when printing
              ; Used to set Z motor currents for printing
              
              M913 Z100                                                                      ; Set Z motors to 100% of their max current
              set global.z_current = move.axes[2].current
              

              fw_retraction.g & klickly_status.g aren't worth sharing since i've got filament specific retraction settings etc. and the status update is just what it sounds like.

              But here is my filament config for ABS:

              ; filaments/ABS/config.g  (v2.1)
              ; called when M703 is sent and ABS is loaded
              
              ; ====================---------------------------------------------------------
              ; Settings section
              ; ====================
              
              ; Filament settings
              
              var FilamentType        = "ABS"       ; Input the filament type (only for the message)
              
              var Default             = false        ; Use default settings (retraction and PA), true/yes or false/no
              
              var PA                  = 0.025        ; Pressure advance amount (s)
              var RLen                = 0.400        ; Retraction length (mm)
              var X_URLen             = 0.010        ; Extra unretract length (mm)
              var RSpd                = 4200         ; Retraction speed (mm/min)
              var URSpd               = 4200         ; Unretract speed (mm/min)
              var Z_Lift              = 0.200        ; Zlift amount (mm)
              
              ; Message placeholders
              var Message1 = "N/A"
              var Message2 = "N/A"
              
              ; ====================---------------------------------------------------------
              ; Config section
              ; ====================
              
              if !var.Default
                ; Pressure Advance
                M572 D0 S{var.PA}                                                            ; Set extruder 0 pressure advance to 0.1 seconds
              
                ;Retraction & Zlift
                M207 S{var.RLen} R{var.X_URLen} F{var.RSpd} T{var.URSpd} Z{var.Z_Lift}       ; Set firmware retraction length, extra un-retract lenght, retract speed, unretract speed & zlift
              
                ; Travel & acceleration
                ;M204 P800 T3000                                                             ; Set printing and travel accelerations (mm/s²) 
              
                ;Cancel Ringing (Ghosting)
                ;M593 P"none" F50                                                            ; Cancel ringing at 50Hz
              
              ; ====================---------------------------------------------------------
              ; Define & send messages
              ; ====================
              
              if var.Default
                set var.Message1 = "" ^ var.FilamentType ^ " config applied (default settings)"
              else
                set var.Message1 = "" ^ var.FilamentType ^ " config applied"
                
              if move.extruders[0].pressureAdvance = 0
                set var.Message2 = "Pressure Advance disabled"
              else
                set var.Message2 = "Pressure Advance set to " ^ move.extruders[0].pressureAdvance ^ " seconds"
              
              ; Config applied message
              M118 P0 S{var.Message1}                                                        ; Send message to DWC
              M118 P2 S{var.Message1}                                                        ; Send message to PanelDue
              
              ; Pressure advance info message
              M118 P0 S{var.Message2}                                                        ; Send message to DWC
              M118 P2 S{var.Message2}                                                        ; Send message to PanelDue
              
              Exerqtorundefined 1 Reply Last reply Reply Quote 0
              • Exerqtorundefined
                Exerqtor @Exerqtor
                last edited by

                This is what my custom start gcode on PS looks like:

                ; Start G-code: START
                ; Inform of first layer height
                set global.first_layer_height = {first_layer_height}
                ; Define print area
                set global.paMinX = {first_layer_print_min[0]}
                set global.paMaxX = {first_layer_print_max[0]}
                set global.paMinY = {first_layer_print_min[1]}
                set global.paMaxY = {first_layer_print_max[1]}
                ; Set temps & the initial extruder
                set global.bed_temp = [first_layer_bed_temperature]
                set global.hotend_temp = {first_layer_temperature[initial_extruder]}
                set global.initial_extruder = [initial_extruder]
                M83                                                                            ; use relative distances for extrusion
                M98 P"/sys/lib/print/print_start.g"                                            ; run print start routine
                ; Start G-code: END
                

                print_start.g:

                ; /sys/lib/print/print_start.g
                ; Called when starting a print
                ; Used to configure print parameters
                
                ; For E3D Revo Micro
                
                ;LED status
                set global.sb_leds = "heating"
                
                
                set global.job_completion = 0
                
                G21                                                                            ; set units to millimeters
                G90                                                                            ; use absolute coordinates
                M83                                                                            ; use relative distances for extrusion
                M220 S100                                                                      ; reset speed multiplier
                M140 S{global.bed_temp}                                                        ; set bed temperature
                ;M141 S{global.chamber_temp}                                                   ; set chamber temperature
                G10 P{global.initial_extruder} R{global.hotend_temp} S{global.hotend_temp}     ; set active and standby temps for the initial tool
                M116                                                                           ; wait for bed and hotend to reach there temperatures
                M42 P0 S0.3                                                                    ; Turn on chamber lights to 30%
                M98 P"/sys/lib/print/print_level_bed.g"                                        ; level the bed while everything is hot
                G29 S1                                                                         ; load & turn on bed height map
                M376 H5                                                                        ; set bed compensation taper to 5mm
                T{global.initial_extruder}                                                     ; select initial tool
                M98 P"/sys/lib/nozzle_scrub.g"                                                 ; clean the nozzle
                G1 X{global.z_pin_x} Y{global.z_pin_y - 60} F6000                              ; Move out on the printbed
                G0 Z{(global.first_layer_height + 5)} F3000                                    ; Drop bed to first layer height + 5mm to reduce pucker factor
                M98 P"/sys/lib/print/print_purge.g"                                            ; purge the nozzle before starting print
                M400                                                                           ; wait for moves to finish
                
                ;LED status
                set global.sb_leds = "printing"
                

                print_level_bed.g:

                ; /sys/lib/print/print_level_bed.g
                ; Called as part of print_start.g	
                ; Used to make sure the bed is leveled
                
                ; ====================
                ; homing check
                ; ====================
                
                  ; Lower currents, speed & accel
                  M98 P"/sys/lib/current/xy_current_low.g"                                       ; Set low XY currents
                  M98 P"/sys/lib/current/z_current_low.g"                                        ; Set low Z currents
                  M98 P"/sys/lib/speed/speed_probing.g"                                          ; Set low speed & accel
                
                ; Make sure all axes are Homed
                if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed           ; If axes aren't homed
                  ; Home all axis
                  G91                                                                            ; Relative positioning
                
                  ; Lower Z relative to current position if needed
                  if !move.axes[2].homed                                                         ; If Z ain't homed
                    G1 Z20 F9000 H1                                                              ; Lower Z(bed) relative to current position	
                  elif move.axes[2].userPosition < 10                                            ; If Z is homed and less than 10
                    G1 Z20 F9000                                                                 ; Move to Z 10
                
                  ; Coarse home X or Y
                  G1 X600 Y600 F2400 H1                                                          ; Move quickly to X or Y endstop(first pass)
                
                  ; Coarse home X
                  G1 X600 H1                                                                     ; Move quickly to X endstop(first pass)
                
                  ; Coarse home Y
                  G1 Y600 H1                                                                     ; Move quickly to Y endstop(first pass)
                
                  ; Move away from the endstops
                  G1 X-5 Y-5 F9000                                                               ; Go back a few mm
                
                  ; Fine home X
                  G1 X600 F360 H1                                                                ; Move slowly to X axis endstop(second pass)
                
                  ; Fine home Y
                  G1 Y600 H1                                                                     ; move slowly to Y axis endstop(second pass)
                
                  ; Absolute positioning
                  G90                                                                            ; Absolute positioning
                
                  ; Home Z
                  ; Load the probe
                  M401 P0                                                                        ; Load the klicky probe
                  M400                                                                           ; Wait for moves to finish
                  M98 P"/sys/lib/klicky/klicky_status.g"                                         ; Refresh klicky status
                
                  ; Last check to ensure klicky is attached
                  if global.klicky_status = "attached"
                    echo "Probe ATTACHED"
                  else
                    echo "Error probe not attached - aborting"
                    M291 T5 R"Z Homing Aborted!" P"Z haven't been homed - check probe" 
                    abort
                
                  ; Move to bed center and home Z
                  M98 P"/sys/lib/goto/bed_center.g"                                              ; Move to bed center
                  M98 P"/sys/lib/speed/speed_probing.g"                                          ; Set low speed & accel
                  G30 K0 Z-99999                                                                 ; Probe the center of the bed
                else
                  ; Home Z
                  ; Load the probe
                  M401 P0                                                                        ; Load the klicky probe
                  M400                                                                           ; Wait for moves to finish
                  M98 P"/sys/lib/klicky/klicky_status.g"                                         ; Refresh klicky status
                
                  ; Last check to ensure klicky is attached
                  if global.klicky_status = "attached"
                    echo "Probe ATTACHED"
                  else
                    echo "Error probe not attached - aborting"
                    M291 T5 R"Z Homing Aborted!" P"Z haven't been homed - check probe" 
                    abort
                
                  ; Move to bed center and home Z
                  M98 P"/sys/lib/goto/bed_center.g"                                              ; Move to bed center
                  M98 P"/sys/lib/speed/speed_probing.g"                                          ; Set low speed & accel
                  G30 K0 Z-99999                                                                 ; Probe the center of the bed
                
                ; ====================
                ; check if bed is leveled
                ; ====================
                
                ; If the bed isn't leveled
                if global.bed_leveled = false
                
                  ;LED status
                  set global.sb_leds = "leveling"
                
                  ; ====================
                  ; prepare to probe
                  ; ====================
                
                  ; report whats going on
                  M291 R"Bed leveling" P"Please wait..." T0                                    ; leveling bed message
                
                  M561                                                                         ; clear any bed transform
                  M290 R0 S0                                                                   ; reset baby stepping
                  M84 E0                                                                       ; disable extruder stepper
                
                  ; ====================
                  ; probing code
                  ; ====================
                
                  ; Coarse leveling pass  
                  M558 K0 H15 F600 A1                                                          ; increase the depth range, gets the bed mostly level immediately
                  M98 P"/sys/bed_probe_points.g"                                               ; probe the bed
                
                  ; Probe the bed
                  while true
                    ; --- probe near lead screws -
                    M558 K0 H3 F240:120 A30                                                    ; reduce depth range, probe slower for better repeatability 
                    M98 P"/sys/bed_probe_points.g"                                             ; probe the bed
                
                    ; check results - exit loop if results are good
                    if move.calibration.initial.deviation < 0.02                               ; if probing result is less than 0.02mm
                      break                                                                    ; stop probing 
                
                    ; check pass limit - abort if pass limit reached
                    if iterations = 5                                                          ; if probed more than 5 times
                      M291 P"Bed Leveling Aborted" R"Pass Limit Reached"                       ; abort probing, something wrong
                      set global.bed_leveled = false                                           ; set global state
                      abort "Bed Leveling Aborted - Pass Limit Reached"                        ; abort probing, something wrong
                
                  ; ====================
                  ; finish up
                  ; ====================
                
                  ; Home Z
                  ; Move to bed center and home Z
                  M98 P"/sys/lib/goto/bed_center.g"                                              ; Move to bed center
                  M98 P"/sys/lib/speed/speed_probing.g"                                          ; Set low speed & accel
                  G30 K0 Z-99999                                                                 ; Probe the center of the bed
                
                  ; Dock the probe
                  M402 P0                                                                        ; Dock the klicky probe
                  M400                                                                           ; Wait for moves to finish
                
                  set global.bed_leveled = true                                                ; set global state
                
                  ;echo "global.bed_leveled. Value : " , global.bed_leveled
                  M291 R"Bed leveling" P"Done" T5                                              ; bed leveling done message
                
                else
                  ; ====================
                  ; response if leveled
                  ; ====================
                
                  ; Dock the probe
                  M402 P0                                                                        ; Dock the klicky probe
                  M400                                                                           ; Wait for moves to finish
                  M98 P"/sys/lib/klicky/klicky_status.g"                                         ; Refresh klicky status
                
                  ; Bed already leveled, no need to probe  
                  M291 S1 R"Bed leveling" P"Bed allready leveled" T1
                
                  M561                                                                         ; clear any bed transform
                  M290 R0 S0                                                                   ; reset baby stepping
                
                ;LED status
                set global.sb_leds = "ready"
                
                Exerqtorundefined 1 Reply Last reply Reply Quote 0
                • Exerqtorundefined
                  Exerqtor @Exerqtor
                  last edited by

                  nozzle_scrub.g:

                  ; /sys/lib/nozzle_scrub.g  (v2.5)
                  ; Called when "M98 P"/sys/lib/nozzle_scrub.g" is sent
                  ; Used to clean and (alternatively) purge the nozzle
                  
                  ;--------------------------------------------------------------------------------------------------------------------------------------
                  
                  ; Sample macro config to be used in conjunction with a Purge Bucket & Nozzle Scrubber combo and RepRapFirmware 3.4.x
                  
                  ; The goal of this macro is to provide a nozzle scrubbing and purging routine that is easily copied/referenced into your  printer.
                  ; Users can simply change parameters and enable/disable options in the first half. Descriptions are plentiful, making this macro
                  ; look huge but informative and are laid out in sequence to be read first describing the line below; PLEASE READ CAREFULLY.
                  
                  ; This sample config assumes the following: The user has implemented a purge bucket & nozzle scrubber to their printer
                  ; It can be tweaked for customized purge bucket geometries and brushes.
                  
                  ; Features in this macro: purge routine that can be enabled/disabled.
                  ; By default, bucket is located at rear right of bed and purge routine is enabled. The purge and scrubbing routine is randomized
                  ; in either left or right bucket to ensure as even as possible distribution of filament gunk.
                  
                  ; Default parameters are set for safe speeds and movements. Where necessary, tweak the parameters for the nozzle scrub procedure
                  ; to fit your printer.
                  
                  ;--------------------------------------------------------------------------------------------------------------------------------------
                  
                  ; If you want the purging routine in your bucket enabled, set to true (and false vice versa).
                  var enable_purge        = false
                  
                  ; These parameters define your filament purging. The retract variable is used to retract right after purging to prevent unnecessary
                  ; oozing. Some filament are particularly oozy and may continue to ooze out of the nozzle for a second or two after retracting. The
                  ; ooze dwell variable makes allowance for this. Update as necessary. If you decided to not enable purge, you can ignore this section.
                  
                  var purge_len           = 10         ; Amount of filament, in mm, to purge.
                  var purge_spd           = 150        ; Speed, in mm/min, of the purge.
                  var purge_temp_min      = {global.hotend_temp - 5}        ; Minimum nozzle temperature to permit a purge. Otherwise, purge will not occur.
                  var purge_ret           = 2          ; Retract length, in mm, after purging to prevent slight oozing. Adjust as necessary.
                  var ooze_dwell          = 2          ; Dwell/wait time, in seconds, after purging and retracting.
                  
                  ; Adjust this so that your nozzle scrubs within the brush. Currently defaulted to be a lot higher for safety. Be careful not to go too low!
                  var brush_top           = 1
                  
                  ; These parameters define your scrubbing, travel speeds, safe z clearance and how many times you want to wipe. Update as necessary. Wipe
                  ; direction is randomized based off whether the left or right bucket is randomly selected in the purge & scrubbing routine.
                  
                  var clearance_z         = 5          ; When traveling, but not cleaning, the clearance along the z-axis between nozzle and brush.
                  var wipe_qty            = 3          ; Number of complete (A complete wipe: left, right, left OR right, left, right) wipes.
                  var prep_spd_xy         = 3000       ; Travel (not cleaning) speed along x and y-axis in mm/min.
                  var prep_spd_z          = 1500       ; Travel (not cleaning) speed along z axis in mm/min.
                  var wipe_spd_xy         = 5000       ; Nozzle wipe speed in mm/min.
                  
                  ; These parameters define the size of the brush. Update as necessary. A visual reference is provided below. Note that orientation of
                  ; parameters remain the same whether bucket is at rear or front.
                  
                  ;                  ?   brush_width   ?
                  ;                   _________________
                  ;                  |                 |  ?
                  ;  brush_start (x) |                 | brush_depth
                  ;                  |_________________|  ?
                  ;                          (y)
                  ;                      brush_front
                  ;__________________________________________________________
                  ;                     PRINTER FRONT
                  
                  ; Input where your brush assembly start is on the x axis
                  var brush_start         = 237
                  
                  ; This value is for the brush width (with brush holder), change it if your brush setup width is different.
                  var brush_width         = 50
                  
                  ; Specify the location in y axis for your brush - see diagram above.
                  var brush_front         = 353
                  var brush_depth         = 8
                  
                  ; These parameters define the size of your purge bucket. Update as necessary. If you decided to not enable purge, you can ignore
                  ; this section. A visual reference is provided below. Note that orientation of parameters remain the same whether bucket is at rear
                  ; or front.
                  
                  ;                                     bucket_gap
                  ;                                      ? ---- ?
                  ;                     __________________________________________
                  ;                    |                 |      |                 |
                  ;                    |                 |      |                 |
                  ;  bucket_start (x)  |                 |______|                 |
                  ;                    |                 |      |                 |
                  ;                    |                 |      |                 |
                  ;                    |_________________|. . . |_________________|
                  ;                     ? ------------- ?        ? ------------- ?
                  ;                     bucket_left_width        bucket_right_width
                  ;_______________________________________________________________________________________
                  ;                                    PRINTER FRONT
                  
                  ; Input your left bucket width
                  var bucket_left_width   = 23.5
                  
                  ; Input your gap width
                  var bucket_gap          = 25
                  
                  ; Input your left bucket width
                  var bucket_right_width  = 35.5
                  
                  ; Input where your bucket start is on the x axis
                  var bucket_start        = 219
                  
                  ;--------------------------------------------------------------------------------------------------------------------------------------
                  
                  ; From here on, unless you know what you're doing, it's recommended not to change anything. Feel free to peruse the code if you stumble apon it
                  ; and reach out to me on Discord (Exerqtor#3178) or the duet forum (Exerqtor) if you spot any problems, or have any sugestions for improvements!
                  
                  ; Shout-out to "fcwilt" on the duet forum for helping me with ironing out bugs and streamlining the macro! <3
                  
                  ;--------------------------------------------------------------------------------------------------------------------------------------
                  
                  ; Placeholder. The variable wil later be set to contain the overhang for the brush assembly in the buckets
                  var brush_oh            = 0
                  
                  ; Brush overhang calculation:
                  set var.brush_oh = {(var.brush_width - var.bucket_gap) / 2} 
                  
                  ; Placeholder. The variable will later be set to contain, at random, a number representing the left(0) or right(1) side
                  var pos                 = 1
                  
                  ; Randomly select left or right side
                  set var.pos = random(2)
                  
                  ; Check if the axes are homed - if not homed just abort - it exits this routine and none of the rest of the code is executed
                  if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
                    M291 R"Axes not homed" P"Please home all axes first!" T0
                    abort "nozzle_scrub.g aborted - axes were not homed"
                  
                  ;LED status
                  set global.sb_leds = "cleaning"
                  
                  ; Report what's going on
                  M291 S1 R"Cleaning nozzle" P"Please wait..." T5
                  
                  ; Set to absolute positioning.
                  G90
                  
                  ; ====================---------------------------------------------------------
                  ; purging code
                  ; ====================
                  
                  ; Check if user enabled purge option or not.
                  if var.enable_purge
                  
                    ; If hotend needs to be loaded, to it now (at 2x purge_spd).
                    if exists(global.unload_length)
                      if global.unload_length > 0
                        G1 E{global.unload_length + 0.5} F{var.purge_spd * 2}
                        echo "Hotend loaded"
                  
                    ; Purge if the temp is up to min temp. If not, it will skip and continue executing rest of macro.
                    if heat.heaters[1].current > var.purge_temp_min
                        echo "Purging"
                  
                      ; Raise Z for travel.
                      G1 Z{var.brush_top + var.clearance_z} F{var.prep_spd_z}
                  
                      ; Move towards brush.
                      G1 Y{var.brush_front + (var.brush_depth / 2)} F{var.prep_spd_xy}
                  
                      ; Position for purge. Randomly selects middle of left or right bucket. It references from the middle of the left bucket (while compensating for any brush overhang).
                      if var.pos = 0 
                        ; Left bucket selected
                  
                        G1 X{var.bucket_start + ((var.bucket_left_width - var.brush_oh) / 2)}
                      else
                        ; Right bucket selected
                        G1 X{(var.bucket_start + var.bucket_left_width) + (var.bucket_gap + var.brush_oh) + ((var.bucket_right_width - var.brush_oh) / 2)}
                  
                      ; Perform purge with a small retract after purging to minimize any persistent oozing at (retract 5x purge_spd).
                      M83                                                                        ; relative mode
                      G1 E{var.purge_len} F{var.purge_spd}
                      G1 E{0 - var.purge_ret} F{var.purge_spd * 5}
                      G4 S{var.ooze_dwell}
                      G92 E0                                                                     ; reset extruder
                  
                    else
                      echo "To cold to purge"
                  
                  ; ====================---------------------------------------------------------
                  ; wiping code
                  ; ====================
                  
                  ; Placeholders
                  var pos1                = 0
                  var pos2                = 0
                  
                  ; Position for wipe. Either left or right of brush based on var.pos to avoid unnecessary travel after purging
                  if var.pos = 0
                    set var.pos1 = var.brush_start
                    set var.pos2 = var.brush_start + var.brush_width
                  else
                    set var.pos1 = var.brush_start + var.brush_width
                    set var.pos2 = var.brush_start
                  
                  G1 Z{var.brush_top + var.clearance_z} F{var.prep_spd_z}
                  
                  G1 X{var.pos1} F{var.prep_spd_xy}
                  
                  ; Move in to the brush.
                  G1 Y{var.brush_front + (var.brush_depth / 2)}
                  
                  ; Move nozzle down into brush.
                  G1 Z{var.brush_top} F{var.prep_spd_z}
                  
                  ; Perform wipe. Wipe direction based off pos for cool random scrubby routine.
                  while true
                    G1 X{var.pos2} F{var.wipe_spd_xy}
                    G1 X{var.pos1}
                  
                    if iterations = var.wipe_qty + 1
                      break
                  
                  ; ====================---------------------------------------------------------
                  ; finish up
                  ; ====================
                  
                  ; Clear from area.
                  G1 Z{var.brush_top + var.clearance_z} F{var.prep_spd_z}
                  
                  G1 X{var.bucket_start + ((var.bucket_left_width - var.brush_oh) / 2)} F{var.prep_spd_xy}
                  
                  M400                                                                           ; Wait for moves to finish
                  
                  M118 S"Nozzle cleaned!"
                  
                  ;LED status
                  set global.sb_leds = "ready"
                  

                  print_purge.g:

                  ; /sys/lib/print/print_purge.g  (v1.2)
                  ; Called when "M98 P"/sys/lib/print/print_purge.g" is sent
                  ; Used to purge the nozzle close to the actual print area
                  
                  ;--------------------------------------------------------------------------------------------------------------------------------------
                  
                  ;  Adaptive Purging with VoronDesign Logo for RepRapFirmware 3.4.x
                  
                  ; This macro will parse information from objects in your gcode to define a min and max area, creating a nearby purge with Voron flair!
                  ; For successful purging, you may need to configure:
                  
                  ; Declare global.unload_length, and define what length it's needed to be.
                  ; Declare global.Adpative_Purge,and set it true
                  ; Declared globals for X/Y min/max, and have these to defined in your slicer.
                  
                  ;--------------------------------------------------------------------------------------------------------------------------------------
                  
                  ; ====================---------------------------------------------------------
                  ; Variable declarations & defaults
                  ; ====================
                  
                  ; To enable adaptive purging "global.Adaptive_Purging" must be declared and true.
                  
                  var z_height              = 0.4                            ; Height above the bed to purge
                  var prime_dist            = {global.unload_length + 1}     ; Distance between filament tip and nozzle tip before purge (this might require some tuning)
                  var purge_amount          = 20                             ; Amount of filament to purge
                  var flow_rate             = 10                             ; Desired flow rate in mm3/s
                  var x_default             = 10                             ; X location to purge, overwritten if adaptive is True
                  var y_default             = 10                             ; Y location to purge, overwritten if adaptive is True
                  var size                  = 10                             ; Size of the logo in mm
                  var distance_to_object_x  = 15                             ; Distance in x to the print area
                  var distance_to_object_y  = 0                              ; Distance in y to the print area
                  var travel_speed          = 300                            ; Travel speed
                  
                  ; Placeholders:
                  var x_origin = "N/A"
                  var y_origin = "N/A"
                  var consoleMessage = "N/A"
                  
                  ; ====================---------------------------------------------------------
                  ; Purge location calculation
                  ; ====================
                  
                  if global.Adaptive_Purge
                    set var.x_origin = {global.paMinX - var.distance_to_object_x - var.size}
                    set var.y_origin = {global.paMinY - var.distance_to_object_y - var.size}
                  else
                    set var.x_origin = var.x_default
                    set var.y_origin = var.y_default
                  
                  var prepurge_speed = (var.flow_rate / 2.405)
                  var purge_move_speed = {2.31 * var.size * var.flow_rate / (var.purge_amount * 2.405)}
                  
                  ; Info messages
                  set var.consoleMessage = "X: " ^ var.x_origin ^ "; Y: " ^ var.y_origin ^ "; Purge move speed: " ^ var.purge_move_speed ^ "; Prepurge speed: " ^ var.prepurge_speed  ; Set the console message
                  
                  M118 P2 S{var.consoleMessage}  ; send used probe grid to paneldue
                  M118 P3 S{var.consoleMessage}  ; send used probe grid to DWC console
                  
                  ; ====================---------------------------------------------------------
                  ; Purging code
                  ; ====================
                  
                  ; LED status
                  set global.sb_leds = "pink"
                  
                  G92 E0
                  G0 F{var.travel_speed * 60}                                                                                            ; Set travel speed
                  G90                                                                                                                    ; Absolute positioning
                  G0 X{var.x_origin} Y{var.y_origin + var.size / 2}                                                                      ; Move to purge position
                  G0 Z{var.z_height}                                                                                                     ; Move to purge Z height
                  M83                                                                                                                    ; Relative extrusion mode
                  G1 E{var.prime_dist} F{var.prepurge_speed * 60}                                                                        ; Move tip of filament to nozzle
                  G1 X{var.x_origin + var.size * 0.289} Y{var.y_origin + var.size} E{var.purge_amount / 4} F{var.purge_move_speed * 60}  ; Purge first line of logo
                  G1 E-.5 F2100                                                                                                          ; Retract
                  G0 Z{var.z_height * 2}                                                                                                 ; Z hop
                  G0 X{var.x_origin + var.size * 0.789} Y{var.y_origin + var.size}                                                       ; Move to second purge line origin
                  G0 Z{var.z_height}                                                                                                     ; Move to purge Z height
                  G1 E.5 F2100                                                                                                           ; Recover
                  G1 X{var.x_origin + var.size * 0.211} Y{var.y_origin} E{var.purge_amount / 2} F{var.purge_move_speed * 60}             ; Purge second line of logo
                  G1 E-.5 F2100                                                                                                          ; Retract
                  G0 Z{var.z_height * 2}                                                                                                 ; Z hop
                  G0 X{var.x_origin + var.size * 0.711} Y{var.y_origin}                                                                  ; Move to third purge line origin
                  G0 Z{var.z_height}                                                                                                     ; Move to purge Z height
                  G1 E.5 F2100                                                                                                           ; Recover
                  G1 X{var.x_origin + var.size} Y{var.y_origin + var.size / 2}  E{var.purge_amount / 4} F{var.purge_move_speed * 60}     ; Purge third line of logo
                  G1 E-.5 F2100                                                                                                          ; Retract
                  G92 E0                                                                                                                 ; Reset extruder distance
                  G0 Z{var.z_height * 2}                                                                                                 ; Z hop
                  
                  ; LED status
                  set global.sb_leds = "ready"
                  

                  Good luck sifting thru all that, had to split it up in several posts lol.

                  But like i said, i checked the object modell during last print, and all the values seemed correct 😕

                  1 Reply Last reply Reply Quote 0
                  • Phaedruxundefined
                    Phaedrux Moderator
                    last edited by

                    It'll take me some time to go through that.

                    Do you happen to use input shaping? Pressure advance?

                    Z-Bot CoreXY Build | Thingiverse Profile

                    Exerqtorundefined 1 Reply Last reply Reply Quote 0
                    • Exerqtorundefined
                      Exerqtor @Phaedrux
                      last edited by

                      @Phaedrux said in Time estimates from PrusaSlicer:

                      It'll take me some time to go through that.

                      Do you happen to use input shaping? Pressure advance?

                      It's alot 🤢
                      Yeah input shaping gets defined in config.g M593 P"zvd" F49.3

                      Pressure advance get set in filament config.g M572 D0 S0.025.

                      Exerqtorundefined 1 Reply Last reply Reply Quote 1
                      • Exerqtorundefined
                        Exerqtor @Exerqtor
                        last edited by Exerqtor

                        Just simulated AND printed another file, estimated 1h7m, simulated 1h32m, printed 1h31m (with preheated bed and hotend).

                        I'm lost...

                        Another one:
                        Estimated 0h21m, simulated 0h26m, printed 0h31m.

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

                          @Exerqtor did you see my earlier post? User n8bot has made modifications to PS to make the estimates more accurate for RRF. Part of this is a facility to fetch the maximum speeds and accelerations from RRF. https://github.com/n8bot/PrusaSlicer/releases

                          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

                          Exerqtorundefined 1 Reply Last reply Reply Quote 0
                          • Exerqtorundefined
                            Exerqtor @dc42
                            last edited by

                            @dc42

                            Yeah i did 😅 :

                            @dc42 said in Time estimates from PrusaSlicer:

                            @Exerqtor try the PrusaSlicer fork from n8bot. It can fetch the Duet machine parameters to compute more accurate estimates.

                            He's fork haven't been updated in ages either (even older than SuperSlicer), so not to keen on jumping on an even more buggy build lol. But i saw the pull request on the master branch he made and commented on it yesterday so maybe something happes.

                            1 Reply Last reply Reply Quote 0
                            • Phaedruxundefined
                              Phaedrux Moderator
                              last edited by

                              Can you send the speed, accel, jerk, etc commands while a print is in progress to see if the values are what you'd expect them to be?

                              Z-Bot CoreXY Build | Thingiverse Profile

                              Exerqtorundefined 1 Reply Last reply Reply Quote 0
                              • Exerqtorundefined
                                Exerqtor @Phaedrux
                                last edited by Exerqtor

                                @Phaedrux said in Time estimates from PrusaSlicer:

                                Can you send the speed, accel, jerk, etc commands while a print is in progress to see if the values are what you'd expect them to be?

                                Sorry for the slow reply, but covid paid a visit so i haven't had the energy to deal with this lol.

                                But i just managed to check the numbers during print, and apparently the printing accelerations are at 500 for some reason.

                                alt text

                                So i need to track down what the f**k sends that M204 P500.

                                EDIT:

                                I found the issue, when redoing print_level_bed.g i had forgot to turn up both speeds AND currents and the end.

                                Fixed print_level_bed.g:

                                ; /sys/lib/print/print_level_bed.g  v2.1
                                ; Called as part of print_start.g	
                                ; Used to make sure the bed is leveled
                                
                                ; ====================---------------------------------------------------------
                                ; Homing check
                                ; ====================
                                
                                ; Lower currents, speed & accel
                                M98 P"/sys/lib/current/xy_current_low.g"                                       ; Set low XY currents
                                M98 P"/sys/lib/current/z_current_low.g"                                        ; Set low Z currents
                                M98 P"/sys/lib/speed/speed_probing.g"                                          ; Set low speed & accel
                                
                                ; LED status
                                set global.sb_leds = "homing"
                                
                                ; Make sure all axes are Homed
                                if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed           ; If axes aren't homed
                                  ; Home all axis
                                  G91                                                                          ; Relative positioning
                                
                                  ; Lower Z relative to current position if needed
                                  if !move.axes[2].homed                                                       ; If Z ain't homed
                                    G1 Z20 F9000 H1                                                            ; Lower Z(bed) relative to current position	
                                  elif move.axes[2].userPosition < 10                                          ; If Z is homed and less than 10
                                    G1 Z20 F9000                                                               ; Move to Z 10
                                
                                  ; Coarse home X or Y
                                  G1 X600 Y600 F2400 H1                                                        ; Move quickly to X or Y endstop(first pass)
                                
                                  ; Coarse home X
                                  G1 X600 H1                                                                   ; Move quickly to X endstop(first pass)
                                
                                  ; Coarse home Y
                                  G1 Y600 H1                                                                   ; Move quickly to Y endstop(first pass)
                                
                                  ; Move away from the endstops
                                  G1 X-5 Y-5 F9000                                                             ; Go back a few mm
                                
                                  ; Fine home X
                                  G1 X600 F360 H1                                                              ; Move slowly to X axis endstop(second pass)
                                
                                  ; Fine home Y
                                  G1 Y600 H1                                                                   ; move slowly to Y axis endstop(second pass)
                                
                                  ; Absolute positioning
                                  G90                                                                          ; Absolute positioning
                                
                                ; Home Z
                                ; Load the probe
                                M401 P0                                                                        ; Load the klicky probe
                                M400                                                                           ; Wait for moves to finish
                                M98 P"/sys/lib/klicky/klicky_status.g"                                         ; Refresh klicky status
                                
                                ; Last check to ensure klicky is attached
                                if global.klicky_status = "Attached"
                                  echo "Probe ATTACHED"
                                else
                                  echo "Error probe not attached - aborting"
                                  M291 T5 R"Z Homing Aborted!" P"Z haven't been homed - check probe" 
                                  abort
                                
                                ; Move to bed center and home Z
                                M98 P"/sys/lib/goto/bed_center.g"                                              ; Move to bed center
                                M98 P"/sys/lib/speed/speed_probing.g"                                          ; Set low speed & accel
                                G30 K0 Z-99999                                                                 ; Probe the center of the bed
                                
                                ; ====================---------------------------------------------------------
                                ; Check if bed is leveled
                                ; ====================
                                
                                ; If the bed isn't leveled
                                if global.bed_leveled = false
                                
                                  ; LED status
                                  set global.sb_leds = "leveling"
                                
                                 ; ====================---------------------------------------------------------
                                  ; Prepare to probe
                                  ; ====================
                                
                                  ; Report whats going on
                                  M291 R"Bed leveling" P"Please wait..." T0                                    ; Leveling bed message
                                
                                  M561                                                                         ; Clear any bed transform
                                  M290 R0 S0                                                                   ; Reset baby stepping
                                  M84 E0                                                                       ; Disable extruder stepper
                                
                                  ; ====================---------------------------------------------------------
                                  ; Probing code
                                  ; ====================
                                
                                  ; Coarse leveling pass  
                                  M558 K0 H15 F600 A1                                                          ; Increase the depth range, gets the bed mostly level immediately
                                  M98 P"/sys/bed_probe_points.g"                                               ; Probe the bed
                                
                                  ; Probe the bed
                                  while true
                                    ; Probe near lead screws
                                    M558 K0 H3 F240:120 A30                                                    ; Reduce depth range, probe slower for better repeatability 
                                    M98 P"/sys/bed_probe_points.g"                                             ; Probe the bed
                                
                                    ; Check results - exit loop if results are good
                                    if move.calibration.initial.deviation < 0.02                               ; If probing result is less than 0.02mm
                                      break                                                                    ; Stop probing 
                                
                                    ; Check pass limit - abort if pass limit reached
                                    if iterations = 5                                                          ; If probed more than 5 times
                                      M291 P"Bed Leveling Aborted" R"Pass Limit Reached"                       ; Abort probing, something wrong
                                      set global.bed_leveled = false                                           ; Set global state
                                      abort "Bed Leveling Aborted - Pass Limit Reached"                        ; Abort probing, something wrong
                                
                                  ; ====================---------------------------------------------------------
                                  ; Finish up
                                  ; ====================
                                
                                  ; Home Z
                                  ; Move to bed center and home Z
                                  M98 P"/sys/lib/goto/bed_center.g"                                            ; Move to bed center
                                  M98 P"/sys/lib/speed/speed_probing.g"                                        ; Set low speed & accel
                                  G30 K0 Z-99999                                                               ; Probe the center of the bed
                                
                                  ; Dock the probe
                                  M402 P0                                                                      ; Dock the klicky probe
                                  M400                                                                         ; Wait for moves to finish
                                
                                  set global.bed_leveled = true                                                ; set global state
                                
                                  ;echo "global.bed_leveled. Value : " , global.bed_leveled
                                  M291 R"Bed leveling" P"Done" T5                                              ; bed leveling done message
                                
                                else
                                  ; ====================---------------------------------------------------------
                                  ; Response if leveled
                                  ; ====================
                                
                                  ; Dock the probe
                                  M402 P0                                                                      ; Dock the klicky probe
                                  M400                                                                         ; Wait for moves to finish
                                  M98 P"/sys/lib/klicky/klicky_status.g"                                       ; Refresh klicky status
                                
                                  ; Full currents, speed & accel
                                  M98 P"/sys/lib/current/z_current_high.g"                                     ; Restore normal Z currents
                                  M98 P"/sys/lib/current/xy_current_high.g"                                    ; Set high XY currents
                                  M98 P"/sys/lib/speed/speed_printing.g"                                       ; Restore normal speed & accels
                                
                                
                                  ; Bed already leveled, no need to probe  
                                  M291 S1 R"Bed leveling" P"Bed allready leveled" T1
                                
                                  M561                                                                         ; Clear any bed transform
                                  M290 R0 S0                                                                   ; Reset baby stepping
                                
                                ; LED status
                                set global.sb_leds = "ready"
                                
                                1 Reply Last reply Reply Quote 2
                                • Exerqtorundefined Exerqtor marked this topic as a question
                                • Exerqtorundefined Exerqtor has marked this topic as solved
                                • First post
                                  Last post
                                Unless otherwise noted, all forum content is licensed under CC-BY-SA