# Smoothieboard configuration file, see http://smoothieware.org/configuring-smoothie
# NOTE Lines must not exceed 132 characters, and '#' characters mean what follows is ignored
## Robot module configurations : general handling of movement G-codes and slicing into moves

grbl_mode               false
new_status_format       true
save_g92                true
#on_boot_gcode_enable    true
#on_boot_gcode           /sd/reset-g92-1.g

# Basic motion configuration
default_feed_rate                            200              # Default speed (mm/minute) for G1/G2/G3 moves
default_seek_rate                            1000             # Default speed (mm/minute) for G0 moves
mm_per_arc_segment                           0.0              # Fixed length for line segments that divide arcs, 0 to disable
mm_per_line_segment                          1                # Cut lines into segments this size usefull for make pause faster and for pcb compensation
mm_max_arc_error                             0.01             # The maximum error for line segments that divide arcs 0 to disable


# Planner module configuration : Look-ahead and acceleration configuration
# See http://smoothieware.org/motion-control
acceleration                                 1000              # Acceleration in mm/second/second.
z_acceleration                               200              # Acceleration for Z only moves in mm/s^2, 0 uses default.
junction_deviation                           0.005            # See http://smoothieware.org/motion-control#junction-deviation
#z_junction_deviation                         0.0              # For Z only moves, -1 uses junction_deviation, zero disables on z


# Cartesian axis speed limits
x_axis_max_speed                             7000             # Maximum speed in mm/min
y_axis_max_speed                             7000             # Maximum speed in mm/min
z_axis_max_speed                             500              # Maximum speed in mm/min

# Stepper module configuration
# Pins are defined as  ports, and pin numbers, appending "!" to the number will invert a pin
#�See http://smoothieware.org/pin-configuration and http://smoothieware.org/pinout
alpha_steps_per_mm                           800              # Steps per mm for alpha ( X ) stepper
alpha_step_pin                               2.0o             # Pin for alpha stepper step signal
alpha_dir_pin                                0.5o             # Pin for alpha stepper direction, add '!' to reverse direction
alpha_en_pin                                 0.4!o            # Pin for alpha enable pin
alpha_current                                2.7              # M1 stepper motor current
alpha_max_rate                               7000.0           # Maximum rate in mm/min

beta_steps_per_mm                            800              # Steps per mm for beta ( Y ) stepper
beta_step_pin                                2.1o             # Pin for beta stepper step signal
beta_dir_pin                                 0.11!o           # Pin for beta stepper direction, add '!' to reverse direction
beta_en_pin                                  0.10!o           # Pin for beta enable
beta_current                                 2.7              # M2 stepper motor current
beta_max_rate                                7000.0           # Maxmimum rate in mm/min

gamma_steps_per_mm                           800              # Steps per mm for gamma ( Z ) stepper
gamma_step_pin                               2.2o             # Pin for gamma stepper step signal
gamma_dir_pin                                0.20!o           # Pin for gamma stepper direction, add '!' to reverse direction
gamma_en_pin                                 0.19!o           # Pin for gamma enable
gamma_current                                2.7              # M3 stepper motor current
gamma_max_rate                               500.0            # Maximum rate in mm/min


## A axis is now E extruder set on the real 4th stepper smoothie 4xc so not have the built in 5th driver
#delta_steps_per_mm                           88.8888888888    # may be steps per degree for example
#delta_step_pin                               2.3o             # Pin for delta stepper step signal
#delta_dir_pin                                0.22!o           # Pin for delta stepper direction
#delta_en_pin                                 0.21!o           # Pin for delta enable
#delta_current                                2.7              # A stepper motor current
#delta_max_rate                               1500.0           # mm/min
#delta_acceleration                           500.0            # mm/s^2
#
## B axis is 4th axis
#epsilon_steps_per_mm                         200              # may be steps per degree for example
#epsilon_step_pin                             2.8o             # Pin for delta stepper step signal
#epsilon_dir_pin                              2.13!o           # Pin for delta stepper direction
#epsilon_en_pin                               4.29!o           # Pin for delta enable
#epsilon_current                              2.7              # A stepper motor current
#epsilon_max_rate                             1500.0           # mm/min
#epsilon_acceleration                         200.0            # mm/s^2

