homing: Remove EndstopError
There's no reason to distinguish between an EndstopError and a CommandError, so just use CommandError. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
1f3a160f47
commit
f6dd97b784
|
@ -4,7 +4,6 @@
|
||||||
#
|
#
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
import logging
|
import logging
|
||||||
import homing
|
|
||||||
from . import probe
|
from . import probe
|
||||||
|
|
||||||
SIGNAL_PERIOD = 0.020
|
SIGNAL_PERIOD = 0.020
|
||||||
|
@ -82,7 +81,7 @@ class BLTouchEndstopWrapper:
|
||||||
self.set_output_mode(self.output_mode)
|
self.set_output_mode(self.output_mode)
|
||||||
try:
|
try:
|
||||||
self.raise_probe()
|
self.raise_probe()
|
||||||
except homing.CommandError as e:
|
except self.printer.command_error as e:
|
||||||
logging.warning("BLTouch raise probe error: %s", str(e))
|
logging.warning("BLTouch raise probe error: %s", str(e))
|
||||||
def sync_mcu_print_time(self):
|
def sync_mcu_print_time(self):
|
||||||
curtime = self.printer.get_reactor().monotonic()
|
curtime = self.printer.get_reactor().monotonic()
|
||||||
|
@ -128,7 +127,8 @@ class BLTouchEndstopWrapper:
|
||||||
# The "probe raised" test completed successfully
|
# The "probe raised" test completed successfully
|
||||||
break
|
break
|
||||||
if retry >= 2:
|
if retry >= 2:
|
||||||
raise homing.EndstopError("BLTouch failed to raise probe")
|
raise self.printer.command_error(
|
||||||
|
"BLTouch failed to raise probe")
|
||||||
msg = "Failed to verify BLTouch probe is raised; retrying."
|
msg = "Failed to verify BLTouch probe is raised; retrying."
|
||||||
self.gcode.respond_info(msg)
|
self.gcode.respond_info(msg)
|
||||||
self.sync_mcu_print_time()
|
self.sync_mcu_print_time()
|
||||||
|
@ -161,7 +161,7 @@ class BLTouchEndstopWrapper:
|
||||||
return
|
return
|
||||||
msg = "BLTouch failed to verify sensor state"
|
msg = "BLTouch failed to verify sensor state"
|
||||||
if retry >= 2:
|
if retry >= 2:
|
||||||
raise homing.EndstopError(msg)
|
raise self.printer.command_error(msg)
|
||||||
self.gcode.respond_info(msg + '; retrying.')
|
self.gcode.respond_info(msg + '; retrying.')
|
||||||
self.send_cmd('reset', duration=RETRY_RESET_TIME)
|
self.send_cmd('reset', duration=RETRY_RESET_TIME)
|
||||||
def multi_probe_begin(self):
|
def multi_probe_begin(self):
|
||||||
|
@ -191,7 +191,7 @@ class BLTouchEndstopWrapper:
|
||||||
# Verify the probe actually deployed during the attempt
|
# Verify the probe actually deployed during the attempt
|
||||||
for s, mcu_pos in self.start_mcu_pos:
|
for s, mcu_pos in self.start_mcu_pos:
|
||||||
if s.get_mcu_position() == mcu_pos:
|
if s.get_mcu_position() == mcu_pos:
|
||||||
raise homing.EndstopError("BLTouch failed to deploy")
|
raise self.printer.command_error("BLTouch failed to deploy")
|
||||||
def home_start(self, print_time, sample_time, sample_count, rest_time):
|
def home_start(self, print_time, sample_time, sample_count, rest_time):
|
||||||
rest_time = min(rest_time, ENDSTOP_REST_TIME)
|
rest_time = min(rest_time, ENDSTOP_REST_TIME)
|
||||||
return self.mcu_endstop.home_start(print_time, sample_time,
|
return self.mcu_endstop.home_start(print_time, sample_time,
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#
|
#
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
import math, logging
|
import math, logging
|
||||||
import homing
|
|
||||||
|
|
||||||
TRINAMIC_DRIVERS = ["tmc2130", "tmc2208", "tmc2209", "tmc2660", "tmc5160"]
|
TRINAMIC_DRIVERS = ["tmc2130", "tmc2208", "tmc2209", "tmc2660", "tmc5160"]
|
||||||
|
|
||||||
|
@ -81,7 +80,7 @@ class EndstopPhase:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = "Unable to get stepper %s phase: %s" % (self.name, str(e))
|
msg = "Unable to get stepper %s phase: %s" % (self.name, str(e))
|
||||||
logging.exception(msg)
|
logging.exception(msg)
|
||||||
raise homing.EndstopError(msg)
|
raise self.printer.command_error(msg)
|
||||||
if stepper.is_dir_inverted():
|
if stepper.is_dir_inverted():
|
||||||
phase = (self.phases - 1) - phase
|
phase = (self.phases - 1) - phase
|
||||||
else:
|
else:
|
||||||
|
@ -95,7 +94,7 @@ class EndstopPhase:
|
||||||
if delta >= self.phases - self.endstop_phase_accuracy:
|
if delta >= self.phases - self.endstop_phase_accuracy:
|
||||||
delta -= self.phases
|
delta -= self.phases
|
||||||
elif delta > self.endstop_phase_accuracy:
|
elif delta > self.endstop_phase_accuracy:
|
||||||
raise homing.EndstopError(
|
raise self.printer.command_error(
|
||||||
"Endstop %s incorrect phase (got %d vs %d)" % (
|
"Endstop %s incorrect phase (got %d vs %d)" % (
|
||||||
self.name, phase, self.endstop_phase))
|
self.name, phase, self.endstop_phase))
|
||||||
return delta * self.step_dist
|
return delta * self.step_dist
|
||||||
|
|
|
@ -101,8 +101,8 @@ class Homing:
|
||||||
for s, name, spos, epos in end_mcu_pos:
|
for s, name, spos, epos in end_mcu_pos:
|
||||||
if spos == epos:
|
if spos == epos:
|
||||||
if probe_pos:
|
if probe_pos:
|
||||||
raise EndstopError("Probe triggered prior to movement")
|
raise CommandError("Probe triggered prior to movement")
|
||||||
raise EndstopError(
|
raise CommandError(
|
||||||
"Endstop %s still triggered after retract" % (name,))
|
"Endstop %s still triggered after retract" % (name,))
|
||||||
def home_rails(self, rails, forcepos, movepos):
|
def home_rails(self, rails, forcepos, movepos):
|
||||||
# Notify of upcoming homing operation
|
# Notify of upcoming homing operation
|
||||||
|
@ -161,7 +161,4 @@ def multi_complete(printer, completions):
|
||||||
class CommandError(Exception):
|
class CommandError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class EndstopError(CommandError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
Coord = collections.namedtuple('Coord', ('x', 'y', 'z', 'e'))
|
Coord = collections.namedtuple('Coord', ('x', 'y', 'z', 'e'))
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
import logging
|
import logging
|
||||||
import stepper, homing
|
import stepper
|
||||||
|
|
||||||
class CartKinematics:
|
class CartKinematics:
|
||||||
def __init__(self, toolhead, config):
|
def __init__(self, toolhead, config):
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
import logging, math
|
import logging, math
|
||||||
import stepper, homing
|
import stepper
|
||||||
|
|
||||||
class CoreXYKinematics:
|
class CoreXYKinematics:
|
||||||
def __init__(self, toolhead, config):
|
def __init__(self, toolhead, config):
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
import logging, math
|
import logging, math
|
||||||
import stepper, homing
|
import stepper
|
||||||
|
|
||||||
class CoreXZKinematics:
|
class CoreXZKinematics:
|
||||||
def __init__(self, toolhead, config):
|
def __init__(self, toolhead, config):
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
import math, logging
|
import math, logging
|
||||||
import stepper, homing, mathutil
|
import stepper, mathutil
|
||||||
|
|
||||||
# Slow moves once the ratio of tower to XY movement exceeds SLOW_RATIO
|
# Slow moves once the ratio of tower to XY movement exceeds SLOW_RATIO
|
||||||
SLOW_RATIO = 3.
|
SLOW_RATIO = 3.
|
||||||
|
|
|
@ -107,13 +107,13 @@ class PrinterExtruder:
|
||||||
def check_move(self, move):
|
def check_move(self, move):
|
||||||
axis_r = move.axes_r[3]
|
axis_r = move.axes_r[3]
|
||||||
if not self.heater.can_extrude:
|
if not self.heater.can_extrude:
|
||||||
raise homing.EndstopError(
|
raise self.printer.command_error(
|
||||||
"Extrude below minimum temp\n"
|
"Extrude below minimum temp\n"
|
||||||
"See the 'min_extrude_temp' config option for details")
|
"See the 'min_extrude_temp' config option for details")
|
||||||
if (not move.axes_d[0] and not move.axes_d[1]) or axis_r < 0.:
|
if (not move.axes_d[0] and not move.axes_d[1]) or axis_r < 0.:
|
||||||
# Extrude only move (or retraction move) - limit accel and velocity
|
# Extrude only move (or retraction move) - limit accel and velocity
|
||||||
if abs(move.axes_d[3]) > self.max_e_dist:
|
if abs(move.axes_d[3]) > self.max_e_dist:
|
||||||
raise homing.EndstopError(
|
raise self.printer.command_error(
|
||||||
"Extrude only move too long (%.3fmm vs %.3fmm)\n"
|
"Extrude only move too long (%.3fmm vs %.3fmm)\n"
|
||||||
"See the 'max_extrude_only_distance' config"
|
"See the 'max_extrude_only_distance' config"
|
||||||
" option for details" % (move.axes_d[3], self.max_e_dist))
|
" option for details" % (move.axes_d[3], self.max_e_dist))
|
||||||
|
@ -127,7 +127,7 @@ class PrinterExtruder:
|
||||||
area = axis_r * self.filament_area
|
area = axis_r * self.filament_area
|
||||||
logging.debug("Overextrude: %s vs %s (area=%.3f dist=%.3f)",
|
logging.debug("Overextrude: %s vs %s (area=%.3f dist=%.3f)",
|
||||||
axis_r, self.max_extrude_ratio, area, move.move_d)
|
axis_r, self.max_extrude_ratio, area, move.move_d)
|
||||||
raise homing.EndstopError(
|
raise self.printer.command_error(
|
||||||
"Move exceeds maximum extrusion (%.3fmm^2 vs %.3fmm^2)\n"
|
"Move exceeds maximum extrusion (%.3fmm^2 vs %.3fmm^2)\n"
|
||||||
"See the 'max_extrude_cross_section' config option for details"
|
"See the 'max_extrude_cross_section' config option for details"
|
||||||
% (area, self.max_extrude_ratio * self.filament_area))
|
% (area, self.max_extrude_ratio * self.filament_area))
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
import logging, math
|
import logging, math
|
||||||
import stepper, homing
|
import stepper
|
||||||
|
|
||||||
class PolarKinematics:
|
class PolarKinematics:
|
||||||
def __init__(self, toolhead, config):
|
def __init__(self, toolhead, config):
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
import math, logging
|
import math, logging
|
||||||
import stepper, homing, mathutil, chelper
|
import stepper, mathutil, chelper
|
||||||
|
|
||||||
class RotaryDeltaKinematics:
|
class RotaryDeltaKinematics:
|
||||||
def __init__(self, toolhead, config):
|
def __init__(self, toolhead, config):
|
||||||
|
|
|
@ -55,9 +55,9 @@ class Move:
|
||||||
self.delta_v2 = 2.0 * self.move_d * self.accel
|
self.delta_v2 = 2.0 * self.move_d * self.accel
|
||||||
self.smooth_delta_v2 = min(self.smooth_delta_v2, self.delta_v2)
|
self.smooth_delta_v2 = min(self.smooth_delta_v2, self.delta_v2)
|
||||||
def move_error(self, msg="Move out of range"):
|
def move_error(self, msg="Move out of range"):
|
||||||
pos = self.end_pos
|
ep = self.end_pos
|
||||||
return homing.EndstopError("%s: %.3f %.3f %.3f [%.3f]"
|
m = "%s: %.3f %.3f %.3f [%.3f]" % (msg, ep[0], ep[1], ep[2], ep[3])
|
||||||
% (msg, pos[0], pos[1], pos[2], pos[3]))
|
return self.toolhead.printer.command_error(m)
|
||||||
def calc_junction(self, prev_move):
|
def calc_junction(self, prev_move):
|
||||||
if not self.is_kinematic_move or not prev_move.is_kinematic_move:
|
if not self.is_kinematic_move or not prev_move.is_kinematic_move:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue