; General preferences
M111 S0 ; Debugging off
G21 ; Work in millimetres
G90 ; Send absolute coordinates...
M83 ; ...but relative extruder moves
M555 P2 ; Set firmware compatibility to look like Marlin
M208 X-7 Y0 Z0 S1 ; Set axis minima
M208 X252 Y153 Z155 S0 ; Set axis maxima (reduced by offset above)
; Enable Panel Due Connector
M575 P1 S1 B57600 ; Enables connector and sets baud rate
; Endstops
M574 X1 S1 P"!xstop" ; X min active high endstop switch
M574 Y1 S1 P"!ystop" ; Y min active high endstop switch
;Manual Bed Leveling
M558 P9 C"^zprobe.in" H5 F500 T4000 X0 Y0 Z1 ; Set Z probe type/mode 9. H=Dive Height. F=Speed the bed moves
G31 P25 X-36 Y0 Z2.885 ; Z probe trigger value, offset in relation to nozzle. And trigger height adjustment
M557 X40:190 Y20:145 S20 ; Define mesh grid
;M671 x144:94:191 Y10:160:160 P0.5 ; Manual screw adjustment locations
; Drives
M569 P0 S1 ; Drive 0 goes backwards
M569 P1 S1 ; Drive 1 goes backwards
M569 P2 S0 ; Drive 2 goes forwards
M569 P3 S0 ; Drive 3 goes forwards
M569 P4 S1 ; Drive 4 goes backwards
M350 X16 Y16 Z16 E16 I1 ; Configure microstepping with interpolation
M92 X88.573186 Y88.573186 Z400 E96.27520187033366 ; Set steps per mm
M566 X900 Y900 Z300 E1200 ; Set maximum instantaneous speed changes (mm/min)
M203 X1080000 Y1080000 Z600 E96000 ; Set maximum speeds (mm/min)
M201 X1000 Y1000 Z100 E2000 ; Set accelerations (mm/s^2)
M906 X800 Y800 Z400 E800 I30 ; Set motor currents (mA) and motor idle factor in per cent
M84 S30 ; Set idle timeout
M584 X0 Y1 Z2 E3:4 ; Set drive assignments
; Heaters
M140 H0
M143 S260 ; Set maximum heater temperature to 260C
M308 S0 P"bed_temp" Y"thermistor" T100000 B3974 C0 R4700 ; Set thermistor + ADC parameters for heater 0
M308 S1 P"e0_temp" Y"thermistor" T100000 B4725 C7.060000e-8 R4700 ; Set thermistor + ADC parameters for heater 1
M308 S2 P"e1_temp" Y"thermistor" T100000 B4725 C7.060000e-8 R4700 ; Set thermistor + ADC parameters for heater 2
M950 H0 C"bed_heat" T0 ; heater 0 uses the bed_heat pin, sensor 0
M950 H1 C"e0_heat" T1 ; heater 1 uses the e0_heat pin and sensor 1
M950 H2 C"e1_heat" T2 ; heater 2 uses the e1_heat pin and sensor 2
M307 H0 A103.7 C787.7 D1.0 S1.00 B0
;M307 H0 A38.5 C41.1 D1.4 V24.4 B0 ; Set PID values for Heatedbed - derived from autotune
M307 H1 A250.2 C139.5 D5.4 V24.4 B0 ; Set PID values for Extruder 1 - derived from autotune
M307 H2 A387.6 C209.9 D5.9 V24.4 B0 ; Set PID values for Extruder 2 - derived from autotune
M307 H3 A-1 C-1 D-1 ; Disable the 4th Heater to free up PWM channel on the Duex board.
; Tools
M563 P0 D0 H1 ; 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 0C
M563 P1 D1 H2 ; Define tool 1
G10 P1 X34 Y0 Z0 ; Set tool 1 axis offsets
G10 P1 R0 S0 ; Set initial tool 1 active and standby temperatures to 0C
M207 S1.2 F1200 ; Set 1.2mm retract distance for G10 command
; Network
M550 P"Rep2X-EnStein" ; Set machine name
M552 S1 ; Enable network
M586 P0 S1 ; Enable HTTP
M586 P1 S1 ; Enable FTP
M586 P2 S0 ; Disable Telnet
; Fans
M950 F0 C"fan0" Q500 ; Set fan 0 value, PWM signal inversion and frequency.
M950 F1 C"fan2" Q500 ; Set fan 1 value, PWM signal inversion and frequency.
M106 P0 T40:50 H1 ; Set fan 0. Thermostatic control is turned on
M106 P1 T40:50 H2 ; Set fan 1. Thermostatic control is turned on
M950 S0 C"exp.heater3" ; Define BLTouch probe
M564 H0 ; Allow Movement while axes are NOT homed