Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeanon committed Oct 11, 2023
1 parent 55d9338 commit 14cb5af
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 20 deletions.
37 changes: 36 additions & 1 deletion docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,29 @@ position_max:
#second_homing_speed:
# Velocity (in mm/s) of the stepper when performing the second home.
# The default is homing_speed/2.
#homing_resting_retract_dist:
# Distance to back off after successfully homing, the default is
# homing_retract_dist.
#homing_resting_retract_speed:
# Velocity (in mm/s) of the stepper when retracting after successfully
# homing, the default is homing_retract_speed
#homing_positive_dir:
# If true, homing will cause the stepper to move in a positive
# direction (away from zero); if false, home towards zero. It is
# better to use the default than to specify this parameter. The
# default is true if position_endstop is near position_max and false
# if near position_min.
#disable_on_error: False
# Experimental feature to disable the steppers when the mcu looses
# connection to the host.
# If one stepper is set to true, the feature will be enabled for all
# steppers. (I currently have no idea how to modify the mcu firmware
# code to have the feature enabled individually)
# Currently this feature can also cause problems when disabling steppers
# and cause the firmware to shut down due to race-conditions.
# Even though this happens very very rarely, use this feature at your own
# risk (While the steppers are on, no problems occur, only when disabling,
# very rarely an error occurs)
```

### Cartesian Kinematics
Expand Down Expand Up @@ -947,6 +964,12 @@ max_temp:
# heater and sensor hardware failures. Set this range just wide
# enough so that reasonable temperatures do not result in an error.
# These parameters must be provided.
#max_set_temp:
# The maximum temperature that can be requested. Usefull for heaters
# that have a large overshoot (e.g. max_temp is set to 280 but the heater
# overshoots by 10 you would set max_set_temp to 265 so you can only
# request 265 so when the heater overshoots it will not trigger a shutdown).
# The default is max_temp
```

### [heater_bed]
Expand All @@ -962,6 +985,7 @@ sensor_pin:
control:
min_temp:
max_temp:
#max_set_temp:
# See the "extruder" section for a description of the above parameters.
```

Expand Down Expand Up @@ -1351,6 +1375,7 @@ See also: [extended g-code commands](G-Codes.md#z_thermal_adjust).
#sensor_pin:
#min_temp:
#max_temp:
#max_set_temp:
# Temperature sensor configuration.
# See the "extruder" section for the definition of the above
# parameters.
Expand Down Expand Up @@ -1593,10 +1618,20 @@ using this feature may place the printer in an invalid state - see the
```
[force_move]
#enable_force_move: False
# Set to true to enable FORCE_MOVE and SET_KINEMATIC_POSITION
# Set to true to enable FORCE_MOVE, SET_KINEMATIC_POSITION
# and MARK_AS_HOMED.
# extended G-Code commands. The default is false.
```

### [unhome]

Mark different axes as unhomed without disabling the steppers, usefull
for really advanced macros.

```
[unhome]
```

### [pause_resume]

Pause/Resume functionality with support of position capture and
Expand Down
57 changes: 42 additions & 15 deletions docs/G-Codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Klipper supports the following standard G-Code commands:
- Move (G0 or G1): `G1 [X<pos>] [Y<pos>] [Z<pos>] [E<pos>] [F<speed>]`
- Dwell: `G4 P<milliseconds>`
- Move to origin: `G28 [X] [Y] [Z]`
- Turn off motors: `M18` or `M84`
- Turn off motors: `M18 [X] [Y] [Z] [E]` or `M84 [X] [Y] [Z] [E]`
- Wait for current moves to finish: `M400`
- Use absolute/relative distances for extrusion: `M82`, `M83`
- Use absolute/relative coordinates: `G90`, `G91`
Expand Down Expand Up @@ -491,20 +491,29 @@ status of the filament sensor. The data displayed on the terminal will
depend on the sensor type defined in the configuration.

#### SET_FILAMENT_SENSOR
###### For filament_switch_sensor:
`SET_FILAMENT_SENSOR SENSOR=<sensor_name> [ENABLE=0|1] [RESET=0|1]
[DETECTION_LENGTH=<mm>] [RUNOUT_DISTANCE=<mm>]`: Sets values for the
[RUNOUT_DISTANCE=<mm>]`: Sets values for the
filament sensor. If all parameters are omitted, the current stats will
be reported.
be reported. <br>
ENABLE sets the filament sensor on/off. If ENABLE is set to 0, the
filament sensor will be disabled, if set to 1 it is enabled.
DETECTION_LENGTH is only usable on filament_motion_sensors while
RUNOUT_DISTANCE is only valid for a filament_switch_sensor.
RESET will remove all pending runout_gcodes (if runout_distance is higher
than 0) for a switch sensor and reset the states of a motion sensor while
setting it to filament detected.
ENABLE will trigger a reset if it changes the enabled state of the sensor.
DETECTION_LENGTH will trigger a reset of the sensor of the detection
length changes.
filament sensor will be disabled, if set to 1 it is enabled. If the state
of the sensor changes, a reset will be triggered. <br>
RESET removes all pending runout_gcodes and pauses and force a reevaluation
of the sensor state. <br>
RUNOUT_DISTANCE sets the runout_distance.