# Extruder config with stepcraft 3d head this use only step/dir for controle external stepper drive included in the HP-40/FDM1.75
extruder.hotend1.enable                       true     #Whether to activate the extruder module at all. All configuration is ignored if false.
extruder.hotend1.steps_per_mm                 200      #Steps/millimetre for the extruder stepper motor. This is the number of steps to move o
extruder.hotend1.filament_diameter            1.75     #Filament diameter, in millimetres, used for volumetric extrusion control. 
extruder.hotend1.default_feed_rate            400      #Default rate in millimetres/minute for moves where only the extruder moves.
extruder.hotend1.acceleration                 100      #Acceleration for the extruder stepper motor, in mm/s^2
extruder.hotend1.max_speed                    20       #Maximum allowable speed for the extruder stepper motor, in millimetres/second
extruder.hotend1.step_pin                     2.8      #Pin for extruder stepper motor driver's step signal
extruder.hotend1.dir_pin                      2.13     #Pin for extruder stepper motor driver's direction signal
extruder.hotend1.en_pin                       1.26o   #Pin for extruder controler motor driver's enable using x max endstop for connect a relay
#extruder.hotend1.en_pin                       4.29!    # !!! CETTE PIN BUG POUR ENA !!!  so use for other purpose but not here
# firmware retract settings when using G10/G11# firmware retract settings when using G10/G11
extruder.hotend1.retract_length               3        #Retract length in millimetres. Retract is a retractation of the filament called using
extruder.hotend1.retract_feedrate             60       #Retract feed-rate ( filament speed ) in millimetres/second
extruder.hotend1.retract_recover_length       0.2      #Additional length when recovering ( if you retract by 1mm, you will be recovering by 1
extruder.hotend1.retract_recover_feedrate     15       #Recovery feed-rate in millimetres/second (should be less than retract feedrate)
extruder.hotend1.retract_zlift_length         1        #Z-lift on retract in millimeters, set to 0 if you want to disable retraction Z-lift. Z
extruder.hotend1.retract_zlift_feedrate       400      #Z-lift feed-rate in millimetres/minute ( Note : mm/min NOT mm/sec)
epsilon_current                               1.4      #First extruder current


# 4th axis as Extruder config using B along Y axis
extruder.4thaxis.enable                       true     #Whether to activate the extruder module at all. All configuration is ignored if false.
extruder.4thaxis.steps_per_mm                 88.88888 #Steps/millimetre for 4th axis. This is the number of steps to move 1 degree
extruder.4thaxis.default_feed_rate            600      #Default rate in millimetres/minute for moves where only the motor moves
extruder.4thaxis.acceleration                 200      #Acceleration for the extruder stepper motor, in mm/s^2
extruder.4thaxis.max_speed                    500     #Maximum allowable speed for the stepper motor, in millimetres/second
extruder.4thaxis.step_pin                     2.3o     #Pin for 4th axis stepper motor driver's step signal
extruder.4thaxis.dir_pin                      0.22!o   #Pin for 4th axis stepper motor driver's direction signal
extruder.4thaxis.en_pin                       0.21!o   #Pin for 4th axis stepper motor driver's enable signal
delta_current                                 1.4      #4th axis current or second extruder




# EN MODE CNC   201x236x avec 4mm (fraise de 8) de compensation outil dispo tout autour : avec une fraise de 2mm 207x242
# EN MODE PRINT 209x244x110 utilisable en centre buse si on utilise X-4 Y-4 comme point de depart sur la grille
## Endstops
# See http://smoothieware.org/endstops
endstops_enable                              true             # The endstop module is enabled by default and can be disabled here
alpha_min_endstop                            1.24^            # Pin to read min endstop, add a ! to invert if endstop is NO connected to ground
alpha_homing_direction                       home_to_min      # Or set to home_to_max and set alpha_max and uncomment the alpha_max_endstop
alpha_homing_retract_mm                      4.3              # Distance to retract from the endstop after it is hit for alpha/X
alpha_min                                    -4.3             # This gets loaded as the current position after homing when home_to_min is set
alpha_max                                    205   #201 UTILISABLE AVEC 4mm de compensation outil  # This gets loaded as the current position after homing when home_to_max is set
alpha_max_travel                             211              # Max travel in mm for alpha/X axis when homing
beta_max_endstop                             1.27^            # Pin to read max endstop, uncomment this and comment the above if using max endstops
beta_homing_direction                        home_to_max      # Or set to home_to_max and set alpha_max and uncomment the alpha_max_endstop
beta_homing_retract_mm                       4.3              # Distance to retract from the endstop after it is hit for beta/Y
beta_min                                     -240  #236 UTILISABLE AVEC 4mm de compensation outil  # This gets loaded as the current position after homing when home_to_min is set
beta_max                                     4.3              # This gets loaded as the current position after homing when home_to_max is set
beta_max_travel                              246              # Max travel in mm for beta/Y axis when homing
gamma_max_endstop                            1.29^            # Pin to read max endstop, uncomment this and comment the above if using max endstops
gamma_homing_direction                       home_to_max      # Or set to home_to_max and set alpha_max and uncomment the alpha_max_endstop
gamma_homing_retract_mm                      1.3              # Distance to retract from the endstop after it is hit for gamma/Z
gamma_min                                    0     #prevoir Xmm de moins pour compensation outil  # This gets loaded as the current position after homing when home_to_min is set
gamma_max                                    90.3             # This gets loaded as the current position after homing when home_to_max is set
gamma_max_travel                             117              # Max travel in mm for gamma/Z axis when homing

