🎨 Clean up tool change with tool sensor

This commit is contained in:
Scott Lahteine 2022-03-22 20:31:36 -05:00
parent e458aa41fc
commit 8ba6e8a74d

View file

@ -385,12 +385,13 @@ 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
@ -415,14 +416,9 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
#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)
bool tool_sensor_disabled; // = false
uint8_t check_tool_sensor_stats(const uint8_t tool_index, const bool kill_on_error/*=false*/, const bool disable/*=false*/) { 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 static uint8_t sensor_tries; // = 0
for (;;) { for (;;) {
@ -443,8 +439,6 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
} }
} }
#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
const uint16_t swt_angles[2] = SWITCHING_TOOLHEAD_SERVO_ANGLES; const uint16_t swt_angles[2] = 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;