|
@ -385,65 +385,59 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0. |
|
|
|
|
|
|
|
|
#endif // PARKING_EXTRUDER
|
|
|
#endif // PARKING_EXTRUDER
|
|
|
|
|
|
|
|
|
#if ENABLED(SWITCHING_TOOLHEAD) |
|
|
#if ENABLED(TOOL_SENSOR) |
|
|
|
|
|
|
|
|
|
|
|
bool tool_sensor_disabled; // = false
|
|
|
|
|
|
|
|
|
// Return a bitmask of tool sensor states
|
|
|
// Return a bitmask of tool sensor states
|
|
|
inline uint8_t poll_tool_sensor_pins() { |
|
|
inline uint8_t poll_tool_sensor_pins() { |
|
|
return (0 |
|
|
return (0 |
|
|
#if ENABLED(TOOL_SENSOR) |
|
|
#if PIN_EXISTS(TOOL_SENSOR1) |
|
|
#if PIN_EXISTS(TOOL_SENSOR1) |
|
|
| (READ(TOOL_SENSOR1_PIN) << 0) |
|
|
| (READ(TOOL_SENSOR1_PIN) << 0) |
|
|
#endif |
|
|
#endif |
|
|
#if PIN_EXISTS(TOOL_SENSOR2) |
|
|
#if PIN_EXISTS(TOOL_SENSOR2) |
|
|
| (READ(TOOL_SENSOR2_PIN) << 1) |
|
|
| (READ(TOOL_SENSOR2_PIN) << 1) |
|
|
#endif |
|
|
#endif |
|
|
#if PIN_EXISTS(TOOL_SENSOR3) |
|
|
#if PIN_EXISTS(TOOL_SENSOR3) |
|
|
| (READ(TOOL_SENSOR3_PIN) << 2) |
|
|
| (READ(TOOL_SENSOR3_PIN) << 2) |
|
|
#endif |
|
|
#endif |
|
|
#if PIN_EXISTS(TOOL_SENSOR4) |
|
|
#if PIN_EXISTS(TOOL_SENSOR4) |
|
|
| (READ(TOOL_SENSOR4_PIN) << 3) |
|
|
| (READ(TOOL_SENSOR4_PIN) << 3) |
|
|
#endif |
|
|
#endif |
|
|
#if PIN_EXISTS(TOOL_SENSOR5) |
|
|
#if PIN_EXISTS(TOOL_SENSOR5) |
|
|
| (READ(TOOL_SENSOR5_PIN) << 4) |
|
|
| (READ(TOOL_SENSOR5_PIN) << 4) |
|
|
#endif |
|
|
#endif |
|
|
#if PIN_EXISTS(TOOL_SENSOR6) |
|
|
#if PIN_EXISTS(TOOL_SENSOR6) |
|
|
| (READ(TOOL_SENSOR6_PIN) << 5) |
|
|
| (READ(TOOL_SENSOR6_PIN) << 5) |
|
|
#endif |
|
|
#endif |
|
|
#if PIN_EXISTS(TOOL_SENSOR7) |
|
|
#if PIN_EXISTS(TOOL_SENSOR7) |
|
|
| (READ(TOOL_SENSOR7_PIN) << 6) |
|
|
| (READ(TOOL_SENSOR7_PIN) << 6) |
|
|
#endif |
|
|
#endif |
|
|
#if PIN_EXISTS(TOOL_SENSOR8) |
|
|
#if PIN_EXISTS(TOOL_SENSOR8) |
|
|
| (READ(TOOL_SENSOR8_PIN) << 7) |
|
|
| (READ(TOOL_SENSOR8_PIN) << 7) |
|
|
|
|
|
#endif |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if ENABLED(TOOL_SENSOR) |
|
|
uint8_t check_tool_sensor_stats(const uint8_t tool_index, const bool kill_on_error/*=false*/, const bool disable/*=false*/) { |
|
|
|
|
|
static uint8_t sensor_tries; // = 0
|
|
|
bool tool_sensor_disabled; // = false
|
|
|
for (;;) { |
|
|
|
|
|
if (poll_tool_sensor_pins() == _BV(tool_index)) { |
|
|
uint8_t check_tool_sensor_stats(const uint8_t tool_index, const bool kill_on_error/*=false*/, const bool disable/*=false*/) { |
|
|
sensor_tries = 0; |
|
|
static uint8_t sensor_tries; // = 0
|
|
|
return tool_index; |
|
|
for (;;) { |
|
|
} |
|
|
if (poll_tool_sensor_pins() == _BV(tool_index)) { |
|
|
else if (kill_on_error && (!tool_sensor_disabled || disable)) { |
|
|
sensor_tries = 0; |
|
|
sensor_tries++; |
|
|
return tool_index; |
|
|
if (sensor_tries > 10) kill(F("Tool Sensor error")); |
|
|
} |
|
|
safe_delay(5); |
|
|
else if (kill_on_error && (!tool_sensor_disabled || disable)) { |
|
|
} |
|
|
sensor_tries++; |
|
|
else { |
|
|
if (sensor_tries > 10) kill(F("Tool Sensor error")); |
|
|
sensor_tries++; |
|
|
safe_delay(5); |
|
|
if (sensor_tries > 10) return -1; |
|
|
} |
|
|
safe_delay(5); |
|
|
else { |
|
|
|
|
|
sensor_tries++; |
|
|
|
|
|
if (sensor_tries > 10) return -1; |
|
|
|
|
|
safe_delay(5); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
inline void switching_toolhead_lock(const bool locked) { |
|
|
inline void switching_toolhead_lock(const bool locked) { |
|
|
#ifdef SWITCHING_TOOLHEAD_SERVO_ANGLES |
|
|
#ifdef SWITCHING_TOOLHEAD_SERVO_ANGLES |
|
@ -496,9 +490,13 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0. |
|
|
switching_toolhead_lock(true); |
|
|
switching_toolhead_lock(true); |
|
|
} |
|
|
} |
|
|
LCD_MESSAGE_F("TC Success"); |
|
|
LCD_MESSAGE_F("TC Success"); |
|
|
#endif |
|
|
#endif // TOOL_SENSOR
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif // TOOL_SENSOR
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(SWITCHING_TOOLHEAD) |
|
|
|
|
|
|
|
|
inline void switching_toolhead_tool_change(const uint8_t new_tool, bool no_move/*=false*/) { |
|
|
inline void switching_toolhead_tool_change(const uint8_t new_tool, bool no_move/*=false*/) { |
|
|
if (no_move) return; |
|
|
if (no_move) return; |
|
|
|
|
|
|
|
|