# Optional enable limit switches, actions will stop if any enabled limit switch is triggered
alpha_limit_enable                          true              # Set to true to enable X min and max limit switches
beta_limit_enable                           true              # Set to true to enable Y min and max limit switches
gamma_limit_enable                          true              # Set to true to enable Z min and max limit switches

# Endstops home at their fast feedrate first, then once the endstop is found they home again at their slow feedrate for accuracy
alpha_fast_homing_rate_mm_s                  16               # Alpha/X fast homing feedrate in mm/second
alpha_slow_homing_rate_mm_s                  10               # Alpha/X slow homing feedrate in mm/second
beta_fast_homing_rate_mm_s                   16               # Beta/Y  fast homing feedrate in mm/second
beta_slow_homing_rate_mm_s                   10               # Beta/Y  slow homing feedrate in mm/second
gamma_fast_homing_rate_mm_s                  9                # Gamma/Z fast homing feedrate in mm/second
gamma_slow_homing_rate_mm_s                  6                # Gamma/Z slow homing feedrate in mm/second


# Optional order in which axis will home, default is they all home at the same time,
# If this is set it will force each axis to home one at a time in the specified order
#homing_order                                 XYZ             # X axis followed by Y then Z last
#move_to_origin_after_home                    false           # Move XY to 0,0 after homing
#endstop_debounce_count                       100             # Uncomment if you get noise on your endstops, default is 100
#endstop_debounce_ms                          1               # Uncomment if you get noise on your endstops, default is 1 ms debounce
home_z_first                                 true             # Uncomment and set to true to home the Z first, otherwise Z homes after XY


# Optional software endstop limit
#After the machine has been homed this needs to be enabled by M211 S1 or disabled by M211 S0
soft_endstop.enable         true          # Enable soft endstops
soft_endstop.x_min          -4.05         # Minimum X position
soft_endstop.x_max          205.05        # Maximum X position
soft_endstop.y_min          -240.05       # Minimum Y position
soft_endstop.y_max          4.05          # Maximum Y position
soft_endstop.z_min          -15            # Minimum Z position NEED TO BE DESACTIVATED FOR LEVELING-STRATEGY or need to do M211 S0 before G32 ??
soft_endstop.z_max          116.05        # Maximum Z position SPACE LEFT FOR 3D USE
soft_endstop.halt           false         # if false, will just ignore commands that would exceed the limit
#soft_endstop.halt           true          # if true, will issue a HALT state when hitting a soft endstop


## Z-probe
# See http://smoothieware.org/zprobe
zprobe.enable                true             # Set to true to enable a zprobe
zprobe.probe_pin             0.27   #interrupt capable needed # Pin probe NO is attached to a interrupt capable, if NC remove the !
zprobe.fast_feedrate         300              # Move feedrate mm/sec
zprobe.slow_feedrate         5                # Mm/sec probe feed rate
zprobe.debounce_ms           1                # Set if noisy
zprobe.probe_height          10               # How much above bed to start probe
#zprobe.return_feedrate       0                # feedrate after a probe, default 0 is double of slow_feedrate (mm/s)
#zprobe.max_z                 200              # maximum default travel for the probe command, will use gamma_max if not defined
#gamma_min_endstop            1.28!^   # Change to nc to prevent conflict and keep this one free for use a relay board


## Bed Leveling
# Switch module for Bltouch control
switch.bltouch.enable                        true          # Activate this new module
switch.bltouch.input_on_command              M280          # Command to set PWM value
switch.bltouch.input_off_command             M281          # Command to turn off switch
switch.bltouch.output_pin                    1.23          # This must be a PWM pin, see smoothieware.org/pinout  DOT NOT USE OR ADD THIRD BIG MOSFET
switch.bltouch.output_type                   hwpwm         # Hardware PWM, as software PWM is not adequate for servo/bltouch
switch.bltouch.pwm_period_ms                 20            # 20ms period, or 50Hz
switch.bltouch.failsafe_set_to               0             # in case of a crash or HALT condition


