Marlin update
This commit is contained in:
@@ -73,7 +73,7 @@
|
||||
current_position.set(0.0, 0.0);
|
||||
sync_plan_position();
|
||||
|
||||
const int x_axis_home_dir = x_home_dir(active_extruder);
|
||||
const int x_axis_home_dir = TOOL_X_HOME_DIR(active_extruder);
|
||||
|
||||
const float mlx = max_length(X_AXIS),
|
||||
mly = max_length(Y_AXIS),
|
||||
@@ -220,7 +220,7 @@ void GcodeSuite::G28() {
|
||||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
if (parser.seen_test('S')) {
|
||||
LOOP_XYZ(a) set_axis_is_at_home((AxisEnum)a);
|
||||
LOOP_LINEAR_AXES(a) set_axis_is_at_home((AxisEnum)a);
|
||||
sync_plan_position();
|
||||
SERIAL_ECHOLNPGM("Simulated Homing");
|
||||
report_current_position();
|
||||
|
||||
@@ -347,7 +347,7 @@ static float auto_tune_a() {
|
||||
abc_float_t delta_e = { 0.0f }, delta_t = { 0.0f };
|
||||
|
||||
delta_t.reset();
|
||||
LOOP_XYZ(axis) {
|
||||
LOOP_LINEAR_AXES(axis) {
|
||||
delta_t[axis] = diff;
|
||||
calc_kinematics_diff_probe_points(z_pt, delta_e, delta_r, delta_t);
|
||||
delta_t[axis] = 0;
|
||||
@@ -525,7 +525,7 @@ void GcodeSuite::G33() {
|
||||
|
||||
case 1:
|
||||
test_precision = 0.0f; // forced end
|
||||
LOOP_XYZ(axis) e_delta[axis] = +Z4(CEN);
|
||||
LOOP_LINEAR_AXES(axis) e_delta[axis] = +Z4(CEN);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
@@ -573,14 +573,14 @@ void GcodeSuite::G33() {
|
||||
// Normalize angles to least-squares
|
||||
if (_angle_results) {
|
||||
float a_sum = 0.0f;
|
||||
LOOP_XYZ(axis) a_sum += delta_tower_angle_trim[axis];
|
||||
LOOP_XYZ(axis) delta_tower_angle_trim[axis] -= a_sum / 3.0f;
|
||||
LOOP_LINEAR_AXES(axis) a_sum += delta_tower_angle_trim[axis];
|
||||
LOOP_LINEAR_AXES(axis) delta_tower_angle_trim[axis] -= a_sum / 3.0f;
|
||||
}
|
||||
|
||||
// adjust delta_height and endstops by the max amount
|
||||
const float z_temp = _MAX(delta_endstop_adj.a, delta_endstop_adj.b, delta_endstop_adj.c);
|
||||
delta_height -= z_temp;
|
||||
LOOP_XYZ(axis) delta_endstop_adj[axis] -= z_temp;
|
||||
LOOP_LINEAR_AXES(axis) delta_endstop_adj[axis] -= z_temp;
|
||||
}
|
||||
recalc_delta_settings();
|
||||
NOMORE(zero_std_dev_min, zero_std_dev);
|
||||
|
||||
@@ -194,16 +194,20 @@ float measuring_movement(const AxisEnum axis, const int dir, const bool stop_sta
|
||||
inline float measure(const AxisEnum axis, const int dir, const bool stop_state, float * const backlash_ptr, const float uncertainty) {
|
||||
const bool fast = uncertainty == CALIBRATION_MEASUREMENT_UNKNOWN;
|
||||
|
||||
// Save position
|
||||
destination = current_position;
|
||||
const float start_pos = destination[axis];
|
||||
// Save the current position of the specified axis
|
||||
const float start_pos = current_position[axis];
|
||||
|
||||
// Take a measurement. Only the specified axis will be affected.
|
||||
const float measured_pos = measuring_movement(axis, dir, stop_state, fast);
|
||||
|
||||
// Measure backlash
|
||||
if (backlash_ptr && !fast) {
|
||||
const float release_pos = measuring_movement(axis, -dir, !stop_state, fast);
|
||||
*backlash_ptr = ABS(release_pos - measured_pos);
|
||||
}
|
||||
// Return to starting position
|
||||
|
||||
// Move back to the starting position
|
||||
destination = current_position;
|
||||
destination[axis] = start_pos;
|
||||
do_blocking_move_to(destination, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL));
|
||||
return measured_pos;
|
||||
@@ -235,12 +239,12 @@ inline void probe_side(measurements_t &m, const float uncertainty, const side_t
|
||||
}
|
||||
#endif
|
||||
#if AXIS_CAN_CALIBRATE(X)
|
||||
case RIGHT: dir = -1;
|
||||
case LEFT: axis = X_AXIS; break;
|
||||
case RIGHT: axis = X_AXIS; dir = -1; break;
|
||||
#endif
|
||||
#if AXIS_CAN_CALIBRATE(Y)
|
||||
case BACK: dir = -1;
|
||||
case FRONT: axis = Y_AXIS; break;
|
||||
case BACK: axis = Y_AXIS; dir = -1; break;
|
||||
#endif
|
||||
default: return;
|
||||
}
|
||||
@@ -303,16 +307,8 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
|
||||
|
||||
// The difference between the known and the measured location
|
||||
// of the calibration object is the positional error
|
||||
m.pos_error.x = (0
|
||||
#if HAS_X_CENTER
|
||||
+ true_center.x - m.obj_center.x
|
||||
#endif
|
||||
);
|
||||
m.pos_error.y = (0
|
||||
#if HAS_Y_CENTER
|
||||
+ true_center.y - m.obj_center.y
|
||||
#endif
|
||||
);
|
||||
m.pos_error.x = TERN0(HAS_X_CENTER, true_center.x - m.obj_center.x);
|
||||
m.pos_error.y = TERN0(HAS_Y_CENTER, true_center.y - m.obj_center.y);
|
||||
m.pos_error.z = true_center.z - m.obj_center.z;
|
||||
}
|
||||
|
||||
@@ -589,12 +585,12 @@ void GcodeSuite::G425() {
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
|
||||
measurements_t m;
|
||||
float uncertainty = parser.seenval('U') ? parser.value_float() : CALIBRATION_MEASUREMENT_UNCERTAIN;
|
||||
const float uncertainty = parser.floatval('U', CALIBRATION_MEASUREMENT_UNCERTAIN);
|
||||
|
||||
if (parser.seen('B'))
|
||||
if (parser.seen_test('B'))
|
||||
calibrate_backlash(m, uncertainty);
|
||||
else if (parser.seen('T'))
|
||||
calibrate_toolhead(m, uncertainty, parser.has_value() ? parser.value_int() : active_extruder);
|
||||
else if (parser.seen_test('T'))
|
||||
calibrate_toolhead(m, uncertainty, parser.intval('T', active_extruder));
|
||||
#if ENABLED(CALIBRATION_REPORTING)
|
||||
else if (parser.seen('V')) {
|
||||
probe_sides(m, uncertainty);
|
||||
|
||||
@@ -55,8 +55,8 @@ void GcodeSuite::M425() {
|
||||
}
|
||||
};
|
||||
|
||||
LOOP_XYZ(a) {
|
||||
if (axis_can_calibrate(a) && parser.seen(XYZ_CHAR(a))) {
|
||||
LOOP_LINEAR_AXES(a) {
|
||||
if (axis_can_calibrate(a) && parser.seen(AXIS_CHAR(a))) {
|
||||
planner.synchronize();
|
||||
backlash.distance_mm[a] = parser.has_value() ? parser.value_linear_units() : backlash.get_measurement(AxisEnum(a));
|
||||
noArgs = false;
|
||||
@@ -83,8 +83,8 @@ void GcodeSuite::M425() {
|
||||
SERIAL_ECHOLNPGM("active:");
|
||||
SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", backlash.get_correction(), " (F1.0 = full, F0.0 = none)");
|
||||
SERIAL_ECHOPGM(" Backlash Distance (mm): ");
|
||||
LOOP_XYZ(a) if (axis_can_calibrate(a)) {
|
||||
SERIAL_CHAR(' ', XYZ_CHAR(a));
|
||||
LOOP_LINEAR_AXES(a) if (axis_can_calibrate(a)) {
|
||||
SERIAL_CHAR(' ', AXIS_CHAR(a));
|
||||
SERIAL_ECHO(backlash.distance_mm[a]);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
@@ -96,8 +96,8 @@ void GcodeSuite::M425() {
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
SERIAL_ECHOPGM(" Average measured backlash (mm):");
|
||||
if (backlash.has_any_measurement()) {
|
||||
LOOP_XYZ(a) if (axis_can_calibrate(a) && backlash.has_measurement(AxisEnum(a))) {
|
||||
SERIAL_CHAR(' ', XYZ_CHAR(a));
|
||||
LOOP_LINEAR_AXES(a) if (axis_can_calibrate(a) && backlash.has_measurement(AxisEnum(a))) {
|
||||
SERIAL_CHAR(' ', AXIS_CHAR(a));
|
||||
SERIAL_ECHO(backlash.get_measurement(AxisEnum(a)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,11 +39,11 @@
|
||||
*/
|
||||
void GcodeSuite::M666() {
|
||||
DEBUG_SECTION(log_M666, "M666", DEBUGGING(LEVELING));
|
||||
LOOP_XYZ(i) {
|
||||
if (parser.seen(XYZ_CHAR(i))) {
|
||||
LOOP_LINEAR_AXES(i) {
|
||||
if (parser.seen(AXIS_CHAR(i))) {
|
||||
const float v = parser.value_linear_units();
|
||||
if (v * Z_HOME_DIR <= 0) delta_endstop_adj[i] = v;
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("delta_endstop_adj[", AS_CHAR(XYZ_CHAR(i)), "] = ", delta_endstop_adj[i]);
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("delta_endstop_adj[", AS_CHAR(AXIS_CHAR(i)), "] = ", delta_endstop_adj[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ void GcodeSuite::M852() {
|
||||
|
||||
// When skew is changed the current position changes
|
||||
if (setval) {
|
||||
set_current_from_steppers_for_axis(ALL_AXES);
|
||||
set_current_from_steppers_for_axis(ALL_AXES_ENUM);
|
||||
sync_plan_position();
|
||||
report_current_position();
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@ void GcodeSuite::M201() {
|
||||
if (parser.seenval('G')) planner.xy_freq_min_speed_factor = constrain(parser.value_float(), 1, 100) / 100;
|
||||
#endif
|
||||
|
||||
LOOP_XYZE(i) {
|
||||
if (parser.seen(axis_codes[i])) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
const uint8_t a = (i == E_AXIS ? uint8_t(E_AXIS_N(target_extruder)) : i);
|
||||
planner.set_max_acceleration(a, parser.value_axis_units((AxisEnum)a));
|
||||
}
|
||||
@@ -104,8 +104,8 @@ void GcodeSuite::M203() {
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
|
||||
LOOP_XYZE(i)
|
||||
if (parser.seen(axis_codes[i])) {
|
||||
LOOP_LOGICAL_AXES(i)
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
const uint8_t a = (i == E_AXIS ? uint8_t(E_AXIS_N(target_extruder)) : i);
|
||||
planner.set_max_feedrate(a, parser.value_axis_units((AxisEnum)a));
|
||||
}
|
||||
@@ -147,24 +147,14 @@ void GcodeSuite::M204() {
|
||||
* J = Junction Deviation (mm) (If not using CLASSIC_JERK)
|
||||
*/
|
||||
void GcodeSuite::M205() {
|
||||
#if HAS_JUNCTION_DEVIATION
|
||||
#define J_PARAM "J"
|
||||
#else
|
||||
#define J_PARAM
|
||||
#endif
|
||||
#if HAS_CLASSIC_JERK
|
||||
#define XYZE_PARAM "XYZE"
|
||||
#else
|
||||
#define XYZE_PARAM
|
||||
#endif
|
||||
if (!parser.seen("BST" J_PARAM XYZE_PARAM)) return;
|
||||
if (!parser.seen("BST" TERN_(HAS_JUNCTION_DEVIATION, "J") TERN_(HAS_CLASSIC_JERK, "XYZE"))) return;
|
||||
|
||||
//planner.synchronize();
|
||||
if (parser.seen('B')) planner.settings.min_segment_time_us = parser.value_ulong();
|
||||
if (parser.seen('S')) planner.settings.min_feedrate_mm_s = parser.value_linear_units();
|
||||
if (parser.seen('T')) planner.settings.min_travel_feedrate_mm_s = parser.value_linear_units();
|
||||
if (parser.seenval('B')) planner.settings.min_segment_time_us = parser.value_ulong();
|
||||
if (parser.seenval('S')) planner.settings.min_feedrate_mm_s = parser.value_linear_units();
|
||||
if (parser.seenval('T')) planner.settings.min_travel_feedrate_mm_s = parser.value_linear_units();
|
||||
#if HAS_JUNCTION_DEVIATION
|
||||
if (parser.seen('J')) {
|
||||
if (parser.seenval('J')) {
|
||||
const float junc_dev = parser.value_linear_units();
|
||||
if (WITHIN(junc_dev, 0.01f, 0.3f)) {
|
||||
planner.junction_deviation_mm = junc_dev;
|
||||
@@ -175,9 +165,9 @@ void GcodeSuite::M205() {
|
||||
}
|
||||
#endif
|
||||
#if HAS_CLASSIC_JERK
|
||||
if (parser.seen('X')) planner.set_max_jerk(X_AXIS, parser.value_linear_units());
|
||||
if (parser.seen('Y')) planner.set_max_jerk(Y_AXIS, parser.value_linear_units());
|
||||
if (parser.seen('Z')) {
|
||||
if (parser.seenval('X')) planner.set_max_jerk(X_AXIS, parser.value_linear_units());
|
||||
if (parser.seenval('Y')) planner.set_max_jerk(Y_AXIS, parser.value_linear_units());
|
||||
if (parser.seenval('Z')) {
|
||||
planner.set_max_jerk(Z_AXIS, parser.value_linear_units());
|
||||
#if HAS_MESH && DISABLED(LIMITED_JERK_EDITING)
|
||||
if (planner.max_jerk.z <= 0.1f)
|
||||
@@ -185,7 +175,7 @@ void GcodeSuite::M205() {
|
||||
#endif
|
||||
}
|
||||
#if HAS_CLASSIC_E_JERK
|
||||
if (parser.seen('E')) planner.set_max_jerk(E_AXIS, parser.value_linear_units());
|
||||
if (parser.seenval('E')) planner.set_max_jerk(E_AXIS, parser.value_linear_units());
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "../gcode.h"
|
||||
#include "../../module/planner.h"
|
||||
|
||||
#if EXTRUDERS
|
||||
#if HAS_EXTRUDERS
|
||||
|
||||
/**
|
||||
* M221: Set extrusion percentage (M221 T0 S95)
|
||||
|
||||
@@ -42,7 +42,7 @@ void report_M92(const bool echo=true, const int8_t e=-1) {
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED_E(e);
|
||||
UNUSED(e);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,13 +64,10 @@ void GcodeSuite::M92() {
|
||||
if (target_extruder < 0) return;
|
||||
|
||||
// No arguments? Show M92 report.
|
||||
if (!parser.seen("XYZE"
|
||||
#if ENABLED(MAGIC_NUMBERS_GCODE)
|
||||
"HL"
|
||||
#endif
|
||||
)) return report_M92(true, target_extruder);
|
||||
if (!parser.seen("XYZE" TERN_(MAGIC_NUMBERS_GCODE, "HL")))
|
||||
return report_M92(true, target_extruder);
|
||||
|
||||
LOOP_XYZE(i) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
if (i == E_AXIS) {
|
||||
const float value = parser.value_per_axis_units((AxisEnum)(E_AXIS_N(target_extruder)));
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
*/
|
||||
void GcodeSuite::M17() {
|
||||
if (parser.seen("XYZE")) {
|
||||
if (parser.seen('X')) ENABLE_AXIS_X();
|
||||
if (parser.seen('Y')) ENABLE_AXIS_Y();
|
||||
if (parser.seen('Z')) ENABLE_AXIS_Z();
|
||||
if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen('E'))) enable_e_steppers();
|
||||
if (parser.seen_test('X')) ENABLE_AXIS_X();
|
||||
if (parser.seen_test('Y')) ENABLE_AXIS_Y();
|
||||
if (parser.seen_test('Z')) ENABLE_AXIS_Z();
|
||||
if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen_test('E'))) enable_e_steppers();
|
||||
}
|
||||
else {
|
||||
LCD_MESSAGEPGM(MSG_NO_MOVE);
|
||||
@@ -56,10 +56,10 @@ void GcodeSuite::M18_M84() {
|
||||
else {
|
||||
if (parser.seen("XYZE")) {
|
||||
planner.synchronize();
|
||||
if (parser.seen('X')) DISABLE_AXIS_X();
|
||||
if (parser.seen('Y')) DISABLE_AXIS_Y();
|
||||
if (parser.seen('Z')) DISABLE_AXIS_Z();
|
||||
if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen('E'))) disable_e_steppers();
|
||||
if (parser.seen_test('X')) DISABLE_AXIS_X();
|
||||
if (parser.seen_test('Y')) DISABLE_AXIS_Y();
|
||||
if (parser.seen_test('Z')) DISABLE_AXIS_Z();
|
||||
if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen_test('E'))) disable_e_steppers();
|
||||
}
|
||||
else
|
||||
planner.finish_and_disable();
|
||||
|
||||
@@ -39,8 +39,8 @@ void GcodeSuite::M211() {
|
||||
SERIAL_ECHOPGM(STR_SOFT_ENDSTOPS);
|
||||
if (parser.seen('S')) soft_endstop._enabled = parser.value_bool();
|
||||
serialprint_onoff(soft_endstop._enabled);
|
||||
print_xyz(l_soft_min, PSTR(STR_SOFT_MIN), PSTR(" "));
|
||||
print_xyz(l_soft_max, PSTR(STR_SOFT_MAX));
|
||||
print_pos(l_soft_min, PSTR(STR_SOFT_MIN), PSTR(" "));
|
||||
print_pos(l_soft_max, PSTR(STR_SOFT_MAX));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
*/
|
||||
void GcodeSuite::M350() {
|
||||
if (parser.seen('S')) LOOP_LE_N(i, 4) stepper.microstep_mode(i, parser.value_byte());
|
||||
LOOP_XYZE(i) if (parser.seen(axis_codes[i])) stepper.microstep_mode(i, parser.value_byte());
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seen(axis_codes[i])) stepper.microstep_mode(i, parser.value_byte());
|
||||
if (parser.seen('B')) stepper.microstep_mode(4, parser.value_byte());
|
||||
stepper.microstep_readings();
|
||||
}
|
||||
@@ -46,15 +46,15 @@ void GcodeSuite::M350() {
|
||||
void GcodeSuite::M351() {
|
||||
if (parser.seenval('S')) switch (parser.value_byte()) {
|
||||
case 1:
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, parser.value_byte(), -1, -1);
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, parser.value_byte(), -1, -1);
|
||||
if (parser.seenval('B')) stepper.microstep_ms(4, parser.value_byte(), -1, -1);
|
||||
break;
|
||||
case 2:
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, parser.value_byte(), -1);
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, parser.value_byte(), -1);
|
||||
if (parser.seenval('B')) stepper.microstep_ms(4, -1, parser.value_byte(), -1);
|
||||
break;
|
||||
case 3:
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, -1, parser.value_byte());
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, -1, parser.value_byte());
|
||||
if (parser.seenval('B')) stepper.microstep_ms(4, -1, -1, parser.value_byte());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
|
||||
HOTEND_LOOP() {
|
||||
DEBUG_ECHOPAIR_P(SP_T_STR, e);
|
||||
LOOP_XYZ(a) DEBUG_ECHOPAIR(" hotend_offset[", e, "].", AS_CHAR(XYZ_CHAR(a) | 0x20), "=", hotend_offset[e][a]);
|
||||
LOOP_LINEAR_AXES(a) DEBUG_ECHOPAIR(" hotend_offset[", e, "].", AS_CHAR(AXIS_CHAR(a) | 0x20), "=", hotend_offset[e][a]);
|
||||
DEBUG_EOL();
|
||||
}
|
||||
DEBUG_EOL();
|
||||
|
||||
@@ -234,7 +234,7 @@ void GcodeSuite::M906() {
|
||||
const uint8_t index = parser.byteval('I');
|
||||
#endif
|
||||
|
||||
LOOP_XYZE(i) if (uint16_t value = parser.intval(axis_codes[i])) {
|
||||
LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(axis_codes[i])) {
|
||||
|
||||
report_current = false;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
void GcodeSuite::M907() {
|
||||
#if HAS_MOTOR_CURRENT_SPI
|
||||
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.set_digipot_current(i, parser.value_int());
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.set_digipot_current(i, parser.value_int());
|
||||
if (parser.seenval('B')) stepper.set_digipot_current(4, parser.value_int());
|
||||
if (parser.seenval('S')) LOOP_LE_N(i, 4) stepper.set_digipot_current(i, parser.value_int());
|
||||
|
||||
@@ -64,7 +64,7 @@ void GcodeSuite::M907() {
|
||||
|
||||
#if HAS_MOTOR_CURRENT_I2C
|
||||
// this one uses actual amps in floating point
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) digipot_i2c.set_current(i, parser.value_float());
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) digipot_i2c.set_current(i, parser.value_float());
|
||||
// Additional extruders use B,C,D for channels 4,5,6.
|
||||
// TODO: Change these parameters because 'E' is used. B<index>?
|
||||
for (uint8_t i = E_AXIS + 1; i < DIGIPOT_I2C_NUM_CHANNELS; i++)
|
||||
@@ -76,7 +76,7 @@ void GcodeSuite::M907() {
|
||||
const float dac_percent = parser.value_float();
|
||||
LOOP_LE_N(i, 4) stepper_dac.set_current_percent(i, dac_percent);
|
||||
}
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper_dac.set_current_percent(i, parser.value_float());
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper_dac.set_current_percent(i, parser.value_float());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -71,11 +71,11 @@ void GcodeSuite::G61(void) {
|
||||
else {
|
||||
if (parser.seen("XYZ")) {
|
||||
DEBUG_ECHOPAIR(STR_RESTORING_POS " S", slot);
|
||||
LOOP_XYZ(i) {
|
||||
destination[i] = parser.seen(XYZ_CHAR(i))
|
||||
LOOP_LINEAR_AXES(i) {
|
||||
destination[i] = parser.seen(AXIS_CHAR(i))
|
||||
? stored_position[slot][i] + parser.value_axis_units((AxisEnum)i)
|
||||
: current_position[i];
|
||||
DEBUG_CHAR(' ', XYZ_CHAR(i));
|
||||
DEBUG_CHAR(' ', AXIS_CHAR(i));
|
||||
DEBUG_ECHO_F(destination[i]);
|
||||
}
|
||||
DEBUG_EOL();
|
||||
|
||||
@@ -32,12 +32,12 @@
|
||||
* M122: Debug TMC drivers
|
||||
*/
|
||||
void GcodeSuite::M122() {
|
||||
xyze_bool_t print_axis = ARRAY_N_1(XYZE, false);
|
||||
xyze_bool_t print_axis = ARRAY_N_1(LOGICAL_AXES, false);
|
||||
|
||||
bool print_all = true;
|
||||
LOOP_XYZE(i) if (parser.seen(axis_codes[i])) { print_axis[i] = true; print_all = false; }
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seen(axis_codes[i])) { print_axis[i] = true; print_all = false; }
|
||||
|
||||
if (print_all) LOOP_XYZE(i) print_axis[i] = true;
|
||||
if (print_all) LOOP_LOGICAL_AXES(i) print_axis[i] = true;
|
||||
|
||||
if (parser.boolval('I')) restore_stepper_drivers();
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ static void set_stealth_status(const bool enable, const int8_t target_extruder)
|
||||
const uint8_t index = parser.byteval('I');
|
||||
#endif
|
||||
|
||||
LOOP_XYZE(i) if (parser.seen(axis_codes[i])) {
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seen(axis_codes[i])) {
|
||||
switch (i) {
|
||||
case X_AXIS:
|
||||
#if AXIS_HAS_STEALTHCHOP(X)
|
||||
|
||||
@@ -52,7 +52,7 @@ void GcodeSuite::M906() {
|
||||
const uint8_t index = parser.byteval('I');
|
||||
#endif
|
||||
|
||||
LOOP_XYZE(i) if (uint16_t value = parser.intval(axis_codes[i])) {
|
||||
LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(axis_codes[i])) {
|
||||
report = false;
|
||||
switch (i) {
|
||||
case X_AXIS:
|
||||
|
||||
@@ -35,10 +35,19 @@
|
||||
#define M91x_USE(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2208) || AXIS_DRIVER_TYPE(ST, TMC2209) || AXIS_DRIVER_TYPE(ST, TMC2660) || AXIS_DRIVER_TYPE(ST, TMC5130) || AXIS_DRIVER_TYPE(ST, TMC5160))
|
||||
#define M91x_USE_E(N) (E_STEPPERS > N && M91x_USE(E##N))
|
||||
|
||||
#define M91x_SOME_X (M91x_USE(X) || M91x_USE(X2))
|
||||
#define M91x_SOME_Y (M91x_USE(Y) || M91x_USE(Y2))
|
||||
#define M91x_SOME_Z (M91x_USE(Z) || M91x_USE(Z2) || M91x_USE(Z3) || M91x_USE(Z4))
|
||||
#define M91x_SOME_E (M91x_USE_E(0) || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4) || M91x_USE_E(5) || M91x_USE_E(6) || M91x_USE_E(7))
|
||||
#if M91x_USE(X) || M91x_USE(X2)
|
||||
#define M91x_SOME_X 1
|
||||
#endif
|
||||
#if M91x_USE(Y) || M91x_USE(Y2)
|
||||
#define M91x_SOME_Y 1
|
||||
#endif
|
||||
#if M91x_USE(Z) || M91x_USE(Z2) || M91x_USE(Z3) || M91x_USE(Z4)
|
||||
#define M91x_SOME_Z 1
|
||||
#endif
|
||||
|
||||
#if M91x_USE_E(0) || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4) || M91x_USE_E(5) || M91x_USE_E(6) || M91x_USE_E(7)
|
||||
#define M91x_SOME_E 1
|
||||
#endif
|
||||
|
||||
#if !M91x_SOME_X && !M91x_SOME_Y && !M91x_SOME_Z && !M91x_SOME_E
|
||||
#error "MONITOR_DRIVER_STATUS requires at least one TMC2130, 2160, 2208, 2209, 2660, 5130, or 5160."
|
||||
@@ -112,31 +121,12 @@
|
||||
* M912 E1 ; clear E1 only
|
||||
*/
|
||||
void GcodeSuite::M912() {
|
||||
#if M91x_SOME_X
|
||||
const bool hasX = parser.seen(axis_codes.x);
|
||||
#else
|
||||
constexpr bool hasX = false;
|
||||
#endif
|
||||
const bool hasX = TERN0(M91x_SOME_X, parser.seen(axis_codes.x)),
|
||||
hasY = TERN0(M91x_SOME_Y, parser.seen(axis_codes.y)),
|
||||
hasZ = TERN0(M91x_SOME_Z, parser.seen(axis_codes.z)),
|
||||
hasE = TERN0(M91x_SOME_E, parser.seen(axis_codes.e));
|
||||
|
||||
#if M91x_SOME_Y
|
||||
const bool hasY = parser.seen(axis_codes.y);
|
||||
#else
|
||||
constexpr bool hasY = false;
|
||||
#endif
|
||||
|
||||
#if M91x_SOME_Z
|
||||
const bool hasZ = parser.seen(axis_codes.z);
|
||||
#else
|
||||
constexpr bool hasZ = false;
|
||||
#endif
|
||||
|
||||
#if M91x_SOME_E
|
||||
const bool hasE = parser.seen(axis_codes.e);
|
||||
#else
|
||||
constexpr bool hasE = false;
|
||||
#endif
|
||||
|
||||
const bool hasNone = !hasX && !hasY && !hasZ && !hasE;
|
||||
const bool hasNone = !hasE && !hasX && !hasY && !hasZ;
|
||||
|
||||
#if M91x_SOME_X
|
||||
const int8_t xval = int8_t(parser.byteval(axis_codes.x, 0xFF));
|
||||
@@ -219,7 +209,7 @@
|
||||
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z) || AXIS_IS_TMC(Z2) || AXIS_IS_TMC(Z3) || AXIS_IS_TMC(Z4)
|
||||
const uint8_t index = parser.byteval('I');
|
||||
#endif
|
||||
LOOP_XYZE(i) if (int32_t value = parser.longval(axis_codes[i])) {
|
||||
LOOP_LOGICAL_AXES(i) if (int32_t value = parser.longval(axis_codes[i])) {
|
||||
report = false;
|
||||
switch (i) {
|
||||
case X_AXIS:
|
||||
@@ -348,7 +338,7 @@
|
||||
|
||||
bool report = true;
|
||||
const uint8_t index = parser.byteval('I');
|
||||
LOOP_XYZ(i) if (parser.seen(XYZ_CHAR(i))) {
|
||||
LOOP_LINEAR_AXES(i) if (parser.seen(AXIS_CHAR(i))) {
|
||||
const int16_t value = parser.value_int();
|
||||
report = false;
|
||||
switch (i) {
|
||||
|
||||
@@ -144,7 +144,7 @@ int8_t GcodeSuite::get_target_e_stepper_from_command() {
|
||||
* - Set the feedrate, if included
|
||||
*/
|
||||
void GcodeSuite::get_destination_from_command() {
|
||||
xyze_bool_t seen = { false, false, false, false };
|
||||
xyze_bool_t seen{false};
|
||||
|
||||
#if ENABLED(CANCEL_OBJECTS)
|
||||
const bool &skip_move = cancelable.skipping;
|
||||
@@ -153,8 +153,8 @@ void GcodeSuite::get_destination_from_command() {
|
||||
#endif
|
||||
|
||||
// Get new XYZ position, whether absolute or relative
|
||||
LOOP_XYZ(i) {
|
||||
if ( (seen[i] = parser.seenval(XYZ_CHAR(i))) ) {
|
||||
LOOP_LINEAR_AXES(i) {
|
||||
if ( (seen[i] = parser.seenval(AXIS_CHAR(i))) ) {
|
||||
const float v = parser.value_axis_units((AxisEnum)i);
|
||||
if (skip_move)
|
||||
destination[i] = current_position[i];
|
||||
@@ -277,7 +277,7 @@ void GcodeSuite::dwell(millis_t time) {
|
||||
*/
|
||||
void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
|
||||
|
||||
#if ENABLED(MKS_WIFI)
|
||||
serial_index_t port = queue.ring_buffer.command_port();
|
||||
DEBUG("Gcode: %c %d Port: %d",parser.command_letter,parser.codenum, port.index);
|
||||
@@ -556,7 +556,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 100: M100(); break; // M100: Free Memory Report
|
||||
#endif
|
||||
|
||||
#if EXTRUDERS
|
||||
#if HAS_EXTRUDERS
|
||||
case 104: M104(); break; // M104: Set hot end temperature
|
||||
case 109: M109(); break; // M109: Wait for hotend temperature to reach target
|
||||
#endif
|
||||
@@ -612,7 +612,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_REPORT_POSITION)
|
||||
case 154: M154(); break; // M155: Set position auto-report interval
|
||||
case 154: M154(); break; // M154: Set position auto-report interval
|
||||
#endif
|
||||
|
||||
#if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR)
|
||||
@@ -642,8 +642,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
#endif
|
||||
case 81: M81(); break; // M81: Turn off Power, including Power Supply, if possible
|
||||
|
||||
case 82: M82(); break; // M82: Set E axis normal mode (same as other axes)
|
||||
case 83: M83(); break; // M83: Set E axis relative mode
|
||||
#if HAS_EXTRUDERS
|
||||
case 82: M82(); break; // M82: Set E axis normal mode (same as other axes)
|
||||
case 83: M83(); break; // M83: Set E axis relative mode
|
||||
#endif
|
||||
case 18: case 84: M18_M84(); break; // M18/M84: Disable Steppers / Set Timeout
|
||||
case 85: M85(); break; // M85: Set inactivity stepper shutdown timeout
|
||||
case 92: M92(); break; // M92: Set the steps-per-unit for one or more axes
|
||||
@@ -730,7 +732,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
|
||||
case 220: M220(); break; // M220: Set Feedrate Percentage: S<percent> ("FR" on your LCD)
|
||||
|
||||
#if EXTRUDERS
|
||||
#if HAS_EXTRUDERS
|
||||
case 221: M221(); break; // M221: Set Flow Percentage
|
||||
#endif
|
||||
|
||||
|
||||
@@ -633,10 +633,13 @@ private:
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
static void M80();
|
||||
#endif
|
||||
|
||||
static void M81();
|
||||
static void M82();
|
||||
static void M83();
|
||||
|
||||
#if HAS_EXTRUDERS
|
||||
static void M82();
|
||||
static void M83();
|
||||
#endif
|
||||
|
||||
static void M85();
|
||||
static void M92();
|
||||
|
||||
@@ -644,9 +647,10 @@ private:
|
||||
static void M100();
|
||||
#endif
|
||||
|
||||
#if EXTRUDERS
|
||||
static void M104();
|
||||
static void M109();
|
||||
#if HAS_EXTRUDERS
|
||||
static void M104_M109(const bool isM109);
|
||||
FORCE_INLINE static void M104() { M104_M109(false); }
|
||||
FORCE_INLINE static void M109() { M104_M109(true); }
|
||||
#endif
|
||||
|
||||
static void M105();
|
||||
@@ -696,8 +700,9 @@ private:
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
static void M140();
|
||||
static void M190();
|
||||
static void M140_M190(const bool isM190);
|
||||
FORCE_INLINE static void M140() { M140_M190(false); }
|
||||
FORCE_INLINE static void M190() { M140_M190(true); }
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_CHAMBER
|
||||
@@ -776,7 +781,7 @@ private:
|
||||
|
||||
static void M220();
|
||||
|
||||
#if EXTRUDERS
|
||||
#if HAS_EXTRUDERS
|
||||
static void M221();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ bool GcodeSuite::select_coordinate_system(const int8_t _new) {
|
||||
xyz_float_t new_offset{0};
|
||||
if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1))
|
||||
new_offset = coordinate_system[_new];
|
||||
LOOP_XYZ(i) {
|
||||
LOOP_LINEAR_AXES(i) {
|
||||
if (position_shift[i] != new_offset[i]) {
|
||||
position_shift[i] = new_offset[i];
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
|
||||
@@ -61,7 +61,7 @@ void GcodeSuite::G92() {
|
||||
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS) && !IS_SCARA
|
||||
case 1: // G92.1 - Zero the Workspace Offset
|
||||
LOOP_XYZ(i) if (position_shift[i]) {
|
||||
LOOP_LINEAR_AXES(i) if (position_shift[i]) {
|
||||
position_shift[i] = 0;
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ void GcodeSuite::G92() {
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
case 9: // G92.9 - Set Current Position directly (like Marlin 1.0)
|
||||
LOOP_XYZE(i) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
if (i == E_AXIS) sync_E = true; else sync_XYZE = true;
|
||||
current_position[i] = parser.value_axis_units((AxisEnum)i);
|
||||
@@ -80,7 +80,7 @@ void GcodeSuite::G92() {
|
||||
#endif
|
||||
|
||||
case 0:
|
||||
LOOP_XYZE(i) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
const float l = parser.value_axis_units((AxisEnum)i), // Given axis coordinate value, converted to millimeters
|
||||
v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i), // Axis position in NATIVE space (applying the existing offset)
|
||||
|
||||
@@ -42,8 +42,8 @@ void M206_report() {
|
||||
* *** In the 2.0 release, it will simply be disabled by default.
|
||||
*/
|
||||
void GcodeSuite::M206() {
|
||||
LOOP_XYZ(i)
|
||||
if (parser.seen(XYZ_CHAR(i)))
|
||||
LOOP_LINEAR_AXES(i)
|
||||
if (parser.seen(AXIS_CHAR(i)))
|
||||
set_home_offset((AxisEnum)i, parser.value_linear_units());
|
||||
|
||||
#if ENABLED(MORGAN_SCARA)
|
||||
@@ -72,7 +72,7 @@ void GcodeSuite::M428() {
|
||||
if (homing_needed_error()) return;
|
||||
|
||||
xyz_float_t diff;
|
||||
LOOP_XYZ(i) {
|
||||
LOOP_LINEAR_AXES(i) {
|
||||
diff[i] = base_home_pos((AxisEnum)i) - current_position[i];
|
||||
if (!WITHIN(diff[i], -20, 20) && home_dir((AxisEnum)i) > 0)
|
||||
diff[i] = -current_position[i];
|
||||
@@ -84,7 +84,7 @@ void GcodeSuite::M428() {
|
||||
}
|
||||
}
|
||||
|
||||
LOOP_XYZ(i) set_home_offset((AxisEnum)i, diff[i]);
|
||||
LOOP_LINEAR_AXES(i) set_home_offset((AxisEnum)i, diff[i]);
|
||||
report_current_position();
|
||||
LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
|
||||
BUZZ(100, 659);
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "../../core/debug_out.h"
|
||||
#endif
|
||||
|
||||
void report_xyze(const xyze_pos_t &pos, const uint8_t n=XYZE, const uint8_t precision=3) {
|
||||
void report_all_axis_pos(const xyze_pos_t &pos, const uint8_t n=XYZE, const uint8_t precision=3) {
|
||||
char str[12];
|
||||
LOOP_L_N(a, n) {
|
||||
SERIAL_CHAR(' ', axis_codes[a], ':');
|
||||
@@ -43,12 +43,12 @@
|
||||
}
|
||||
SERIAL_EOL();
|
||||
}
|
||||
inline void report_xyz(const xyze_pos_t &pos) { report_xyze(pos, XYZ); }
|
||||
inline void report_linear_axis_pos(const xyze_pos_t &pos) { report_all_axis_pos(pos, XYZ); }
|
||||
|
||||
void report_xyz(const xyz_pos_t &pos, const uint8_t precision=3) {
|
||||
void report_linear_axis_pos(const xyz_pos_t &pos, const uint8_t precision=3) {
|
||||
char str[12];
|
||||
LOOP_XYZ(a) {
|
||||
SERIAL_CHAR(' ', XYZ_CHAR(a), ':');
|
||||
LOOP_LINEAR_AXES(a) {
|
||||
SERIAL_CHAR(' ', AXIS_CHAR(a), ':');
|
||||
SERIAL_ECHO(dtostrf(pos[a], 1, precision, str));
|
||||
}
|
||||
SERIAL_EOL();
|
||||
@@ -57,11 +57,11 @@
|
||||
void report_current_position_detail() {
|
||||
// Position as sent by G-code
|
||||
SERIAL_ECHOPGM("\nLogical:");
|
||||
report_xyz(current_position.asLogical());
|
||||
report_linear_axis_pos(current_position.asLogical());
|
||||
|
||||
// Cartesian position in native machine space
|
||||
SERIAL_ECHOPGM("Raw: ");
|
||||
report_xyz(current_position);
|
||||
report_linear_axis_pos(current_position);
|
||||
|
||||
xyze_pos_t leveled = current_position;
|
||||
|
||||
@@ -69,20 +69,20 @@
|
||||
// Current position with leveling applied
|
||||
SERIAL_ECHOPGM("Leveled:");
|
||||
planner.apply_leveling(leveled);
|
||||
report_xyz(leveled);
|
||||
report_linear_axis_pos(leveled);
|
||||
|
||||
// Test planner un-leveling. This should match the Raw result.
|
||||
SERIAL_ECHOPGM("UnLevel:");
|
||||
xyze_pos_t unleveled = leveled;
|
||||
planner.unapply_leveling(unleveled);
|
||||
report_xyz(unleveled);
|
||||
report_linear_axis_pos(unleveled);
|
||||
#endif
|
||||
|
||||
#if IS_KINEMATIC
|
||||
// Kinematics applied to the leveled position
|
||||
SERIAL_ECHOPGM(TERN(IS_SCARA, "ScaraK: ", "DeltaK: "));
|
||||
inverse_kinematics(leveled); // writes delta[]
|
||||
report_xyz(delta);
|
||||
report_linear_axis_pos(delta);
|
||||
#endif
|
||||
|
||||
planner.synchronize();
|
||||
@@ -153,7 +153,7 @@
|
||||
#endif // HAS_L64XX
|
||||
|
||||
SERIAL_ECHOPGM("Stepper:");
|
||||
LOOP_XYZE(i) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
SERIAL_CHAR(' ', axis_codes[i], ':');
|
||||
SERIAL_ECHO(stepper.position((AxisEnum)i));
|
||||
}
|
||||
@@ -165,17 +165,17 @@
|
||||
planner.get_axis_position_degrees(B_AXIS)
|
||||
};
|
||||
SERIAL_ECHOPGM("Degrees:");
|
||||
report_xyze(deg, 2);
|
||||
report_all_axis_pos(deg, 2);
|
||||
#endif
|
||||
|
||||
SERIAL_ECHOPGM("FromStp:");
|
||||
get_cartesian_from_steppers(); // writes 'cartes' (with forward kinematics)
|
||||
xyze_pos_t from_steppers = { cartes.x, cartes.y, cartes.z, planner.get_axis_position_mm(E_AXIS) };
|
||||
report_xyze(from_steppers);
|
||||
report_all_axis_pos(from_steppers);
|
||||
|
||||
const xyze_float_t diff = from_steppers - leveled;
|
||||
SERIAL_ECHOPGM("Diff: ");
|
||||
report_xyze(diff);
|
||||
report_all_axis_pos(diff);
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "../../module/motion.h"
|
||||
#include "../../module/planner.h"
|
||||
|
||||
#if EXTRUDERS
|
||||
#if HAS_EXTRUDERS
|
||||
#include "../../module/temperature.h"
|
||||
#endif
|
||||
|
||||
@@ -171,7 +171,7 @@ void GcodeSuite::M360() {
|
||||
// Per-Extruder settings
|
||||
//
|
||||
config_line(PSTR("NumExtruder"), EXTRUDERS);
|
||||
#if EXTRUDERS
|
||||
#if HAS_EXTRUDERS
|
||||
LOOP_L_N(e, EXTRUDERS) {
|
||||
config_line_e(e, JERK_STR, TERN(HAS_LINEAR_E_JERK, planner.max_e_jerk[E_INDEX_N(e)], TERN(HAS_CLASSIC_JERK, planner.max_jerk.e, DEFAULT_EJERK)));
|
||||
config_line_e(e, PSTR("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(e)]);
|
||||
|
||||
@@ -83,7 +83,7 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
|
||||
|
||||
if (MIN_AUTORETRACT <= MAX_AUTORETRACT) {
|
||||
// When M209 Autoretract is enabled, convert E-only moves to firmware retract/recover moves
|
||||
if (fwretract.autoretract_enabled && parser.seen('E') && !(parser.seen('X') || parser.seen('Y') || parser.seen('Z'))) {
|
||||
if (fwretract.autoretract_enabled && parser.seen('E') && !parser.seen("XYZ")) {
|
||||
const float echange = destination.e - current_position.e;
|
||||
// Is this a retract or recover move?
|
||||
if (WITHIN(ABS(echange), MIN_AUTORETRACT, MAX_AUTORETRACT) && fwretract.retracted[active_extruder] == (echange > 0.0)) {
|
||||
|
||||
@@ -291,12 +291,12 @@ void plan_arc(
|
||||
* Mixing IJ/JK/KI with R will throw an error.
|
||||
*
|
||||
* - R specifies the radius. X or Y (Y or Z / Z or X) is required.
|
||||
* Omitting both XY/YZ/ZX will throw an error.
|
||||
* XY/YZ/ZX must differ from the current XY/YZ/ZX.
|
||||
* Mixing R with IJ/JK/KI will throw an error.
|
||||
* Omitting both XY/YZ/ZX will throw an error.
|
||||
* XY/YZ/ZX must differ from the current XY/YZ/ZX.
|
||||
* Mixing R with IJ/JK/KI will throw an error.
|
||||
*
|
||||
* - P specifies the number of full circles to do
|
||||
* before the specified arc move.
|
||||
* before the specified arc move.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
|
||||
@@ -69,8 +69,8 @@
|
||||
*/
|
||||
void GcodeSuite::M290() {
|
||||
#if ENABLED(BABYSTEP_XY)
|
||||
LOOP_XYZ(a)
|
||||
if (parser.seenval(XYZ_CHAR(a)) || (a == Z_AXIS && parser.seenval('S'))) {
|
||||
LOOP_LINEAR_AXES(a)
|
||||
if (parser.seenval(AXIS_CHAR(a)) || (a == Z_AXIS && parser.seenval('S'))) {
|
||||
const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2);
|
||||
babystep.add_mm((AxisEnum)a, offs);
|
||||
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||
|
||||
@@ -222,7 +222,7 @@ void GCodeParser::parse(char *p) {
|
||||
|
||||
#if ENABLED(GCODE_MOTION_MODES)
|
||||
if (letter == 'G'
|
||||
&& (codenum <= TERN(ARC_SUPPORT, 3, 1) || codenum == 5 || TERN0(G38_PROBE_TARGET, codenum == 38))
|
||||
&& (codenum <= TERN(ARC_SUPPORT, 3, 1) || TERN0(BEZIER_CURVE_SUPPORT, codenum == 5) || TERN0(G38_PROBE_TARGET, codenum == 38))
|
||||
) {
|
||||
motion_mode_codenum = codenum;
|
||||
TERN_(USE_GCODE_SUBCODES, motion_mode_subcode = subcode);
|
||||
|
||||
@@ -226,7 +226,7 @@ public:
|
||||
|
||||
// Seen any axis parameter
|
||||
static inline bool seen_axis() {
|
||||
return seen_test('X') || seen_test('Y') || seen_test('Z') || seen_test('E');
|
||||
return seen("XYZE");
|
||||
}
|
||||
|
||||
#if ENABLED(GCODE_QUOTED_STRINGS)
|
||||
|
||||
@@ -38,7 +38,7 @@ inline void G38_single_probe(const uint8_t move_value) {
|
||||
planner.synchronize();
|
||||
G38_move = 0;
|
||||
endstops.hit_on_purpose();
|
||||
set_current_from_steppers_for_axis(ALL_AXES);
|
||||
set_current_from_steppers_for_axis(ALL_AXES_ENUM);
|
||||
sync_plan_position();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ inline bool G38_run_probe() {
|
||||
#if MULTIPLE_PROBING > 1
|
||||
// Get direction of move and retract
|
||||
xyz_float_t retract_mm;
|
||||
LOOP_XYZ(i) {
|
||||
LOOP_LINEAR_AXES(i) {
|
||||
const float dist = destination[i] - current_position[i];
|
||||
retract_mm[i] = ABS(dist) < G38_MINIMUM_MOVE ? 0 : home_bump_mm((AxisEnum)i) * (dist > 0 ? -1 : 1);
|
||||
}
|
||||
@@ -119,7 +119,7 @@ void GcodeSuite::G38(const int8_t subcode) {
|
||||
;
|
||||
|
||||
// If any axis has enough movement, do the move
|
||||
LOOP_XYZ(i)
|
||||
LOOP_LINEAR_AXES(i)
|
||||
if (ABS(destination[i] - current_position[i]) >= G38_MINIMUM_MOVE) {
|
||||
if (!parser.seenval('F')) feedrate_mm_s = homing_feedrate((AxisEnum)i);
|
||||
// If G38.2 fails throw an error
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if EXTRUDERS
|
||||
#if HAS_EXTRUDERS
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/temperature.h"
|
||||
@@ -51,89 +51,29 @@
|
||||
|
||||
/**
|
||||
* M104: Set Hotend Temperature target and return immediately
|
||||
*
|
||||
* Parameters:
|
||||
* I<preset> : Material Preset index (if material presets are defined)
|
||||
* T<index> : Tool index. If omitted, applies to the active tool
|
||||
* S<target> : The target temperature in current units
|
||||
*/
|
||||
void GcodeSuite::M104() {
|
||||
|
||||
if (DEBUGGING(DRYRUN)) return;
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
|
||||
constexpr int8_t target_extruder = 0;
|
||||
#else
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
#endif
|
||||
|
||||
bool got_temp = false;
|
||||
celsius_t temp = 0;
|
||||
|
||||
// Accept 'I' if temperature presets are defined
|
||||
#if PREHEAT_COUNT
|
||||
got_temp = parser.seenval('I');
|
||||
if (got_temp) {
|
||||
const uint8_t index = parser.value_byte();
|
||||
temp = ui.material_preset[_MIN(index, PREHEAT_COUNT - 1)].hotend_temp;
|
||||
}
|
||||
#endif
|
||||
|
||||
// If no 'I' get the temperature from 'S'
|
||||
if (!got_temp) {
|
||||
got_temp = parser.seenval('S');
|
||||
if (got_temp) temp = parser.value_celsius();
|
||||
}
|
||||
|
||||
if (got_temp) {
|
||||
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
|
||||
thermalManager.singlenozzle_temp[target_extruder] = temp;
|
||||
if (target_extruder != active_extruder) return;
|
||||
#endif
|
||||
thermalManager.setTargetHotend(temp, target_extruder);
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
if (idex_is_duplicating() && target_extruder == 0)
|
||||
thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1);
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||
/**
|
||||
* Stop the timer at the end of print. Start is managed by 'heat and wait' M109.
|
||||
* Hotends use EXTRUDE_MINTEMP / 2 to allow nozzles to be put into hot standby
|
||||
* mode, for instance in a dual extruder setup, without affecting the running
|
||||
* print timer.
|
||||
*/
|
||||
thermalManager.auto_job_check_timer(false, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
TERN_(AUTOTEMP, planner.autotemp_M104_M109());
|
||||
}
|
||||
|
||||
/**
|
||||
* M109: Set Hotend Temperature target and wait
|
||||
*
|
||||
* Parameters
|
||||
* I<preset> : Material Preset index (if material presets are defined)
|
||||
* T<index> : Tool index. If omitted, applies to the active tool
|
||||
* S<target> : The target temperature in current units. Wait for heating only.
|
||||
* R<target> : The target temperature in current units. Wait for heating and cooling.
|
||||
* S<target> : The target temperature in current units. For M109, only wait when heating up.
|
||||
*
|
||||
* With AUTOTEMP...
|
||||
* F<factor> : Autotemp Scaling Factor. Set non-zero to enable Auto-temp.
|
||||
* S<min> : Minimum temperature, in current units.
|
||||
* B<max> : Maximum temperature, in current units.
|
||||
*
|
||||
* M109 Parameters
|
||||
* R<target> : The target temperature in current units. Wait for heating and cooling.
|
||||
*
|
||||
* Examples
|
||||
* M109 S100 : Set target to 100°. Wait until the hotend is at or above 100°.
|
||||
* M104 S100 : Set target to 100° and return.
|
||||
* M109 R150 : Set target to 150°. Wait until the hotend gets close to 150°.
|
||||
*
|
||||
* With PRINTJOB_TIMER_AUTOSTART turning on heaters will start the print job timer
|
||||
* (used by printingIsActive, etc.) and turning off heaters will stop the timer.
|
||||
*/
|
||||
void GcodeSuite::M109() {
|
||||
void GcodeSuite::M104_M109(const bool isM109) {
|
||||
|
||||
if (DEBUGGING(DRYRUN)) return;
|
||||
|
||||
@@ -160,7 +100,7 @@ void GcodeSuite::M109() {
|
||||
bool no_wait_for_cooling = false;
|
||||
if (!got_temp) {
|
||||
no_wait_for_cooling = parser.seenval('S');
|
||||
got_temp = no_wait_for_cooling || parser.seenval('R');
|
||||
got_temp = no_wait_for_cooling || (isM109 && parser.seenval('R'));
|
||||
if (got_temp) temp = parser.value_celsius();
|
||||
}
|
||||
|
||||
@@ -182,7 +122,7 @@ void GcodeSuite::M109() {
|
||||
* standby mode, (e.g., in a dual extruder setup) without affecting
|
||||
* the running print timer.
|
||||
*/
|
||||
thermalManager.auto_job_check_timer(true, true);
|
||||
thermalManager.auto_job_check_timer(isM109, true);
|
||||
#endif
|
||||
|
||||
#if HAS_STATUS_MESSAGE
|
||||
@@ -193,7 +133,7 @@ void GcodeSuite::M109() {
|
||||
|
||||
TERN_(AUTOTEMP, planner.autotemp_M104_M109());
|
||||
|
||||
if (got_temp)
|
||||
if (isM109 && got_temp)
|
||||
(void)thermalManager.wait_for_hotend(target_extruder, no_wait_for_cooling);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,62 +35,28 @@
|
||||
#include "../../lcd/marlinui.h"
|
||||
|
||||
/**
|
||||
* M140: Set bed temperature
|
||||
* M140 - Set Bed Temperature target and return immediately
|
||||
* M190 - Set Bed Temperature target and wait
|
||||
*
|
||||
* I<index> : Preset index (if material presets are defined)
|
||||
* S<target> : The target temperature in current units
|
||||
*/
|
||||
void GcodeSuite::M140() {
|
||||
if (DEBUGGING(DRYRUN)) return;
|
||||
|
||||
bool got_temp = false;
|
||||
celsius_t temp = 0;
|
||||
|
||||
// Accept 'I' if temperature presets are defined
|
||||
#if PREHEAT_COUNT
|
||||
got_temp = parser.seenval('I');
|
||||
if (got_temp) {
|
||||
const uint8_t index = parser.value_byte();
|
||||
temp = ui.material_preset[_MIN(index, PREHEAT_COUNT - 1)].bed_temp;
|
||||
}
|
||||
#endif
|
||||
|
||||
// If no 'I' get the temperature from 'S'
|
||||
if (!got_temp) {
|
||||
got_temp = parser.seenval('S');
|
||||
if (got_temp) temp = parser.value_celsius();
|
||||
}
|
||||
|
||||
if (got_temp) {
|
||||
thermalManager.setTargetBed(temp);
|
||||
|
||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||
/**
|
||||
* Stop the timer at the end of print. Hotend, bed target, and chamber
|
||||
* temperatures need to be set below mintemp. Order of M140, M104, and M141
|
||||
* at the end of the print does not matter.
|
||||
*/
|
||||
thermalManager.auto_job_check_timer(false, true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* M190 - Set Bed Temperature target and wait
|
||||
*
|
||||
* Parameters:
|
||||
* Parameters
|
||||
* I<index> : Preset index (if material presets are defined)
|
||||
* S<target> : The target temperature in current units. Wait for heating only.
|
||||
*
|
||||
* M190 Parameters
|
||||
* R<target> : The target temperature in current units. Wait for heating and cooling.
|
||||
*
|
||||
* Examples:
|
||||
* M190 S60 : Set target to 60°. Wait until the bed is at or above 60°.
|
||||
* Examples
|
||||
* M140 S60 : Set target to 60° and return right away.
|
||||
* M190 R40 : Set target to 40°. Wait until the bed gets close to 40°.
|
||||
*
|
||||
* With PRINTJOB_TIMER_AUTOSTART turning on heaters will start the print job timer
|
||||
* (used by printingIsActive, etc.) and turning off heaters will stop the timer.
|
||||
*/
|
||||
void GcodeSuite::M190() {
|
||||
void GcodeSuite::M140_M190(const bool isM190) {
|
||||
|
||||
if (DEBUGGING(DRYRUN)) return;
|
||||
|
||||
bool got_temp = false;
|
||||
@@ -109,7 +75,7 @@ void GcodeSuite::M190() {
|
||||
bool no_wait_for_cooling = false;
|
||||
if (!got_temp) {
|
||||
no_wait_for_cooling = parser.seenval('S');
|
||||
got_temp = no_wait_for_cooling || parser.seenval('R');
|
||||
got_temp = no_wait_for_cooling || (isM190 && parser.seenval('R'));
|
||||
if (got_temp) temp = parser.value_celsius();
|
||||
}
|
||||
|
||||
@@ -121,7 +87,8 @@ void GcodeSuite::M190() {
|
||||
|
||||
ui.set_status_P(thermalManager.isHeatingBed() ? GET_TEXT(MSG_BED_HEATING) : GET_TEXT(MSG_BED_COOLING));
|
||||
|
||||
thermalManager.wait_for_bed(no_wait_for_cooling);
|
||||
if (isM190)
|
||||
thermalManager.wait_for_bed(no_wait_for_cooling);
|
||||
}
|
||||
|
||||
#endif // HAS_HEATED_BED
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if HAS_EXTRUDERS
|
||||
|
||||
#include "../gcode.h"
|
||||
|
||||
/**
|
||||
@@ -31,3 +35,5 @@ void GcodeSuite::M82() { set_e_absolute(); }
|
||||
* M83: Set E codes relative while in Absolute Coordinates (G90) mode
|
||||
*/
|
||||
void GcodeSuite::M83() { set_e_relative(); }
|
||||
|
||||
#endif // HAS_EXTRUDERS
|
||||
|
||||
Reference in New Issue
Block a user