Extend M217 with configurable park/raise (#12076)

This commit is contained in:
Scott Lahteine
2018-10-13 23:08:20 -05:00
committed by GitHub
parent ea13a77dcb
commit 951b25163e
87 changed files with 241 additions and 291 deletions

View File

@ -1836,6 +1836,10 @@ void MarlinSettings::reset(PORTARG_SOLO) {
sn_settings.swap_length = SINGLENOZZLE_SWAP_LENGTH;
sn_settings.prime_speed = SINGLENOZZLE_SWAP_PRIME_SPEED;
sn_settings.retract_speed = SINGLENOZZLE_SWAP_RETRACT_SPEED;
sn_settings.z_raise = SINGLENOZZLE_TOOLCHANGE_ZRAISE;
#if ENABLED(SINGLENOZZLE_SWAP_PARK)
sn_settings.change_point = SINGLENOZZLE_TOOLCHANGE_XY;
#endif
#endif
//
@ -2096,15 +2100,11 @@ void MarlinSettings::reset(PORTARG_SOLO) {
*/
CONFIG_ECHO_START;
#if ENABLED(INCH_MODE_SUPPORT)
#define LINEAR_UNIT(N) (float(N) / parser.linear_unit_factor)
#define VOLUMETRIC_UNIT(N) (float(N) / (parser.volumetric_enabled ? parser.volumetric_unit_factor : parser.linear_unit_factor))
SERIAL_ECHOPGM_P(port, " G2");
SERIAL_CHAR_P(port, parser.linear_unit_factor == 1.0 ? '1' : '0');
SERIAL_ECHOPGM_P(port, " ;");
SAY_UNITS_P(port, false);
#else
#define LINEAR_UNIT(N) (N)
#define VOLUMETRIC_UNIT(N) (N)
SERIAL_ECHOPGM_P(port, " G21 ; Units in mm");
SAY_UNITS_P(port, false);
#endif
@ -2116,13 +2116,11 @@ void MarlinSettings::reset(PORTARG_SOLO) {
CONFIG_ECHO_START;
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
#define TEMP_UNIT(N) parser.to_temp_units(N)
SERIAL_ECHOPGM_P(port, " M149 ");
SERIAL_CHAR_P(port, parser.temp_units_code());
SERIAL_ECHOPGM_P(port, " ; Units in ");
serialprintPGM_P(port, parser.temp_units_name());
#else
#define TEMP_UNIT(N) (N)
SERIAL_ECHOLNPGM_P(port, " M149 C ; Units in Celsius");
#endif

View File

@ -155,6 +155,14 @@ void do_blocking_move_to_x(const float &rx, const float &fr_mm_s=0);
void do_blocking_move_to_z(const float &rz, const float &fr_mm_s=0);
void do_blocking_move_to_xy(const float &rx, const float &ry, const float &fr_mm_s=0);
FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZ], const float &fr_mm_s) {
do_blocking_move_to(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], fr_mm_s);
}
FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZE], const float &fr_mm_s) {
do_blocking_move_to(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], fr_mm_s);
}
void setup_for_endstop_or_probe_move();
void clean_up_after_endstop_or_probe_move();

View File

@ -94,10 +94,6 @@ float zprobe_zoffset; // Initialized by settings.load()
#elif ENABLED(Z_PROBE_ALLEN_KEY)
FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZ], const float &fr_mm_s) {
do_blocking_move_to(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], fr_mm_s);
}
void run_deploy_moves_script() {
#if defined(Z_PROBE_ALLEN_KEY_DEPLOY_1_X) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_1_Y) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_1_Z)
#ifndef Z_PROBE_ALLEN_KEY_DEPLOY_1_X

View File

@ -35,10 +35,6 @@
#if FAN_COUNT > 0
uint8_t singlenozzle_fan_speed[EXTRUDERS];
#endif
#if ENABLED(SINGLENOZZLE_SWAP_PARK)
#include "../libs/point_t.h"
const point_t singlenozzle_change_point = SINGLENOZZLE_TOOLCHANGE_POSITION;
#endif
#endif
#if ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0
@ -659,8 +655,6 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
fan_speed[0] = singlenozzle_fan_speed[tmp_extruder];
#endif
if (!no_move) set_destination_from_current();
if (sn_settings.swap_length) {
#if ENABLED(ADVANCED_PAUSE_FEATURE)
do_pause_e_move(-sn_settings.swap_length, MMM_TO_MMS(sn_settings.retract_speed));
@ -670,22 +664,26 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
#endif
}
if (!no_move) {
current_position[Z_AXIS] += (
#if ENABLED(SINGLENOZZLE_SWAP_PARK)
singlenozzle_change_point.z
#else
SINGLENOZZLE_TOOLCHANGE_ZRAISE
#endif
);
constexpr float snfr =
#if ENABLED(SINGLENOZZLE_SWAP_PARK)
MMM_TO_MMS(SINGLENOZZLE_PARK_XY_FEEDRATE);
#else
0
#endif
;
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder);
float old_pos[XYZ];
if (!no_move) {
COPY(old_pos, current_position);
#if ENABLED(SINGLENOZZLE_SWAP_PARK)
current_position[X_AXIS] = singlenozzle_change_point.x;
current_position[Y_AXIS] = singlenozzle_change_point.y;
planner.buffer_line(current_position, MMM_TO_MMS(SINGLENOZZLE_PARK_XY_FEEDRATE), active_extruder);
current_position[X_AXIS] = sn_settings.change_point.x;
current_position[Y_AXIS] = sn_settings.change_point.y;
#endif
current_position[Z_AXIS] += sn_settings.z_raise;
do_blocking_move_to(current_position, snfr);
}
singlenozzle_temp[active_extruder] = thermalManager.target_temperature[0];
@ -708,15 +706,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
#endif
}
if (!no_move) {
#if ENABLED(SINGLENOZZLE_SWAP_PARK)
current_position[X_AXIS] = destination[X_AXIS];
current_position[Y_AXIS] = destination[Y_AXIS];
planner.buffer_line(current_position, MMM_TO_MMS(SINGLENOZZLE_PARK_XY_FEEDRATE), active_extruder);
#endif
do_blocking_move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS]);
}
if (!no_move) do_blocking_move_to(old_pos, snfr);
#elif EXTRUDERS > 1

View File

@ -52,6 +52,10 @@
typedef struct {
float swap_length;
int16_t prime_speed, retract_speed;
#if ENABLED(SINGLENOZZLE_SWAP_PARK)
struct { float x, y; } change_point;
#endif
float z_raise;
} singlenozzle_settings_t;
extern singlenozzle_settings_t sn_settings;
extern uint16_t singlenozzle_temp[EXTRUDERS];