## Levelling strategy
leveling-strategy.rectangular-grid.enable               true
leveling-strategy.rectangular-grid.x_size               201     # laisser 4mm de moins comme la mesure sur la gauche du plateau
leveling-strategy.rectangular-grid.y_size               -187    # -240 maxi +53 offset bltouch
leveling-strategy.rectangular-grid.size                 8
leveling-strategy.rectangular-grid.human_readable       true
leveling-strategy.rectangular-grid.do_home              false   # shared config CNC/Printer so not wanted to be automatic
leveling-strategy.rectangular-grid.probe_offsets        0,53,0  # offset bltouch en Y a priori pas possible d'utiliser le Z ici
leveling-strategy.rectangular-grid.save                 false   # shared config so do M374 only after level and need M375 at gcode begin for printer
leveling-strategy.rectangular-grid.initial_height       40
leveling-strategy.rectangular-grid.before_probe_gcode   M280S3
leveling-strategy.rectangular-grid.after_probe_gcode    M280S7
#leveling-strategy.rectangular-grid.dampening_start      0.5    # algorithm will be applied less and less from this height onwards
#leveling-strategy.rectangular-grid.height_limit         2      # algorithm will stop applying compensation from this point onwards



#filament_detector.enable              true   #This module is activated only if this is set to true
#filament_detector.encoder_pin         0.28   #This is the pin the encoder is connected to. Must be an interrupt pin
##filament_detector.bulge_pin           1.31   #OPTIONAL This is the pin the bulge switch is connected to and the filament is moving, this will trigger an alarm
#filament_detector.seconds_per_check   2      #How many seconds between filament position checks, must be long enough for several pulses to be detected
#filament_detector.pulses_per_mm       0.5    #The number of pulses the encoder produces for every millimeter of filament movement


## Panel usable pin keep for reference
#panel.spi_cs_pin                      0.16                      # spi chip select     ; GLCD EXP1 Pin 4
#panel.encoder_a_pin                   1.22                      # encoder pin         ; GLCD EXP2 Pin 3
#panel.encoder_b_pin                   1.23                      # encoder pin         ; GLCD EXP2 Pin 5  or RESERVED for the third big mosfet
#panel.click_button_pin                1.30!^                    # click button        ; GLCD EXP1 Pin 2
##panel.back_button_pin                 0.xx!^                  # Pin for the back button
#panel.buzz_pin      <                  1.31                      # pin for buzzer      ; GLCD EXP1 Pin 1


## Network settings
# See http://smoothieware.org/network
network.enable                               false              # Enable the ethernet network services
network.webserver.enable                     false              # Enable the webserver
network.telnet.enable                        false              # Enable the telnet server
#network.ip_address                          auto               # Use dhcp to get ip address
network.hostname                             Charly
# Uncomment the 3 below to manually setup ip address
network.ip_address                           192.168.0.22       # The IP address
#ecranRPI3B.ip_address                       192.168.0.24       # The IP address
network.ip_mask                              255.255.255.0      # The ip mask
network.ip_gateway                           192.168.0.254      # The gateway address


## System configuration
# Serial communications configuration ( baud rate defaults to 9600 if undefined )
# For communication over the UART port, *not* the USB/Serial port
uart0.baud_rate                              115200             # Baud rate for the default hardware ( UART ) serial port

second_usb_serial_enable                     false              # This enables a second USB serial port
#leds_disable                                true               # Disable using leds after config loaded
#play_led_disable                            true               # Disable the play led

#msd_disable                                 true               # Disable the MSD (USB SDCARD), see http://smoothieware.org/troubleshooting#disable-msd
dfu_enable                                   true               # For linux developers or smoopi, set to true to enable DFU

# Only needed on a smoothieboard
# See http://smoothieware.org/currentcontrol
currentcontrol_module_enable                 false              # Control stepper motor current via the configuration file

drillingcycles.enable                        true               # Enable drillingcycles module.
drillingcycles.dwell_units                   Shift              # Dwell units Shift = seconds, P = millis.


# Kill button maybe assigned to a different pin, set to the onboard pin by default
# See http://smoothieware.org/killbutton
kill_button_enable                           true               # Set to true to enable a kill button (push 2 second for unkill)
kill_button_pin                              2.12               # Kill button pin. default is same as pause button 2.12 (2.11 is another good choice)


## Switch modules
# See http://smoothieware.org/switch

# Switch module for suspend button
switch.suspend.enable                  true                       # Enable this module
switch.suspend.input_pin               2.11^                      # Pin where pause button is connected
switch.suspend.output_on_command       suspend                    # Suspend command

# Switch module for restart button
switch.relance.enable                  true                       # Enable this module
switch.relance.input_pin               3.26                       # Pin where relance button is connected
switch.relance.output_on_command       resume                     # Resume command
switch.relance.failsafe_set_to         0                          # in case of a crash or HALT condition