###### For filament_motion_sensor:
`SET_FILAMENT_SENSOR SENSOR=<sensor_name> [ENABLE=0|1] [RESET=0|1]
[DETECTION_LENGTH=<mm>]`: Sets values for the
filament sensor. If all parameters are omitted, the current stats will
be reported. <br>
ENABLE sets the filament sensor on/off. If ENABLE is set to 0, the
filament sensor will be disabled, if set to 1 it is enabled. If the sensor
was previously disabled and gets enabled, a reset will be triggered. <br>
RESET resets the state of the sensor and sets it to filament detected. <br>
DETECTION_LENGTH sets the detection_length, if the new detection length is
different than the old one, a reset will be triggered.

### [firmware_retraction]

Expand Down Expand Up @@ -575,6 +584,24 @@ may lead to internal software errors. This command may invalidate
future boundary checks; issue a G28 afterwards to reset the
kinematics.

#### MARK_AS_HOMED
`MARK_AS_HOMED [AXES=X,Y,Z]`: Marks the given axes as homed, if AXES
is omitted, all axes will be marked as homed.
!!!USE WITH CAUTION!!!

### [unhome]

If the [unhome config section](Config_Reference.md#unhome) is enabled,
the following command will be available.

#### MARK_AS_UNHOMED
`MARK_AS_UNHOMED [AXES=X,Y,Z]`: Marks the given axes as unhomed, if AXES
is omitted, all axes will be marked as unhomed.

#### D28
`D28 [X] [Y] [Z]`: Same as MARK_AS_UNHOMED


### [gcode]

The gcode module is automatically loaded.
Expand Down Expand Up @@ -930,9 +957,9 @@ in the config file.

#### PID_CALIBRATE
`PID_CALIBRATE HEATER=<config_name> TARGET=<temperature> [TOLERANCE=<tolerance>]
[WRITE_FILE=1] [PROFILE=<profile_name>]`: Perform a PID calibration test. The
specified heater will be enabled until the specified target temperature
is reached, and then the heater will be turned off and on for several
[WRITE_FILE=1] [TUNE_PID_DELTA=<delta>] [PROFILE=<profile_name>]`: Perform a PID
calibration test. The specified heater will be enabled until the specified target
temperature is reached, and then the heater will be turned off and on for several
cycles. If the WRITE_FILE parameter is enabled, then the file
/tmp/heattest.txt will be created with a log of all temperature samples
taken during the test. TOLERANCE defaults to 0.02 if not passed in. The
Expand Down
2 changes: 1 addition & 1 deletion klippy/extras/filament_motion_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def set_filament_sensor(self, gcmd):
gcmd.respond_info(self.get_sensor_status())
return
if enable is not None:
if enable != self.runout_helper.sensor_enabled:
if enable and not self.runout_helper.sensor_enabled:
reset = 1
self.runout_helper.sensor_enabled = enable
if detection_length is not None:
Expand Down
4 changes: 2 additions & 2 deletions klippy/extras/stepper_enable.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _resend_current_val(self, eventtime):
return systime + self.resend_interval


def setup_enable_pin(printer, pin, disable_on_error=True):
def setup_enable_pin(printer, pin, disable_on_error=False):
if pin is None:
# No enable line (stepper always enabled)
enable = StepperEnablePin(None, 9999, printer)
Expand Down Expand Up @@ -139,7 +139,7 @@ def register_stepper(self, config, mcu_stepper):
enable = setup_enable_pin(self.printer,
config.get('enable_pin', None),
config.getboolean('disable_on_error',
True))
False))
self.enable_lines[name] = EnableTracking(mcu_stepper, enable)
def stepper_off(self, stepper_name, print_time, rail_name):
el = self.enable_lines[stepper_name]
Expand Down
2 changes: 1 addition & 1 deletion klippy/stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def __init__(self, config, need_position_minmax=True,
self.homing_retract_dist = config.getfloat(
'homing_retract_dist', 5., minval=0.)
self.homing_resting_retract_speed = config.getfloat(
'homing_resting_retract_speed', self.homing_speed, above=0.)
'homing_resting_retract_speed', self.homing_retract_speed, above=0.)
self.homing_resting_retract_dist = config.getfloat(
'homing_resting_retract_dist', self.homing_retract_dist, minval=0.)
self.homing_positive_dir = config.getboolean(
Expand Down

0 comments on commit 14cb5af

Please sign in to comment.