# redefine suspend/resume
after_suspend_gcode                  M32parkZXY.g                 # Gcode to run after suspend (simple code does not work for suspend)
before_resume_gcode                  G59.3G0X0Y0G54               # Gcode to run before resume (M32 does not work for resume)
#before_resume_gcode                  G59.3G0X0Y0M3M7M106G54  # Gcode to run before resume (M32 does not work for resume)


# Switch module for reset button now directly connected to reset pin
switch.reset.enable                  true                       # Enable this module
switch.reset.input_pin               reset                      # Pin where reset button is connected

switch.3dpsu-or-spindlebut.enable                true            # Enable this module
switch.3dpsu-or-spindlebut.input_pin             3.25^           # Pin where Spindle button is connected
switch.3dpsu-or-spindlebut.input_pin_behavior    toggle          # This pin toggles between its on and off states each time it is pressed and released
switch.3dpsu-or-spindlebut.output_on_command     M3M7            # start spindle + light
switch.3dpsu-or-spindlebut.output_off_command    M5M9            # stop spindle + light
switch.3dpsu-or-spindlebut.startup_state         false
switch.3dpsu-or-spindlebut.failsafe_set_to       0               # in case of a crash or HALT condition

switch.spindle.enable                    true           # Enable this module utiliser pour le relai de broche
switch.spindle.input_on_command          M3             # Command that will turn this switch on
switch.spindle.input_off_command         M5             # Command that will turn this switch off
switch.spindle.output_pin                1.25o!         # using x max endstop # Pin shared wth spindle
switch.spindle.output_type               digital        # Digital means this is just an on or off pin
switch.spindle.startup_state             false
switch.spindle.failsafe_set_to           0              # in case of a crash or HALT condition


switch.3dpsu.enable                          true             # Enable this module utiliser pour le relai de broche
switch.3dpsu.input_on_command                M104      # ou M109 ou M106 a voir  # Command that will turn this switch on
switch.3dpsu.input_off_command               M81              # Command that will turn this switch off
switch.3dpsu.output_pin                      1.25o!           # using x max endstop # Pin shared wth spindle
switch.3dpsu.output_type                     digital          # Digital means this is just an on or off pin
switch.3dpsu.startup_state                   false
switch.3dpsu.failsafe_set_to                 0                # in case of a crash or HALT condition



# Switch module for fan control on/off
switch.fan3dhead.enable                       true             #
switch.fan3dhead.input_on_command             M106             #
switch.fan3dhead.input_off_command            M107             #
switch.fan3dhead.output_pin                   4.29             # using pin ENA5 beacuse this one does not work fine for enable
switch.fan3dhead.output_type                  digital          
switch.fan3dhead.startup_state                false
switch.fan3dhead.failsafe_set_to              0                # in case of a crash or HALT condition


# Switch module for fan control for workpieces
switch.fanpwm3dhead.enable                       true             #
switch.fanpwm3dhead.input_on_command             M106             #
switch.fanpwm3dhead.input_off_command            M107             #
switch.fanpwm3dhead.output_pin                   2.4              #PWM capable 
switch.fanpwm3dhead.output_type                  pwm              # PWM output settable with S parameter in the input_on_comand
switch.fanpwm3dhead.max_pwm                      255              # set max PWM for the pin default is 255
switch.fanpwm3dhead.startup_state                true
switch.fanpwm3dhead.failsafe_set_to               0                 # in case of a crash or HALT condition

switch.light.enable                          true               # Enable this module utiliser pour la lumiere
switch.light.input_on_command                M7                 # Command that will turn this switch on
switch.light.input_off_command               M9                 # Command that will turn this switch on
switch.light.output_pin                      2.6                # Pin this module controls Mosfet (masse piqu� sur le mosfet et +5 pris sur les endstop)
switch.light.output_type                     digital            # Digital means this is just an on or off pin
switch.light.startup_state                   false
switch.light.failsafe_set_to                 0                  # in case of a crash or HALT condition

switch.flood.enable                          true               # Enable this module utiliser pour la la librification ou aspiration
switch.flood.input_on_command                M8                 # Command that will turn this switch on
switch.flood.input_off_command               M9                 # Command that will turn this switch on
switch.flood.output_pin                      2.5                # Pin this module controls Mosfet (masse piqu� sur le mosfet et +5 pris sur les endstop)
switch.flood.output_type                     digital            # Digital means this is just an on or off pin
switch.flood.startup_state                   false
switch.flood.failsafe_set_to                 0                  # in case of a crash or HALT condition