mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2026-03-05 09:34:47 -07:00
Merge branch 'bugfix-2.1.x' into FTM_Reso_refact
This commit is contained in:
commit
2de72e3278
196 changed files with 4638 additions and 3062 deletions
|
|
@ -2799,6 +2799,11 @@
|
|||
// Enable this option to collect and display the number
|
||||
// of dropped bytes after a file transfer to SD.
|
||||
//#define SERIAL_STATS_DROPPED_RX
|
||||
|
||||
// Enable this option to collect and display framing errors.
|
||||
// Framing errors occur when invalid start/stop bits or other
|
||||
// serial protocol violations are detected.
|
||||
//#define SERIAL_STATS_RX_FRAMING_ERRORS
|
||||
#endif
|
||||
|
||||
// Monitor RX buffer usage
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
* here we define this default string as the date where the latest release
|
||||
* version was tagged.
|
||||
*/
|
||||
//#define STRING_DISTRIBUTION_DATE "2026-02-09"
|
||||
//#define STRING_DISTRIBUTION_DATE "2026-02-19"
|
||||
|
||||
/**
|
||||
* The protocol for communication to the host. Protocol indicates communication
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
|
|||
WITH_RETRY(SDIO_READ_RETRIES, {
|
||||
en_result_t rc = SDCARD_ReadBlocks(handle, block, 1, dst, SDIO_READ_TIMEOUT);
|
||||
if (rc == Ok) return true;
|
||||
printf("SDIO_ReadBlock error (rc=%u; ErrorCode=%lu)\n", rc, handle->u32ErrorCode);
|
||||
printf("SDIO_ReadBlock error (rc=%u; ErrorCode=%" PRIu32 ")\n", rc, handle->u32ErrorCode);
|
||||
})
|
||||
|
||||
return false;
|
||||
|
|
@ -122,7 +122,7 @@ bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
|
|||
WITH_RETRY(SDIO_WRITE_RETRIES, {
|
||||
en_result_t rc = SDCARD_WriteBlocks(handle, block, 1, (uint8_t *)src, SDIO_WRITE_TIMEOUT);
|
||||
if (rc == Ok) return true;
|
||||
printf("SDIO_WriteBlock error (rc=%u; ErrorCode=%lu)\n", rc, handle->u32ErrorCode);
|
||||
printf("SDIO_WriteBlock error (rc=%u; ErrorCode=%" PRIu32 ")\n", rc, handle->u32ErrorCode);
|
||||
})
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ void core_hook_sysclock_init() {
|
|||
power_mode_update_post(F_SYSTEM_CLOCK);
|
||||
|
||||
// Verify clocks match expected values (at runtime)
|
||||
#if ENABLED(MARLIN_DEV_MODE) || ENABLED(ALWAYS_VALIDATE_CLOCKS)
|
||||
#if ANY(MARLIN_DEV_MODE, ALWAYS_VALIDATE_CLOCKS)
|
||||
validate_system_clocks();
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -88,9 +88,9 @@ void USBHost::setUsbTaskState(uint8_t state) {
|
|||
capacity = info.capacity.block_nbr / 2000;
|
||||
block_size = info.capacity.block_size;
|
||||
block_count = info.capacity.block_nbr;
|
||||
//SERIAL_ECHOLNPGM("info.capacity.block_nbr : %ld\n", info.capacity.block_nbr);
|
||||
//SERIAL_ECHOLNPGM("info.capacity.block_size: %d\n", info.capacity.block_size);
|
||||
//SERIAL_ECHOLNPGM("capacity : %d MB\n", capacity);
|
||||
//SERIAL_ECHOLNPGM("info.capacity.block_nbr : ", info.capacity.block_nbr);
|
||||
//SERIAL_ECHOLNPGM("info.capacity.block_size: ", info.capacity.block_size);
|
||||
//SERIAL_ECHOLNPGM("capacity : ", capacity, "MB");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#error "POSTMORTEM_DEBUGGING is not yet supported for Teensy 4.0/4.1."
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) || ENABLED(SERIAL_STATS_DROPPED_RX) || ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS) || ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
|
||||
#if ANY(SERIAL_STATS_MAX_RX_QUEUED, SERIAL_STATS_DROPPED_RX, SERIAL_STATS_RX_FRAMING_ERRORS, SERIAL_STATS_RX_BUFFER_OVERRUNS)
|
||||
#error "SERIAL_STATS_* features not supported on Teensy 4.0/4.1."
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ void Marlin::startOrResumeJob() {
|
|||
if (!printingIsPaused()) {
|
||||
TERN_(GCODE_REPEAT_MARKERS, repeat.reset());
|
||||
TERN_(CANCEL_OBJECTS, cancelable.reset());
|
||||
TERN_(LCD_SHOW_E_TOTAL, e_move_accumulator = 0);
|
||||
TERN_(LCD_SHOW_E_TOTAL, motion.e_move_accumulator = 0);
|
||||
TERN_(SET_REMAINING_TIME, ui.reset_remaining_time());
|
||||
TERN_(HAS_PRUSA_MMU3, MMU3::operation_statistics.reset_per_print_stats());
|
||||
}
|
||||
|
|
@ -388,7 +388,7 @@ void Marlin::startOrResumeJob() {
|
|||
card.abortFilePrintNow(TERN_(SD_RESORT, true));
|
||||
|
||||
queue.clear();
|
||||
quickstop_stepper();
|
||||
motion.quickstop_stepper();
|
||||
|
||||
print_job_timer.abort();
|
||||
|
||||
|
|
@ -709,18 +709,18 @@ void Marlin::manage_inactivity(const bool no_stepper_sleep/*=false*/) {
|
|||
#endif
|
||||
|
||||
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
|
||||
if (thermalManager.degHotend(active_extruder) > (EXTRUDER_RUNOUT_MINTEMP)
|
||||
if (thermalManager.degHotend(motion.extruder) > (EXTRUDER_RUNOUT_MINTEMP)
|
||||
&& ELAPSED(ms, gcode.previous_move_ms, SEC_TO_MS(EXTRUDER_RUNOUT_SECONDS))
|
||||
&& !planner.has_blocks_queued()
|
||||
) {
|
||||
const int8_t e_stepper = TERN(HAS_SWITCHING_EXTRUDER, active_extruder >> 1, active_extruder);
|
||||
const int8_t e_stepper = TERN(HAS_SWITCHING_EXTRUDER, motion.extruder / 2, motion.extruder);
|
||||
const bool e_off = !stepper.AXIS_IS_ENABLED(E_AXIS, e_stepper);
|
||||
if (e_off) stepper.ENABLE_EXTRUDER(e_stepper);
|
||||
|
||||
const float olde = current_position.e;
|
||||
current_position.e += EXTRUDER_RUNOUT_EXTRUDE;
|
||||
line_to_current_position(MMM_TO_MMS(EXTRUDER_RUNOUT_SPEED));
|
||||
current_position.e = olde;
|
||||
const float olde = motion.position.e;
|
||||
motion.position.e += EXTRUDER_RUNOUT_EXTRUDE;
|
||||
motion.goto_current_position(MMM_TO_MMS(EXTRUDER_RUNOUT_SPEED));
|
||||
motion.position.e = olde;
|
||||
planner.set_e_position_mm(olde);
|
||||
planner.synchronize();
|
||||
|
||||
|
|
@ -732,11 +732,11 @@ void Marlin::manage_inactivity(const bool no_stepper_sleep/*=false*/) {
|
|||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
// handle delayed move timeout
|
||||
if (delayed_move_time && ELAPSED(ms, delayed_move_time) && isRunning()) {
|
||||
if (motion.delayed_move_time && ELAPSED(ms, motion.delayed_move_time) && isRunning()) {
|
||||
// travel moves have been received so enact them
|
||||
delayed_move_time = UINT32_MAX; // force moves to be done
|
||||
destination = current_position;
|
||||
prepare_line_to_destination();
|
||||
motion.delayed_move_time = UINT32_MAX; // force moves to be done
|
||||
motion.destination = motion.position;
|
||||
motion.prepare_line_to_destination();
|
||||
planner.synchronize();
|
||||
}
|
||||
#endif
|
||||
|
|
@ -816,7 +816,7 @@ void Marlin::idle(const bool no_stepper_sleep/*=false*/) {
|
|||
if (is(MF_INITIALIZING)) goto IDLE_DONE;
|
||||
|
||||
// TODO: Still causing errors
|
||||
TERN_(TOOL_SENSOR, (void)check_tool_sensor_stats(active_extruder, true));
|
||||
TERN_(TOOL_SENSOR, (void)check_tool_sensor_stats(motion.extruder, true));
|
||||
|
||||
// Handle filament runout sensors
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
|
|
@ -891,7 +891,7 @@ void Marlin::idle(const bool no_stepper_sleep/*=false*/) {
|
|||
TERN_(AUTO_REPORT_TEMPERATURES, thermalManager.auto_reporter.tick());
|
||||
TERN_(AUTO_REPORT_FANS, fan_check.auto_reporter.tick());
|
||||
TERN_(AUTO_REPORT_SD_STATUS, card.auto_reporter.tick());
|
||||
TERN_(AUTO_REPORT_POSITION, position_auto_reporter.tick());
|
||||
TERN_(AUTO_REPORT_POSITION, motion.position_auto_reporter.tick());
|
||||
TERN_(BUFFER_MONITORING, queue.auto_report_buffer_statistics());
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1411,9 +1411,9 @@ void setup() {
|
|||
SETUP_RUN(touchBt.init());
|
||||
#endif
|
||||
|
||||
TERN_(HAS_HOME_OFFSET, current_position += home_offset); // Init current position based on home_offset
|
||||
TERN_(HAS_HOME_OFFSET, motion.position += motion.home_offset); // Init current position based on home_offset
|
||||
|
||||
sync_plan_position(); // Vital to init stepper/planner equivalent for current_position
|
||||
motion.sync_plan_position(); // Vital to init stepper/planner equivalent for motion.position
|
||||
|
||||
SETUP_RUN(thermalManager.init()); // Initialize temperature loop
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,6 @@ private:
|
|||
SERIAL_ECHO(fpre);
|
||||
if (the_msg) SERIAL_ECHO(C(' '), the_msg);
|
||||
SERIAL_CHAR(' ');
|
||||
print_xyz(xyz_pos_t(current_position));
|
||||
print_xyz(xyz_pos_t(motion.position));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -350,9 +350,9 @@ typedef struct {
|
|||
//
|
||||
// Enumerated axis indices
|
||||
//
|
||||
// - X_AXIS, Y_AXIS, and Z_AXIS should be used for axes in Cartesian space
|
||||
// - A_AXIS, B_AXIS, and C_AXIS should be used for Steppers, corresponding to XYZ on Cartesians
|
||||
// - X_REAL, Y_REAL, and Z_REAL should be used for axes on Core kinematics
|
||||
// - X_REAL, Y_REAL, and Z_REAL should be used for axes in Cartesian space
|
||||
// - A_AXIS, B_AXIS, and C_AXIS should be used for Steppers
|
||||
// - X_AXIS, Y_AXIS, and Z_AXIS are now more generic interchangeble indexes
|
||||
//
|
||||
enum AxisEnum : uint8_t {
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@
|
|||
SERIAL_ECHOPGM("ABL Adjustment");
|
||||
LOOP_NUM_AXES(a) {
|
||||
SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&SP_AXIS_STR[a]));
|
||||
serial_offset(planner.get_axis_position_mm((AxisEnum)a) - current_position[a]);
|
||||
serial_offset(planner.get_axis_position_mm((AxisEnum)a) - motion.position[a]);
|
||||
}
|
||||
#else
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
|
|
@ -141,11 +141,11 @@
|
|||
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||
SERIAL_ECHOPGM("ABL Adjustment Z");
|
||||
#endif
|
||||
const float rz = bedlevel.get_z_correction(current_position);
|
||||
const float rz = bedlevel.get_z_correction(motion.position);
|
||||
SERIAL_ECHO(ftostr43sign(rz, '+'));
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
if (planner.z_fade_height)
|
||||
SERIAL_ECHO(F(" ("), ftostr43sign(rz * planner.fade_scaling_factor_for_z(current_position.z), '+'), C(')'));
|
||||
SERIAL_ECHO(F(" ("), ftostr43sign(rz * planner.fade_scaling_factor_for_z(motion.position.z), '+'), C(')'));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
@ -160,11 +160,11 @@
|
|||
if (planner.leveling_active) {
|
||||
SERIAL_ECHOLNPGM(" (enabled)");
|
||||
const float z_offset = bedlevel.get_z_offset(),
|
||||
z_correction = bedlevel.get_z_correction(current_position);
|
||||
z_correction = bedlevel.get_z_correction(motion.position);
|
||||
SERIAL_ECHOPGM("MBL Adjustment Z", ftostr43sign(z_offset + z_correction, '+'));
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
if (planner.z_fade_height) {
|
||||
SERIAL_ECHO(F(" ("), ftostr43sign(z_offset + z_correction * planner.fade_scaling_factor_for_z(current_position.z), '+'), C(')'));
|
||||
SERIAL_ECHO(F(" ("), ftostr43sign(z_offset + z_correction * planner.fade_scaling_factor_for_z(motion.position.z), '+'), C(')'));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void Babystep::add_mm(const AxisEnum axis, const float mm) {
|
|||
|
||||
#if ENABLED(BD_SENSOR)
|
||||
void Babystep::set_mm(const AxisEnum axis, const float mm) {
|
||||
//if (DISABLED(BABYSTEP_WITHOUT_HOMING) && axis_should_home(axis)) return;
|
||||
//if (DISABLED(BABYSTEP_WITHOUT_HOMING) && motion.axis_should_home(axis)) return;
|
||||
const int16_t distance = mm * planner.settings.axis_steps_per_mm[axis];
|
||||
accum = distance; // Count up babysteps for the UI
|
||||
steps[BS_AXIS_IND(axis)] = distance;
|
||||
|
|
@ -70,7 +70,7 @@ void Babystep::add_mm(const AxisEnum axis, const float mm) {
|
|||
#endif
|
||||
|
||||
bool Babystep::can_babystep(const AxisEnum axis) {
|
||||
return (ENABLED(BABYSTEP_WITHOUT_HOMING) || !axis_should_home(axis));
|
||||
return (ENABLED(BABYSTEP_WITHOUT_HOMING) || !motion.axis_should_home(axis));
|
||||
}
|
||||
|
||||
void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
|
||||
|
|
|
|||
|
|
@ -224,12 +224,12 @@ class Backlash::StepAdjuster {
|
|||
void Backlash::measure_with_probe() {
|
||||
if (measured_count.z == 255) return;
|
||||
|
||||
const float start_height = current_position.z;
|
||||
while (current_position.z < (start_height + BACKLASH_MEASUREMENT_LIMIT) && PROBE_TRIGGERED())
|
||||
do_blocking_move_to_z(current_position.z + BACKLASH_MEASUREMENT_RESOLUTION, MMM_TO_MMS(BACKLASH_MEASUREMENT_FEEDRATE));
|
||||
const float start_height = motion.position.z;
|
||||
while (motion.position.z < (start_height + BACKLASH_MEASUREMENT_LIMIT) && PROBE_TRIGGERED())
|
||||
motion.blocking_move_z(motion.position.z + BACKLASH_MEASUREMENT_RESOLUTION, MMM_TO_MMS(BACKLASH_MEASUREMENT_FEEDRATE));
|
||||
|
||||
// The backlash from all probe points is averaged, so count the number of measurements
|
||||
measured_mm.z += current_position.z - start_height;
|
||||
measured_mm.z += motion.position.z - start_height;
|
||||
measured_count.z++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -371,8 +371,8 @@ float LevelingBilinear::get_z_correction(const xy_pos_t &raw) {
|
|||
*/
|
||||
void LevelingBilinear::line_to_destination(const feedRate_t scaled_fr_mm_s, uint16_t x_splits, uint16_t y_splits) {
|
||||
// Get current and destination cells for this line
|
||||
xy_int_t c1 { CELL_INDEX(x, current_position.x), CELL_INDEX(y, current_position.y) },
|
||||
c2 { CELL_INDEX(x, destination.x), CELL_INDEX(y, destination.y) };
|
||||
xy_int_t c1 { CELL_INDEX(x, motion.position.x), CELL_INDEX(y, motion.position.y) },
|
||||
c2 { CELL_INDEX(x, motion.destination.x), CELL_INDEX(y, motion.destination.y) };
|
||||
LIMIT(c1.x, 0, ABL_BG_POINTS_X - 2);
|
||||
LIMIT(c1.y, 0, ABL_BG_POINTS_Y - 2);
|
||||
LIMIT(c2.x, 0, ABL_BG_POINTS_X - 2);
|
||||
|
|
@ -380,12 +380,12 @@ float LevelingBilinear::get_z_correction(const xy_pos_t &raw) {
|
|||
|
||||
// Start and end in the same cell? No split needed.
|
||||
if (c1 == c2) {
|
||||
current_position = destination;
|
||||
line_to_current_position(scaled_fr_mm_s);
|
||||
motion.position = motion.destination;
|
||||
motion.goto_current_position(scaled_fr_mm_s);
|
||||
return;
|
||||
}
|
||||
|
||||
#define LINE_SEGMENT_END(A) (current_position.A + (destination.A - current_position.A) * normalized_dist)
|
||||
#define LINE_SEGMENT_END(A) (motion.position.A + (motion.destination.A - motion.position.A) * normalized_dist)
|
||||
|
||||
float normalized_dist;
|
||||
xyze_pos_t end;
|
||||
|
|
@ -396,36 +396,36 @@ float LevelingBilinear::get_z_correction(const xy_pos_t &raw) {
|
|||
if (c2.x != c1.x && TEST(x_splits, gc.x)) {
|
||||
// Split on the X grid line
|
||||
CBI(x_splits, gc.x);
|
||||
end = destination;
|
||||
destination.x = grid_start.x + ABL_BG_SPACING(x) * gc.x;
|
||||
normalized_dist = (destination.x - current_position.x) / (end.x - current_position.x);
|
||||
destination.y = LINE_SEGMENT_END(y);
|
||||
end = motion.destination;
|
||||
motion.destination.x = grid_start.x + ABL_BG_SPACING(x) * gc.x;
|
||||
normalized_dist = (motion.destination.x - motion.position.x) / (end.x - motion.position.x);
|
||||
motion.destination.y = LINE_SEGMENT_END(y);
|
||||
}
|
||||
// Crosses on the Y and not already split on this Y?
|
||||
else if (c2.y != c1.y && TEST(y_splits, gc.y)) {
|
||||
// Split on the Y grid line
|
||||
CBI(y_splits, gc.y);
|
||||
end = destination;
|
||||
destination.y = grid_start.y + ABL_BG_SPACING(y) * gc.y;
|
||||
normalized_dist = (destination.y - current_position.y) / (end.y - current_position.y);
|
||||
destination.x = LINE_SEGMENT_END(x);
|
||||
end = motion.destination;
|
||||
motion.destination.y = grid_start.y + ABL_BG_SPACING(y) * gc.y;
|
||||
normalized_dist = (motion.destination.y - motion.position.y) / (end.y - motion.position.y);
|
||||
motion.destination.x = LINE_SEGMENT_END(x);
|
||||
}
|
||||
else {
|
||||
// Must already have been split on these border(s)
|
||||
// This should be a rare case.
|
||||
current_position = destination;
|
||||
line_to_current_position(scaled_fr_mm_s);
|
||||
motion.position = motion.destination;
|
||||
motion.goto_current_position(scaled_fr_mm_s);
|
||||
return;
|
||||
}
|
||||
|
||||
destination.z = LINE_SEGMENT_END(z);
|
||||
destination.e = LINE_SEGMENT_END(e);
|
||||
motion.destination.z = LINE_SEGMENT_END(z);
|
||||
motion.destination.e = LINE_SEGMENT_END(e);
|
||||
|
||||
// Do the split and look for more borders
|
||||
line_to_destination(scaled_fr_mm_s, x_splits, y_splits);
|
||||
|
||||
// Restore destination from stack
|
||||
destination = end;
|
||||
motion.destination = end;
|
||||
line_to_destination(scaled_fr_mm_s, x_splits, y_splits);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ void BDS_Leveling::init(uint8_t _sda, uint8_t _scl, uint16_t delay_s) {
|
|||
config_state = BDS_IDLE;
|
||||
const int ret = BD_I2C_SENSOR.i2c_init(_sda, _scl, BD_SENSOR_I2C_ADDR, delay_s);
|
||||
if (ret != 1) SERIAL_ECHOLNPGM("BD Sensor Init Fail (", ret, ")");
|
||||
sync_plan_position();
|
||||
pos_zero_offset = planner.get_axis_position_mm(Z_AXIS) - current_position.z;
|
||||
motion.sync_plan_position();
|
||||
pos_zero_offset = planner.get_axis_position_mm(Z_AXIS) - motion.position.z;
|
||||
SERIAL_ECHOLNPGM("BD Sensor Zero Offset:", pos_zero_offset);
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ void BDS_Leveling::process() {
|
|||
|
||||
uint16_t tmp = 0;
|
||||
const float cur_z = planner.get_axis_position_mm(Z_AXIS) - pos_zero_offset;
|
||||
static float old_cur_z = cur_z, old_buf_z = current_position.z;
|
||||
static float old_cur_z = cur_z, old_buf_z = motion.position.z;
|
||||
tmp = BD_I2C_SENSOR.BD_i2c_read();
|
||||
if (BD_I2C_SENSOR.BD_Check_OddEven(tmp) && good_data(tmp)) {
|
||||
const float z_sensor = interpret(tmp);
|
||||
|
|
@ -127,11 +127,11 @@ void BDS_Leveling::process() {
|
|||
if (config_state > 0) {
|
||||
if (cur_z < config_state * 0.1f
|
||||
&& old_cur_z == cur_z
|
||||
&& old_buf_z == current_position.z
|
||||
&& old_buf_z == motion.position.z
|
||||
&& z_sensor < (MAX_BD_HEIGHT) - 0.1f
|
||||
) {
|
||||
babystep.set_mm(Z_AXIS, cur_z - z_sensor);
|
||||
DEBUG_ECHOLNPGM("BD:", z_sensor, ", Z:", cur_z, "|", current_position.z);
|
||||
DEBUG_ECHOLNPGM("BD:", z_sensor, ", Z:", cur_z, "|", motion.position.z);
|
||||
}
|
||||
else
|
||||
babystep.set_mm(Z_AXIS, 0);
|
||||
|
|
@ -139,7 +139,7 @@ void BDS_Leveling::process() {
|
|||
#endif
|
||||
|
||||
old_cur_z = cur_z;
|
||||
old_buf_z = current_position.z;
|
||||
old_buf_z = motion.position.z;
|
||||
endstops.bdp_state_update(z_sensor <= BD_SENSOR_HOME_Z_POSITION);
|
||||
|
||||
#if HAS_STATUS_MESSAGE
|
||||
|
|
@ -158,7 +158,7 @@ void BDS_Leveling::process() {
|
|||
marlin.kill(F("BDsensor connect Err!"));
|
||||
}
|
||||
|
||||
DEBUG_ECHOLNPGM("BD:", tmp & 0x3FF, " Z:", cur_z, "|", current_position.z);
|
||||
DEBUG_ECHOLNPGM("BD:", tmp & 0x3FF, " Z:", cur_z, "|", motion.position.z);
|
||||
if (TERN0(DEBUG_OUT_BD, BD_I2C_SENSOR.BD_Check_OddEven(tmp) == 0)) DEBUG_ECHOLNPGM("CRC error");
|
||||
|
||||
if (!good_data(tmp)) {
|
||||
|
|
@ -204,15 +204,15 @@ void BDS_Leveling::process() {
|
|||
SERIAL_ECHOLNPGM("c_z0:", planner.get_axis_position_mm(Z_AXIS), "-", pos_zero_offset);
|
||||
|
||||
// Move the z axis instead of enabling the Z axis with M17
|
||||
// TODO: Use do_blocking_move_to_z for synchronized move.
|
||||
current_position.z = 0;
|
||||
sync_plan_position();
|
||||
// TODO: Use motion.blocking_move_z for synchronized move.
|
||||
motion.position.z = 0;
|
||||
motion.sync_plan_position();
|
||||
gcode.process_subcommands_now(F("G1Z0.05"));
|
||||
safe_delay(300);
|
||||
gcode.process_subcommands_now(F("G1Z0.00"));
|
||||
safe_delay(300);
|
||||
current_position.z = 0;
|
||||
sync_plan_position();
|
||||
motion.position.z = 0;
|
||||
motion.sync_plan_position();
|
||||
//safe_delay(1000);
|
||||
|
||||
while ((planner.get_axis_position_mm(Z_AXIS) - pos_zero_offset) > 0.00001f) {
|
||||
|
|
@ -235,10 +235,10 @@ void BDS_Leveling::process() {
|
|||
}
|
||||
else {
|
||||
char tmp_1[32];
|
||||
// TODO: Use prepare_internal_move_to_destination to guarantee machine space
|
||||
// TODO: Use motion.prepare_internal_move_to_destination to guarantee machine space
|
||||
sprintf_P(tmp_1, PSTR("G1Z%d.%d"), int(zpos), int(zpos * 10) % 10);
|
||||
gcode.process_subcommands_now(tmp_1);
|
||||
SERIAL_ECHO(tmp_1); SERIAL_ECHOLNPGM(", Z:", current_position.z);
|
||||
SERIAL_ECHO(tmp_1); SERIAL_ECHOLNPGM(", Z:", motion.position.z);
|
||||
uint16_t failcount = 300;
|
||||
for (float tmp_k = 0; abs(zpos - tmp_k) > 0.006f && failcount--;) {
|
||||
tmp_k = planner.get_axis_position_mm(Z_AXIS) - pos_zero_offset;
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ void set_bed_leveling_enabled(const bool enable/*=true*/) {
|
|||
auto _report_leveling = []{
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
if (planner.leveling_active)
|
||||
DEBUG_POS("Leveling ON", current_position);
|
||||
DEBUG_POS("Leveling ON", motion.position);
|
||||
else
|
||||
DEBUG_POS("Leveling OFF", current_position);
|
||||
DEBUG_POS("Leveling OFF", motion.position);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -76,11 +76,11 @@ void set_bed_leveling_enabled(const bool enable/*=true*/) {
|
|||
planner.synchronize();
|
||||
|
||||
// Get the corrected leveled / unleveled position
|
||||
planner.apply_modifiers(current_position, true); // Physical position with all modifiers
|
||||
FLIP(planner.leveling_active); // Toggle leveling between apply and unapply
|
||||
planner.unapply_modifiers(current_position, true); // Logical position with modifiers removed
|
||||
planner.apply_modifiers(motion.position, true); // Physical position with all modifiers
|
||||
FLIP(planner.leveling_active); // Toggle leveling between apply and unapply
|
||||
planner.unapply_modifiers(motion.position, true); // Logical position with modifiers removed
|
||||
|
||||
sync_plan_position();
|
||||
motion.sync_plan_position();
|
||||
_report_leveling();
|
||||
}
|
||||
}
|
||||
|
|
@ -101,10 +101,10 @@ TemporaryBedLevelingState::TemporaryBedLevelingState(const bool enable) : saved(
|
|||
planner.set_z_fade_height(zfh);
|
||||
|
||||
if (leveling_was_active) {
|
||||
const xyz_pos_t oldpos = current_position;
|
||||
const xyz_pos_t oldpos = motion.position;
|
||||
set_bed_leveling_enabled(true);
|
||||
if (do_report && oldpos != current_position)
|
||||
report_current_position();
|
||||
if (do_report && oldpos != motion.position)
|
||||
motion.report_position();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -198,16 +198,16 @@ void reset_bed_level() {
|
|||
#else
|
||||
#warning "It's recommended to set some MANUAL_PROBE_START_Z value for manual leveling."
|
||||
#endif
|
||||
#if Z_CLEARANCE_BETWEEN_MANUAL_PROBES > 0 // A probe/obstacle clearance exists so there is a raise:
|
||||
#if Z_CLEARANCE_BETWEEN_MANUAL_PROBES > 0 // A probe/obstacle clearance exists so there is a raise:
|
||||
#ifndef MANUAL_PROBE_START_Z
|
||||
const float finalz = current_position.z; // - Use the current Z for starting-Z if no MANUAL_PROBE_START_Z was provided
|
||||
const float finalz = motion.position.z; // - Use the current Z for starting-Z if no MANUAL_PROBE_START_Z was provided
|
||||
#endif
|
||||
do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_MANUAL_PROBES); // - Raise Z, then move to the new XY
|
||||
do_blocking_move_to_z(finalz); // - Lower down to the starting Z height, ready for adjustment!
|
||||
#elif defined(MANUAL_PROBE_START_Z) // A starting-Z was provided, but there's no raise:
|
||||
do_blocking_move_to_xy_z(pos, finalz); // - Move in XY then down to the starting Z height, ready for adjustment!
|
||||
#else // Zero raise and no starting Z height either:
|
||||
do_blocking_move_to_xy(pos); // - Move over with no raise, ready for adjustment!
|
||||
motion.blocking_move_xy_z(pos, Z_CLEARANCE_BETWEEN_MANUAL_PROBES); // - Raise Z, then move to the new XY
|
||||
motion.blocking_move_z(finalz); // - Lower down to the starting Z height, ready for adjustment!
|
||||
#elif defined(MANUAL_PROBE_START_Z) // A starting-Z was provided, but there's no raise:
|
||||
motion.blocking_move_xy_z(pos, finalz); // - Move in XY then down to the starting Z height, ready for adjustment!
|
||||
#else // Zero raise and no starting Z height either:
|
||||
motion.blocking_move_xy(pos); // - Move over with no raise, ready for adjustment!
|
||||
#endif
|
||||
|
||||
TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
*/
|
||||
void mesh_bed_leveling::line_to_destination(const feedRate_t scaled_fr_mm_s, uint8_t x_splits, uint8_t y_splits) {
|
||||
// Get current and destination cells for this line
|
||||
xy_uint8_t scel = cell_indexes(current_position), ecel = cell_indexes(destination);
|
||||
xy_uint8_t scel = cell_indexes(motion.position), ecel = cell_indexes(motion.destination);
|
||||
NOMORE(scel.x, GRID_MAX_CELLS_X - 1);
|
||||
NOMORE(scel.y, GRID_MAX_CELLS_Y - 1);
|
||||
NOMORE(ecel.x, GRID_MAX_CELLS_X - 1);
|
||||
|
|
@ -71,12 +71,12 @@
|
|||
|
||||
// Start and end in the same cell? No split needed.
|
||||
if (scel == ecel) {
|
||||
current_position = destination;
|
||||
line_to_current_position(scaled_fr_mm_s);
|
||||
motion.position = motion.destination;
|
||||
motion.goto_current_position(scaled_fr_mm_s);
|
||||
return;
|
||||
}
|
||||
|
||||
#define MBL_SEGMENT_END(A) (current_position.A + (destination.A - current_position.A) * normalized_dist)
|
||||
#define MBL_SEGMENT_END(A) (motion.position.A + (motion.destination.A - motion.position.A) * normalized_dist)
|
||||
|
||||
float normalized_dist;
|
||||
xyze_pos_t dest;
|
||||
|
|
@ -87,36 +87,36 @@
|
|||
if (ecel.x != scel.x && TEST(x_splits, gcx)) {
|
||||
// Split on the X grid line
|
||||
CBI(x_splits, gcx);
|
||||
dest = destination;
|
||||
destination.x = index_to_xpos[gcx];
|
||||
normalized_dist = (destination.x - current_position.x) / (dest.x - current_position.x);
|
||||
destination.y = MBL_SEGMENT_END(y);
|
||||
dest = motion.destination;
|
||||
motion.destination.x = index_to_xpos[gcx];
|
||||
normalized_dist = (motion.destination.x - motion.position.x) / (dest.x - motion.position.x);
|
||||
motion.destination.y = MBL_SEGMENT_END(y);
|
||||
}
|
||||
// Crosses on the Y and not already split on this Y?
|
||||
else if (ecel.y != scel.y && TEST(y_splits, gcy)) {
|
||||
// Split on the Y grid line
|
||||
CBI(y_splits, gcy);
|
||||
dest = destination;
|
||||
destination.y = index_to_ypos[gcy];
|
||||
normalized_dist = (destination.y - current_position.y) / (dest.y - current_position.y);
|
||||
destination.x = MBL_SEGMENT_END(x);
|
||||
dest = motion.destination;
|
||||
motion.destination.y = index_to_ypos[gcy];
|
||||
normalized_dist = (motion.destination.y - motion.position.y) / (dest.y - motion.position.y);
|
||||
motion.destination.x = MBL_SEGMENT_END(x);
|
||||
}
|
||||
else {
|
||||
// Must already have been split on these border(s)
|
||||
// This should be a rare case.
|
||||
current_position = destination;
|
||||
line_to_current_position(scaled_fr_mm_s);
|
||||
motion.position = motion.destination;
|
||||
motion.goto_current_position(scaled_fr_mm_s);
|
||||
return;
|
||||
}
|
||||
|
||||
destination.z = MBL_SEGMENT_END(z);
|
||||
destination.e = MBL_SEGMENT_END(e);
|
||||
motion.destination.z = MBL_SEGMENT_END(z);
|
||||
motion.destination.e = MBL_SEGMENT_END(e);
|
||||
|
||||
// Do the split and look for more borders
|
||||
line_to_destination(scaled_fr_mm_s, x_splits, y_splits);
|
||||
|
||||
// Restore destination from stack
|
||||
destination = dest;
|
||||
motion.destination = dest;
|
||||
line_to_destination(scaled_fr_mm_s, x_splits, y_splits);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ void unified_bed_leveling::reset() {
|
|||
#if ENABLED(EXTENSIBLE_UI)
|
||||
GRID_LOOP(x, y) ExtUI::onMeshUpdate(x, y, 0);
|
||||
#endif
|
||||
if (was_enabled) report_current_position();
|
||||
if (was_enabled) motion.report_position();
|
||||
}
|
||||
|
||||
void unified_bed_leveling::invalidate() {
|
||||
|
|
@ -184,7 +184,7 @@ void unified_bed_leveling::display_map(const uint8_t map_type) {
|
|||
// Add XY probe offset from extruder because probe.probe_at_point() subtracts them when
|
||||
// moving to the XY position to be measured. This ensures better agreement between
|
||||
// the current Z position after G28 and the mesh values.
|
||||
const xy_int8_t curr = closest_indexes(xy_pos_t(current_position) + probe.offset_xy);
|
||||
const xy_int8_t curr = closest_indexes(xy_pos_t(motion.position) + probe.offset_xy);
|
||||
|
||||
if (!lcd) SERIAL_EOL();
|
||||
for (int8_t j = (GRID_MAX_POINTS_Y) - 1; j >= 0; j--) {
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ void unified_bed_leveling::G29() {
|
|||
restore_ubl_active_state(false); // ...without telling ExtUI "done"
|
||||
#else
|
||||
// Send 'N' to force homing before G29 (internal only)
|
||||
if (axes_should_home() || parser.seen_test('N')) gcode.home_all_axes();
|
||||
if (motion.axes_should_home() || parser.seen_test('N')) gcode.home_all_axes();
|
||||
#endif
|
||||
probe.use_probing_tool();
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ void unified_bed_leveling::G29() {
|
|||
|
||||
// Position bed horizontally and Z probe vertically.
|
||||
#if HAS_SAFE_BED_LEVELING
|
||||
xyze_pos_t safe_position = current_position;
|
||||
xyze_pos_t safe_position = motion.position;
|
||||
#ifdef SAFE_BED_LEVELING_START_X
|
||||
safe_position.x = SAFE_BED_LEVELING_START_X;
|
||||
#endif
|
||||
|
|
@ -364,7 +364,7 @@ void unified_bed_leveling::G29() {
|
|||
safe_position.w = SAFE_BED_LEVELING_START_W;
|
||||
#endif
|
||||
|
||||
do_blocking_move_to(safe_position);
|
||||
motion.blocking_move(safe_position);
|
||||
#endif // HAS_SAFE_BED_LEVELING
|
||||
}
|
||||
|
||||
|
|
@ -444,9 +444,9 @@ void unified_bed_leveling::G29() {
|
|||
tilt_mesh_based_on_probed_grid(param.J_grid_size == 0); // Zero size does 3-Point
|
||||
restore_ubl_active_state();
|
||||
#if ENABLED(UBL_G29_J_RECENTER)
|
||||
do_blocking_move_to_xy(0.5f * ((MESH_MIN_X) + (MESH_MAX_X)), 0.5f * ((MESH_MIN_Y) + (MESH_MAX_Y)));
|
||||
motion.blocking_move_xy(0.5f * ((MESH_MIN_X) + (MESH_MAX_X)), 0.5f * ((MESH_MIN_Y) + (MESH_MAX_Y)));
|
||||
#endif
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
SET_PROBE_DEPLOYED(true);
|
||||
}
|
||||
|
||||
|
|
@ -481,7 +481,7 @@ void unified_bed_leveling::G29() {
|
|||
SERIAL_ECHOLN(F("Probing around ("), param.XY_pos.x, C(','), param.XY_pos.y, F(").\n"));
|
||||
probe_entire_mesh(param.XY_pos, parser.seen_test('T'), parser.seen_test('E'), parser.seen_test('U'));
|
||||
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
SET_PROBE_DEPLOYED(true);
|
||||
} break;
|
||||
|
||||
|
|
@ -493,7 +493,7 @@ void unified_bed_leveling::G29() {
|
|||
// Manually Probe Mesh in areas that can't be reached by the probe
|
||||
//
|
||||
SERIAL_ECHOLNPGM("Manually probing unreachable points.");
|
||||
do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES);
|
||||
motion.do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES);
|
||||
|
||||
if (parser.seen_test('C') && !param.XY_seen) {
|
||||
|
||||
|
|
@ -523,7 +523,7 @@ void unified_bed_leveling::G29() {
|
|||
SET_PROBE_DEPLOYED(true);
|
||||
}
|
||||
|
||||
if (!position_is_reachable(param.XY_pos)) {
|
||||
if (!motion.can_reach(param.XY_pos)) {
|
||||
SERIAL_ECHOLNPGM("XY outside printable radius.");
|
||||
return;
|
||||
}
|
||||
|
|
@ -533,7 +533,7 @@ void unified_bed_leveling::G29() {
|
|||
|
||||
SERIAL_ECHOLNPGM("G29 P2 finished.");
|
||||
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
|
||||
#else
|
||||
|
||||
|
|
@ -827,7 +827,7 @@ void unified_bed_leveling::shift_mesh_height(const float zoffs) {
|
|||
|
||||
probe.move_z_after_probing();
|
||||
|
||||
do_blocking_move_to_xy(
|
||||
motion.blocking_move_xy(
|
||||
constrain(nearby.x - probe.offset_xy.x, MESH_MIN_X, MESH_MAX_X),
|
||||
constrain(nearby.y - probe.offset_xy.y, MESH_MIN_Y, MESH_MAX_Y)
|
||||
);
|
||||
|
|
@ -874,7 +874,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
|
|||
marlin.idle();
|
||||
gcode.reset_stepper_timeout(); // Keep steppers powered
|
||||
if (encoder_diff) {
|
||||
do_blocking_move_to_z(current_position.z + float(encoder_diff) * multiplier);
|
||||
motion.blocking_move_z(motion.position.z + float(encoder_diff) * multiplier);
|
||||
encoder_diff = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -884,7 +884,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
|
|||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
const float z_step = 0.01f;
|
||||
move_z_with_encoder(z_step);
|
||||
return current_position.z;
|
||||
return motion.position.z;
|
||||
}
|
||||
|
||||
static void echo_and_take_a_measurement() { SERIAL_ECHOLNPGM(" and take a measurement."); }
|
||||
|
|
@ -893,7 +893,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
|
|||
ui.capture();
|
||||
save_ubl_active_state_and_disable(); // Disable bed level correction for probing
|
||||
|
||||
do_blocking_move_to(
|
||||
motion.blocking_move(
|
||||
xyz_pos_t({
|
||||
0.5f * ((MESH_MIN_X) + (MESH_MAX_X)),
|
||||
0.5f * ((MESH_MIN_Y) + (MESH_MAX_Y)),
|
||||
|
|
@ -927,14 +927,14 @@ void set_message_with_feedback(FSTR_P const fstr) {
|
|||
echo_and_take_a_measurement();
|
||||
|
||||
const float z1 = measure_point_with_encoder();
|
||||
do_z_clearance_by(SIZE_OF_LITTLE_RAISE);
|
||||
motion.do_z_clearance_by(SIZE_OF_LITTLE_RAISE);
|
||||
|
||||
SERIAL_ECHOPGM("Remove shim");
|
||||
LCD_MESSAGE(MSG_UBL_BC_REMOVE);
|
||||
echo_and_take_a_measurement();
|
||||
|
||||
const float z2 = measure_point_with_encoder();
|
||||
do_z_clearance_by(Z_CLEARANCE_BETWEEN_PROBES);
|
||||
motion.do_z_clearance_by(Z_CLEARANCE_BETWEEN_PROBES);
|
||||
|
||||
const float thickness = ABS(z1 - z2);
|
||||
|
||||
|
|
@ -956,7 +956,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
|
|||
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart());
|
||||
|
||||
save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained
|
||||
do_blocking_move_to_xy_z(current_position, z_clearance);
|
||||
motion.blocking_move_xy_z(motion.position, z_clearance);
|
||||
|
||||
ui.return_to_status();
|
||||
|
||||
|
|
@ -969,12 +969,12 @@ void set_message_with_feedback(FSTR_P const fstr) {
|
|||
|
||||
const xyz_pos_t ppos = { get_mesh_x(lpos.x), get_mesh_y(lpos.y), z_clearance };
|
||||
|
||||
if (!position_is_reachable(ppos)) break; // SHOULD NOT OCCUR (find_closest_mesh_point only returns reachable points)
|
||||
if (!motion.can_reach(ppos)) break; // SHOULD NOT OCCUR (find_closest_mesh_point only returns reachable points)
|
||||
|
||||
LCD_MESSAGE(MSG_UBL_MOVING_TO_NEXT);
|
||||
|
||||
do_blocking_move_to(ppos);
|
||||
do_z_clearance(z_clearance);
|
||||
motion.blocking_move(ppos);
|
||||
motion.do_z_clearance(z_clearance);
|
||||
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
ui.capture();
|
||||
|
|
@ -995,11 +995,11 @@ void set_message_with_feedback(FSTR_P const fstr) {
|
|||
|
||||
if (_click_and_hold([]{
|
||||
SERIAL_ECHOLNPGM("\nMesh only partially populated.");
|
||||
do_z_clearance(Z_CLEARANCE_DEPLOY_PROBE);
|
||||
motion.do_z_clearance(Z_CLEARANCE_DEPLOY_PROBE);
|
||||
})) return restore_ubl_active_state();
|
||||
|
||||
// Store the Z position minus the shim height
|
||||
z_values[lpos.x][lpos.y] = current_position.z - thick;
|
||||
z_values[lpos.x][lpos.y] = motion.position.z - thick;
|
||||
|
||||
// Tell the external UI to update
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(location, z_values[lpos.x][lpos.y]));
|
||||
|
|
@ -1012,7 +1012,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
|
|||
if (do_ubl_mesh_map) display_map(param.T_map_type); // show user where we're probing
|
||||
|
||||
restore_ubl_active_state();
|
||||
do_blocking_move_to_xy_z(pos, Z_CLEARANCE_DEPLOY_PROBE);
|
||||
motion.blocking_move_xy_z(pos, Z_CLEARANCE_DEPLOY_PROBE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1033,7 +1033,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
|
|||
|
||||
mesh_index_pair location;
|
||||
|
||||
if (!position_is_reachable(pos)) {
|
||||
if (!motion.can_reach(pos)) {
|
||||
SERIAL_ECHOLNPGM("(X,Y) outside printable radius.");
|
||||
return;
|
||||
}
|
||||
|
|
@ -1043,7 +1043,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
|
|||
LCD_MESSAGE(MSG_UBL_FINE_TUNE_MESH);
|
||||
ui.capture(); // Take over control of the LCD encoder
|
||||
|
||||
do_blocking_move_to_xy_z(pos, Z_TWEEN_SAFE_CLEARANCE); // Move to the given XY with probe clearance
|
||||
motion.blocking_move_xy_z(pos, Z_TWEEN_SAFE_CLEARANCE); // Move to the given XY with probe clearance
|
||||
|
||||
MeshFlags done_flags{0};
|
||||
const xy_int8_t &lpos = location.pos;
|
||||
|
|
@ -1062,18 +1062,18 @@ void set_message_with_feedback(FSTR_P const fstr) {
|
|||
// location is used on the next loop
|
||||
const xyz_pos_t raw = { get_mesh_x(lpos.x), get_mesh_y(lpos.y), Z_TWEEN_SAFE_CLEARANCE };
|
||||
|
||||
if (!position_is_reachable(raw)) break; // SHOULD NOT OCCUR (find_closest_mesh_point_of_type only returns reachable)
|
||||
if (!motion.can_reach(raw)) break; // SHOULD NOT OCCUR (find_closest_mesh_point_of_type only returns reachable)
|
||||
|
||||
do_blocking_move_to(raw); // Move the nozzle to the edit point with probe clearance
|
||||
motion.blocking_move(raw); // Move the nozzle to the edit point with probe clearance
|
||||
|
||||
TERN_(UBL_MESH_EDIT_MOVES_Z, do_blocking_move_to_z(h_offset)); // Move Z to the given 'H' offset before editing
|
||||
TERN_(UBL_MESH_EDIT_MOVES_Z, motion.blocking_move_z(h_offset)); // Move Z to the given 'H' offset before editing
|
||||
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
|
||||
if (do_ubl_mesh_map) display_map(param.T_map_type); // Display the current point
|
||||
|
||||
#if IS_TFTGLCD_PANEL
|
||||
ui.ubl_plot(lpos.x, lpos.y); // update plot screen
|
||||
ui.ubl_plot(lpos.x, lpos.y); // Update plot screen
|
||||
#endif
|
||||
|
||||
ui.refresh();
|
||||
|
|
@ -1084,23 +1084,23 @@ void set_message_with_feedback(FSTR_P const fstr) {
|
|||
|
||||
ui.ubl_mesh_edit_start(new_z);
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
motion.set_soft_endstop_loose(true);
|
||||
|
||||
do {
|
||||
marlin.idle_no_sleep();
|
||||
new_z = ui.ubl_mesh_value();
|
||||
TERN_(UBL_MESH_EDIT_MOVES_Z, do_blocking_move_to_z(h_offset + new_z)); // Move the nozzle as the point is edited
|
||||
TERN_(UBL_MESH_EDIT_MOVES_Z, motion.blocking_move_z(h_offset + new_z)); // Move the nozzle as the point is edited
|
||||
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
||||
} while (!ui.button_pressed());
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
motion.set_soft_endstop_loose(false);
|
||||
|
||||
if (!lcd_map_control) ui.return_to_status(); // Just editing a single point? Return to status
|
||||
|
||||
// Button held down? Abort editing
|
||||
if (_click_and_hold([]{
|
||||
ui.return_to_status();
|
||||
do_z_clearance(Z_TWEEN_SAFE_CLEARANCE);
|
||||
motion.do_z_clearance(Z_TWEEN_SAFE_CLEARANCE);
|
||||
set_message_with_feedback(GET_TEXT_F(MSG_EDITING_STOPPED));
|
||||
})) break;
|
||||
|
||||
|
|
@ -1120,7 +1120,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
|
|||
if (do_ubl_mesh_map) display_map(param.T_map_type);
|
||||
restore_ubl_active_state();
|
||||
|
||||
do_blocking_move_to_xy_z(pos, Z_TWEEN_SAFE_CLEARANCE);
|
||||
motion.blocking_move_xy_z(pos, Z_TWEEN_SAFE_CLEARANCE);
|
||||
|
||||
LCD_MESSAGE(MSG_UBL_DONE_EDITING_MESH);
|
||||
SERIAL_ECHOLNPGM("Done Editing Mesh");
|
||||
|
|
@ -1191,9 +1191,9 @@ bool unified_bed_leveling::G29_parse_parameters() {
|
|||
}
|
||||
|
||||
param.XY_seen.x = parser.seenval('X');
|
||||
float sx = param.XY_seen.x ? parser.value_float() : current_position.x;
|
||||
float sx = param.XY_seen.x ? parser.value_float() : motion.position.x;
|
||||
param.XY_seen.y = parser.seenval('Y');
|
||||
float sy = param.XY_seen.y ? parser.value_float() : current_position.y;
|
||||
float sy = param.XY_seen.y ? parser.value_float() : motion.position.y;
|
||||
|
||||
if (param.XY_seen.x != param.XY_seen.y) {
|
||||
SERIAL_ECHOLNPGM("Both X & Y locations must be specified.\n");
|
||||
|
|
@ -1358,7 +1358,7 @@ mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
|
|||
// Also for round beds, there are grid points outside the bed the nozzle can't reach.
|
||||
// Prune them from the list and ignore them till the next Phase (manual nozzle probing).
|
||||
|
||||
if (!(d->probe_relative ? probe.can_reach(mpos) : position_is_reachable(mpos)))
|
||||
if (!(d->probe_relative ? probe.can_reach(mpos) : motion.can_reach(mpos)))
|
||||
return false;
|
||||
d->closest.pos.set(i, j);
|
||||
return true;
|
||||
|
|
@ -1402,12 +1402,12 @@ mesh_index_pair unified_bed_leveling::find_closest_mesh_point_of_type(const Mesh
|
|||
// Also for round beds, there are grid points outside the bed the nozzle can't reach.
|
||||
// Prune them from the list and ignore them till the next Phase (manual nozzle probing).
|
||||
|
||||
if (!(probe_relative ? probe.can_reach(mpos) : position_is_reachable(mpos)))
|
||||
if (!(probe_relative ? probe.can_reach(mpos) : motion.can_reach(mpos)))
|
||||
continue;
|
||||
|
||||
// Reachable. Check if it's the best_so_far location to the nozzle.
|
||||
|
||||
const xy_pos_t diff = current_position - mpos;
|
||||
const xy_pos_t diff = motion.position - mpos;
|
||||
const float distance = (ref - mpos).magnitude() + diff.magnitude() * 0.1f;
|
||||
|
||||
// factor in the distance from the current location for the normal case
|
||||
|
|
@ -1771,14 +1771,14 @@ void unified_bed_leveling::smart_fill_mesh() {
|
|||
|
||||
SERIAL_ECHOPGM("X-Axis Mesh Points at: ");
|
||||
for (uint8_t i = 0; i < GRID_MAX_POINTS_X; ++i) {
|
||||
SERIAL_ECHO(p_float_t(LOGICAL_X_POSITION(get_mesh_x(i)), 3), F(" "));
|
||||
SERIAL_ECHO(p_float_t(motion.logical_x(get_mesh_x(i)), 3), F(" "));
|
||||
serial_delay(25);
|
||||
}
|
||||
SERIAL_EOL();
|
||||
|
||||
SERIAL_ECHOPGM("Y-Axis Mesh Points at: ");
|
||||
for (uint8_t i = 0; i < GRID_MAX_POINTS_Y; ++i) {
|
||||
SERIAL_ECHO(p_float_t(LOGICAL_Y_POSITION(get_mesh_y(i)), 3), F(" "));
|
||||
SERIAL_ECHO(p_float_t(motion.logical_y(get_mesh_y(i)), 3), F(" "));
|
||||
serial_delay(25);
|
||||
}
|
||||
SERIAL_EOL();
|
||||
|
|
|
|||
|
|
@ -53,11 +53,11 @@
|
|||
* just do the required Z-Height correction, call the Planner's buffer_line() routine, and leave
|
||||
*/
|
||||
#if HAS_POSITION_MODIFIERS
|
||||
xyze_pos_t start = current_position, end = destination;
|
||||
xyze_pos_t start = motion.position, end = motion.destination;
|
||||
planner.apply_modifiers(start);
|
||||
planner.apply_modifiers(end);
|
||||
#else
|
||||
const xyze_pos_t &start = current_position, &end = destination;
|
||||
const xyze_pos_t &start = motion.position, &end = motion.destination;
|
||||
#endif
|
||||
|
||||
const xy_uint8_t istart = cell_indexes(start), iend = cell_indexes(end);
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
|
||||
end.z += UBL_Z_RAISE_WHEN_OFF_MESH;
|
||||
planner.buffer_segment(end, scaled_fr_mm_s, extruder);
|
||||
current_position = destination;
|
||||
motion.position = motion.destination;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (!isnan(z0)) end.z += z0;
|
||||
planner.buffer_segment(end, scaled_fr_mm_s, extruder);
|
||||
current_position = destination;
|
||||
motion.position = motion.destination;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -190,10 +190,10 @@
|
|||
}
|
||||
|
||||
// At the final destination? Usually not, but when on a Y Mesh Line it's completed.
|
||||
if (xy_pos_t(current_position) != xy_pos_t(end))
|
||||
if (xy_pos_t(motion.position) != xy_pos_t(end))
|
||||
goto FINAL_MOVE;
|
||||
|
||||
current_position = destination;
|
||||
motion.position = motion.destination;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -240,10 +240,10 @@
|
|||
DEBUG_ECHOLNPGM("[ubl] skip Y segment");
|
||||
}
|
||||
|
||||
if (xy_pos_t(current_position) != xy_pos_t(end))
|
||||
if (xy_pos_t(motion.position) != xy_pos_t(end))
|
||||
goto FINAL_MOVE;
|
||||
|
||||
current_position = destination;
|
||||
motion.position = motion.destination;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -324,10 +324,10 @@
|
|||
if (cnt.x < 0 || cnt.y < 0) break; // Too far! Exit the loop and go to FINAL_MOVE
|
||||
}
|
||||
|
||||
if (xy_pos_t(current_position) != xy_pos_t(end))
|
||||
if (xy_pos_t(motion.position) != xy_pos_t(end))
|
||||
goto FINAL_MOVE;
|
||||
|
||||
current_position = destination;
|
||||
motion.position = motion.destination;
|
||||
}
|
||||
|
||||
#else // UBL_SEGMENTED
|
||||
|
|
@ -347,15 +347,15 @@
|
|||
/**
|
||||
* Prepare a segmented linear move for DELTA/SCARA/CARTESIAN with UBL and FADE semantics.
|
||||
* This calls planner.buffer_segment multiple times for small incremental moves.
|
||||
* Returns true if did NOT move, false if moved (requires current_position update).
|
||||
* Returns true if did NOT move, false if moved (requires motion.position update).
|
||||
*/
|
||||
|
||||
bool __O2 unified_bed_leveling::line_to_destination_segmented(const feedRate_t scaled_fr_mm_s) {
|
||||
|
||||
if (!position_is_reachable(destination)) // fail if moving outside reachable boundary
|
||||
return true; // did not move, so current_position still accurate
|
||||
if (!motion.can_reach(motion.destination)) // Fail if moving outside reachable boundary
|
||||
return true; // Did not move, so motion.position still accurate
|
||||
|
||||
const xyze_pos_t total = destination - current_position;
|
||||
const xyze_pos_t total = motion.destination - motion.position;
|
||||
|
||||
const float cart_xy_mm_2 = HYPOT2(total.x, total.y),
|
||||
cart_xy_mm = SQRT(cart_xy_mm_2); // Total XY distance
|
||||
|
|
@ -383,22 +383,22 @@
|
|||
// Note that E segment distance could vary slightly as z mesh height
|
||||
// changes for each segment, but small enough to ignore.
|
||||
|
||||
xyze_pos_t raw = current_position;
|
||||
xyze_pos_t raw = motion.position;
|
||||
|
||||
// Just do plain segmentation if UBL is inactive or the target is above the fade height
|
||||
if (!planner.leveling_active || !planner.leveling_active_at_z(destination.z)) {
|
||||
if (!planner.leveling_active || !planner.leveling_active_at_z(motion.destination.z)) {
|
||||
while (--segments) {
|
||||
raw += diff;
|
||||
planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, hints);
|
||||
planner.buffer_line(raw, scaled_fr_mm_s, motion.extruder, hints);
|
||||
}
|
||||
planner.buffer_line(destination, scaled_fr_mm_s, active_extruder, hints);
|
||||
planner.buffer_line(motion.destination, scaled_fr_mm_s, motion.extruder, hints);
|
||||
return false; // Did not set current from destination
|
||||
}
|
||||
|
||||
// Otherwise perform per-segment leveling
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
const float fade_scaling_factor = planner.fade_scaling_factor_for_z(destination.z);
|
||||
const float fade_scaling_factor = planner.fade_scaling_factor_for_z(motion.destination.z);
|
||||
#endif
|
||||
|
||||
// Move to first segment destination
|
||||
|
|
@ -456,13 +456,13 @@
|
|||
|
||||
for (;;) { // for all segments within this mesh cell
|
||||
|
||||
if (--segments == 0) raw = destination; // if this is last segment, use destination for exact
|
||||
if (--segments == 0) raw = motion.destination; // If this is last segment, use destination for exact
|
||||
|
||||
const float z_cxcy = (z_cxy0 + z_cxym * cell.y) // interpolated mesh z height along cell.x at cell.y
|
||||
TERN_(ENABLE_LEVELING_FADE_HEIGHT, * fade_scaling_factor); // apply fade factor to interpolated height
|
||||
|
||||
const float oldz = raw.z; raw.z += z_cxcy;
|
||||
planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, hints);
|
||||
planner.buffer_line(raw, scaled_fr_mm_s, motion.extruder, hints);
|
||||
raw.z = oldz;
|
||||
|
||||
if (segments == 0) // done with last segment
|
||||
|
|
@ -483,7 +483,7 @@
|
|||
} // segment loop
|
||||
} // cell loop
|
||||
|
||||
return false; // caller will update current_position
|
||||
return false; // caller will update motion.position
|
||||
}
|
||||
|
||||
#endif // UBL_SEGMENTED
|
||||
|
|
|
|||
|
|
@ -54,10 +54,7 @@ EmergencyParser emergency_parser;
|
|||
#endif
|
||||
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
// From motion.h, which cannot be included here
|
||||
void report_current_position_moving();
|
||||
void quickpause_stepper();
|
||||
void quickresume_stepper();
|
||||
#include "../module/motion.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(SOFT_FEED_HOLD)
|
||||
|
|
@ -226,9 +223,9 @@ void EmergencyParser::update(EmergencyParser::State &state, const uint8_t c) {
|
|||
case EP_M876SN: hostui.handle_response(M876_reason); break;
|
||||
#endif
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
case EP_GRBL_STATUS: report_current_position_moving(); break;
|
||||
case EP_GRBL_PAUSE: TERN(SOFT_FEED_HOLD, realtime_ramping_pause_flag = true, quickpause_stepper()); break;
|
||||
case EP_GRBL_RESUME: TERN(SOFT_FEED_HOLD, realtime_ramping_pause_flag = false, quickresume_stepper()); break;
|
||||
case EP_GRBL_STATUS: motion.report_position_moving(); break;
|
||||
case EP_GRBL_PAUSE: TERN(SOFT_FEED_HOLD, realtime_ramping_pause_flag = true, motion.quickpause_stepper()); break;
|
||||
case EP_GRBL_RESUME: TERN(SOFT_FEED_HOLD, realtime_ramping_pause_flag = false, motion.quickresume_stepper()); break;
|
||||
#endif
|
||||
#if ENABLED(SOFT_RESET_VIA_SERIAL)
|
||||
case EP_KILL: hal.reboot(); break;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ void EasythreedUI::loadButton() {
|
|||
if (READ(BTN_RETRACT) && READ(BTN_FEED)) { // Switch in center position (stop)
|
||||
flag = false; // Restore flag to false
|
||||
filament_status = FS_IDLE; // Go back to idle state
|
||||
quickstop_stepper(); // Hard-stop all the steppers ... now!
|
||||
motion.quickstop_stepper(); // Hard-stop all the steppers ... now!
|
||||
thermalManager.disable_all_heaters(); // And disable all the heaters
|
||||
blink_interval_ms = LED_ON;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,9 +318,9 @@ bool I2CPositionEncoder::test_axis() {
|
|||
// Only works on XYZ Cartesian machines for the time being
|
||||
if (!(encoderAxis == X_AXIS || encoderAxis == Y_AXIS || encoderAxis == Z_AXIS)) return false;
|
||||
|
||||
const float startPosition = soft_endstop.min[encoderAxis] + 10,
|
||||
endPosition = soft_endstop.max[encoderAxis] - 10;
|
||||
const feedRate_t fr_mm_s = FLOOR(homing_feedrate(encoderAxis));
|
||||
const float startPosition = motion.soft_endstop.min[encoderAxis] + 10,
|
||||
endPosition = motion.soft_endstop.max[encoderAxis] - 10;
|
||||
const feedRate_t fr_mm_s = FLOOR(motion.homing_feedrate(encoderAxis));
|
||||
|
||||
ec = false;
|
||||
|
||||
|
|
@ -373,13 +373,13 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) {
|
|||
|
||||
int32_t startCount, stopCount;
|
||||
|
||||
const feedRate_t fr_mm_s = homing_feedrate(encoderAxis);
|
||||
const feedRate_t fr_mm_s = motion.homing_feedrate(encoderAxis);
|
||||
|
||||
bool oldec = ec;
|
||||
ec = false;
|
||||
|
||||
startDistance = 20;
|
||||
endDistance = soft_endstop.max[encoderAxis] - 20;
|
||||
endDistance = motion.soft_endstop.max[encoderAxis] - 20;
|
||||
travelDistance = endDistance - startDistance;
|
||||
|
||||
xyze_pos_t startCoord, endCoord;
|
||||
|
|
@ -400,7 +400,7 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) {
|
|||
delay(250);
|
||||
startCount = get_position();
|
||||
|
||||
//do_blocking_move_to(endCoord);
|
||||
//motion.blocking_move(endCoord);
|
||||
|
||||
TERN_(HAS_EXTRUDERS, endCoord.e = planner.get_axis_position_mm(E_AXIS));
|
||||
planner.buffer_line(endCoord, fr_mm_s, 0);
|
||||
|
|
|
|||
|
|
@ -92,14 +92,14 @@ void FWRetract::reset() {
|
|||
*/
|
||||
void FWRetract::retract(const bool retracting E_OPTARG(bool swapping/*=false*/)) {
|
||||
// Prevent two retracts or recovers in a row
|
||||
if (retracted[active_extruder] == retracting) return;
|
||||
if (retracted[motion.extruder] == retracting) return;
|
||||
|
||||
// Prevent two swap-retract or recovers in a row
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
// Allow G10 S1 only after G11
|
||||
if (swapping && retracted_swap[active_extruder] == retracting) return;
|
||||
if (swapping && retracted_swap[motion.extruder] == retracting) return;
|
||||
// G11 priority to recover the long retract if activated
|
||||
if (!retracting) swapping = retracted_swap[active_extruder];
|
||||
if (!retracting) swapping = retracted_swap[motion.extruder];
|
||||
#else
|
||||
constexpr bool swapping = false;
|
||||
#endif
|
||||
|
|
@ -108,7 +108,7 @@ void FWRetract::retract(const bool retracting E_OPTARG(bool swapping/*=false*/))
|
|||
SERIAL_ECHOLNPGM(
|
||||
"retracting ", AS_DIGIT(retracting),
|
||||
" swapping ", swapping,
|
||||
" active extruder ", active_extruder
|
||||
" active extruder ", motion.extruder
|
||||
);
|
||||
EXTRUDER_LOOP() {
|
||||
SERIAL_ECHOLNPGM("retracted[", e, "] ", AS_DIGIT(retracted[e]));
|
||||
|
|
@ -116,8 +116,8 @@ void FWRetract::retract(const bool retracting E_OPTARG(bool swapping/*=false*/))
|
|||
SERIAL_ECHOLNPGM("retracted_swap[", e, "] ", AS_DIGIT(retracted_swap[e]));
|
||||
#endif
|
||||
}
|
||||
SERIAL_ECHOLNPGM("current_position.z ", current_position.z);
|
||||
SERIAL_ECHOLNPGM("current_position.e ", current_position.e);
|
||||
SERIAL_ECHOLNPGM("motion.position.z ", motion.position.z);
|
||||
SERIAL_ECHOLNPGM("motion.position.e ", motion.position.e);
|
||||
SERIAL_ECHOLNPGM("current_hop ", current_hop);
|
||||
//*/
|
||||
|
||||
|
|
@ -125,7 +125,7 @@ void FWRetract::retract(const bool retracting E_OPTARG(bool swapping/*=false*/))
|
|||
* (swapping ? settings.swap_retract_length : settings.retract_length);
|
||||
|
||||
// The current position will be the destination for E and Z moves
|
||||
destination = current_position;
|
||||
motion.destination = motion.position;
|
||||
|
||||
#if ENABLED(RETRACT_SYNC_MIXING)
|
||||
const uint8_t old_mixing_tool = mixer.get_current_vtool();
|
||||
|
|
@ -135,8 +135,8 @@ void FWRetract::retract(const bool retracting E_OPTARG(bool swapping/*=false*/))
|
|||
const feedRate_t fr_max_z = planner.settings.max_feedrate_mm_s[Z_AXIS];
|
||||
if (retracting) {
|
||||
// Retract by moving from a faux E position back to the current E position
|
||||
current_retract[active_extruder] = base_retract;
|
||||
prepare_internal_move_to_destination( // set current from destination
|
||||
current_retract[motion.extruder] = base_retract;
|
||||
motion.prepare_internal_move_to_destination( // Set current from destination
|
||||
MUL_TERN(RETRACT_SYNC_MIXING, settings.retract_feedrate_mm_s, MIXING_STEPPERS)
|
||||
);
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ void FWRetract::retract(const bool retracting E_OPTARG(bool swapping/*=false*/))
|
|||
if (!current_hop && settings.retract_zraise > 0.01f) { // Apply hop only once
|
||||
current_hop += settings.retract_zraise; // Add to the hop total (again, only once)
|
||||
// Raise up, set_current_to_destination. Maximum Z feedrate
|
||||
prepare_internal_move_to_destination(fr_max_z);
|
||||
motion.prepare_internal_move_to_destination(fr_max_z);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -152,43 +152,42 @@ void FWRetract::retract(const bool retracting E_OPTARG(bool swapping/*=false*/))
|
|||
if (current_hop) {
|
||||
current_hop = 0;
|
||||
// Lower Z, set_current_to_destination. Maximum Z feedrate
|
||||
prepare_internal_move_to_destination(fr_max_z);
|
||||
motion.prepare_internal_move_to_destination(fr_max_z);
|
||||
}
|
||||
|
||||
// Adjust the current E position by the extra amount to recover
|
||||
// Sync the planner position so the extra amount is recovered
|
||||
const float extra_recover = swapping ? settings.swap_retract_recover_extra : settings.retract_recover_extra;
|
||||
if (extra_recover) {
|
||||
current_position.e -= extra_recover; // Adjust the current E position by the extra amount to recover
|
||||
sync_plan_position_e(); // Sync the planner position so the extra amount is recovered
|
||||
}
|
||||
if (extra_recover) motion.set_and_sync_e(motion.position.e - extra_recover);
|
||||
|
||||
current_retract[active_extruder] = 0;
|
||||
current_retract[motion.extruder] = 0;
|
||||
|
||||
// Recover E, set_current_to_destination
|
||||
const feedRate_t fr_mm_s = swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s;
|
||||
prepare_internal_move_to_destination(MUL_TERN(RETRACT_SYNC_MIXING, fr_mm_s, MIXING_STEPPERS));
|
||||
motion.prepare_internal_move_to_destination(MUL_TERN(RETRACT_SYNC_MIXING, fr_mm_s, MIXING_STEPPERS));
|
||||
}
|
||||
|
||||
TERN_(RETRACT_SYNC_MIXING, mixer.T(old_mixing_tool)); // Restore original mixing tool
|
||||
|
||||
retracted.set(active_extruder, retracting); // Active extruder now retracted / recovered
|
||||
retracted.set(motion.extruder, retracting); // Active extruder now retracted / recovered
|
||||
|
||||
// If swap retract/recover update the retracted_swap flag too
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
if (swapping) retracted_swap.set(active_extruder, retracting);
|
||||
if (swapping) retracted_swap.set(motion.extruder, retracting);
|
||||
#endif
|
||||
|
||||
/* // debugging
|
||||
SERIAL_ECHOLNPGM("retracting ", AS_DIGIT(retracting));
|
||||
SERIAL_ECHOLNPGM("swapping ", AS_DIGIT(swapping));
|
||||
SERIAL_ECHOLNPGM("active_extruder ", active_extruder);
|
||||
SERIAL_ECHOLNPGM("motion.extruder ", motion.extruder);
|
||||
EXTRUDER_LOOP() {
|
||||
SERIAL_ECHOLNPGM("retracted[", e, "] ", AS_DIGIT(retracted[e]));
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
SERIAL_ECHOLNPGM("retracted_swap[", e, "] ", AS_DIGIT(retracted_swap[e]));
|
||||
#endif
|
||||
}
|
||||
SERIAL_ECHOLNPGM("current_position.z ", current_position.z);
|
||||
SERIAL_ECHOLNPGM("current_position.e ", current_position.e);
|
||||
SERIAL_ECHOLNPGM("motion.position.z ", motion.position.z);
|
||||
SERIAL_ECHOLNPGM("motion.position.e ", motion.position.e);
|
||||
SERIAL_ECHOLNPGM("current_hop ", current_hop);
|
||||
//*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ void HotendIdleProtection::check_hotends(const millis_t &ms) {
|
|||
|
||||
void HotendIdleProtection::check_e_motion(const millis_t &ms) {
|
||||
static float old_e_position = 0;
|
||||
if (old_e_position != current_position.e) {
|
||||
old_e_position = current_position.e; // Track filament motion
|
||||
if (old_e_position != motion.position.e) {
|
||||
old_e_position = motion.position.e; // Track filament motion
|
||||
if (next_protect_ms) // If some heater is on then...
|
||||
next_protect_ms = ms + 1000UL * cfg.timeout; // ...delay the timeout till later
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ Joystick joystick;
|
|||
if (injecting_now) return;
|
||||
|
||||
#if ENABLED(NO_MOTION_BEFORE_HOMING)
|
||||
if (TERN0(HAS_JOY_ADC_X, axis_should_home(X_AXIS)) || TERN0(HAS_JOY_ADC_Y, axis_should_home(Y_AXIS)) || TERN0(HAS_JOY_ADC_Z, axis_should_home(Z_AXIS)))
|
||||
if (TERN0(HAS_JOY_ADC_X, motion.axis_should_home(X_AXIS)) || TERN0(HAS_JOY_ADC_Y, motion.axis_should_home(Y_AXIS)) || TERN0(HAS_JOY_ADC_Z, motion.axis_should_home(Z_AXIS)))
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
|
@ -161,12 +161,12 @@ Joystick joystick;
|
|||
}
|
||||
|
||||
if (!UNEAR_ZERO(hypot2)) {
|
||||
current_position += move_dist;
|
||||
apply_motion_limits(current_position);
|
||||
motion.position += move_dist;
|
||||
motion.apply_limits(motion.position);
|
||||
const float length = sqrt(hypot2);
|
||||
PlannerHints hints(length);
|
||||
injecting_now = true;
|
||||
planner.buffer_line(current_position, length / seg_time, active_extruder, hints);
|
||||
planner.buffer_line(motion.position, length / seg_time, motion.extruder, hints);
|
||||
injecting_now = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,8 +185,8 @@ void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*=
|
|||
|
||||
void Mixer::update_gradient_for_planner_z() {
|
||||
#if ENABLED(DELTA)
|
||||
get_cartesian_from_steppers();
|
||||
update_gradient_for_z(cartes.z);
|
||||
motion.get_cartesian_from_steppers();
|
||||
update_gradient_for_z(motion.cartes.z);
|
||||
#else
|
||||
update_gradient_for_z(planner.get_axis_position_mm(Z_AXIS));
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ struct E_Step {
|
|||
};
|
||||
|
||||
inline void unscaled_mmu2_e_move(const float dist, const feedRate_t fr_mm_s, const bool sync=true) {
|
||||
current_position.e += dist / planner.e_factor[active_extruder];
|
||||
line_to_current_position(fr_mm_s);
|
||||
motion.position.e += dist / planner.e_factor[motion.extruder];
|
||||
motion.goto_current_position(fr_mm_s);
|
||||
if (sync) planner.synchronize();
|
||||
}
|
||||
|
||||
|
|
@ -505,7 +505,7 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
|
|||
|
||||
if (load_to_gears()) {
|
||||
extruder = index; // filament change is finished
|
||||
active_extruder = 0;
|
||||
motion.extruder = 0;
|
||||
stepper.enable_extruder();
|
||||
SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, extruder);
|
||||
}
|
||||
|
|
@ -531,7 +531,7 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
|
|||
case '?': {
|
||||
#if ENABLED(MMU_MENUS)
|
||||
const uint8_t index = mmu2_choose_filament();
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
while (!thermalManager.wait_for_hotend(motion.extruder, false)) safe_delay(100);
|
||||
load_to_nozzle(index);
|
||||
#else
|
||||
beep_bad_cmd();
|
||||
|
|
@ -550,7 +550,7 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
|
|||
mmu_loop();
|
||||
stepper.enable_extruder();
|
||||
extruder = index;
|
||||
active_extruder = 0;
|
||||
motion.extruder = 0;
|
||||
}
|
||||
#else
|
||||
beep_bad_cmd();
|
||||
|
|
@ -558,7 +558,7 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
|
|||
} break;
|
||||
|
||||
case 'c': {
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
while (!thermalManager.wait_for_hotend(motion.extruder, false)) safe_delay(100);
|
||||
load_to_nozzle_sequence();
|
||||
} break;
|
||||
}
|
||||
|
|
@ -591,7 +591,7 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
|
|||
mmu_continue_loading();
|
||||
//command(MMU_CMD_C0);
|
||||
extruder = index;
|
||||
active_extruder = 0;
|
||||
motion.extruder = 0;
|
||||
|
||||
stepper.enable_extruder();
|
||||
SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, extruder);
|
||||
|
|
@ -619,7 +619,7 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
|
|||
DEBUG_ECHOLNPGM("case ?\n");
|
||||
#if ENABLED(MMU_MENUS)
|
||||
uint8_t index = mmu2_choose_filament();
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
while (!thermalManager.wait_for_hotend(motion.extruder, false)) safe_delay(100);
|
||||
load_to_nozzle(index);
|
||||
#else
|
||||
beep_bad_cmd();
|
||||
|
|
@ -640,7 +640,7 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
|
|||
|
||||
stepper.enable_extruder();
|
||||
extruder = index;
|
||||
active_extruder = 0;
|
||||
motion.extruder = 0;
|
||||
#else
|
||||
beep_bad_cmd();
|
||||
#endif
|
||||
|
|
@ -648,7 +648,7 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
|
|||
|
||||
case 'c': {
|
||||
DEBUG_ECHOLNPGM("case c\n");
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
while (!thermalManager.wait_for_hotend(motion.extruder, false)) safe_delay(100);
|
||||
load_to_nozzle_sequence();
|
||||
} break;
|
||||
}
|
||||
|
|
@ -671,8 +671,8 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
|
|||
stepper.enable_extruder();
|
||||
const millis_t expire_ms = millis() + 3000;
|
||||
do {
|
||||
current_position.e += 1;
|
||||
line_to_current_position(MMU_LOAD_FEEDRATE);
|
||||
motion.position.e += 1;
|
||||
motion.goto_current_position(MMU_LOAD_FEEDRATE);
|
||||
planner.synchronize();
|
||||
// When (T0 rx->ok) load is ready, but in fact it did not load
|
||||
// successfully or an overload created pressure in the extruder.
|
||||
|
|
@ -708,7 +708,7 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
|
|||
manage_response(true, true);
|
||||
command(MMU_CMD_C0);
|
||||
extruder = index; // Filament change is finished
|
||||
active_extruder = 0;
|
||||
motion.extruder = 0;
|
||||
stepper.enable_extruder();
|
||||
SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, extruder);
|
||||
ui.reset_status();
|
||||
|
|
@ -734,7 +734,7 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
|
|||
DEBUG_ECHOLNPGM("case ?\n");
|
||||
#if ENABLED(MMU_MENUS)
|
||||
uint8_t index = mmu2_choose_filament();
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
while (!thermalManager.wait_for_hotend(motion.extruder, false)) safe_delay(100);
|
||||
load_to_nozzle(index);
|
||||
#else
|
||||
beep_bad_cmd();
|
||||
|
|
@ -754,7 +754,7 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
|
|||
|
||||
stepper.enable_extruder();
|
||||
extruder = index;
|
||||
active_extruder = 0;
|
||||
motion.extruder = 0;
|
||||
#else
|
||||
beep_bad_cmd();
|
||||
#endif
|
||||
|
|
@ -762,7 +762,7 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
|
|||
|
||||
case 'c': {
|
||||
DEBUG_ECHOLNPGM("case c\n");
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
while (!thermalManager.wait_for_hotend(motion.extruder, false)) safe_delay(100);
|
||||
load_to_nozzle_sequence();
|
||||
} break;
|
||||
}
|
||||
|
|
@ -806,7 +806,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
|
|||
constexpr xyz_pos_t park_point = NOZZLE_PARK_POINT;
|
||||
bool response = false, mmu_print_saved = false;
|
||||
xyz_pos_t resume_position;
|
||||
celsius_t resume_hotend_temp = thermalManager.degTargetHotend(active_extruder);
|
||||
celsius_t resume_hotend_temp = thermalManager.degTargetHotend(motion.extruder);
|
||||
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
|
||||
|
|
@ -823,12 +823,12 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
|
|||
|
||||
SERIAL_ECHOLNPGM("MMU not responding");
|
||||
|
||||
resume_hotend_temp = thermalManager.degTargetHotend(active_extruder);
|
||||
resume_position = current_position;
|
||||
resume_hotend_temp = thermalManager.degTargetHotend(motion.extruder);
|
||||
resume_position = motion.position;
|
||||
|
||||
if (move_axes && all_axes_homed()) nozzle.park(0, park_point);
|
||||
if (move_axes && motion.all_axes_homed()) nozzle.park(0, park_point);
|
||||
|
||||
if (turn_off_nozzle) thermalManager.setTargetHotend(0, active_extruder);
|
||||
if (turn_off_nozzle) thermalManager.setTargetHotend(0, motion.extruder);
|
||||
|
||||
mmu2_not_responding();
|
||||
}
|
||||
|
|
@ -837,10 +837,10 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
|
|||
SERIAL_ECHOLNPGM("\nMMU starts responding");
|
||||
|
||||
if (turn_off_nozzle && resume_hotend_temp) {
|
||||
thermalManager.setTargetHotend(resume_hotend_temp, active_extruder);
|
||||
thermalManager.setTargetHotend(resume_hotend_temp, motion.extruder);
|
||||
LCD_MESSAGE(MSG_HEATING);
|
||||
ERR_BUZZ();
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(1000);
|
||||
while (!thermalManager.wait_for_hotend(motion.extruder, false)) safe_delay(1000);
|
||||
}
|
||||
|
||||
LCD_MESSAGE(MSG_MMU2_RESUMING);
|
||||
|
|
@ -849,11 +849,11 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
|
||||
if (move_axes && all_axes_homed()) {
|
||||
if (move_axes && motion.all_axes_homed()) {
|
||||
// Move XY to starting position, then Z
|
||||
do_blocking_move_to_xy(resume_position, feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
|
||||
motion.blocking_move_xy(resume_position, feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
|
||||
// Move Z_AXIS to saved position
|
||||
do_blocking_move_to_z(resume_position.z, feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
|
||||
motion.blocking_move_z(resume_position.z, feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
|
@ -935,7 +935,7 @@ void MMU2::load_to_feeder(const uint8_t index) {
|
|||
bool MMU2::load_to_nozzle(const uint8_t index) {
|
||||
if (!_enabled) return false;
|
||||
|
||||
if (thermalManager.tooColdToExtrude(active_extruder)) {
|
||||
if (thermalManager.tooColdToExtrude(motion.extruder)) {
|
||||
mmu2_attn_buzz();
|
||||
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
|
||||
return false;
|
||||
|
|
@ -956,7 +956,7 @@ bool MMU2::load_to_nozzle(const uint8_t index) {
|
|||
if (success) {
|
||||
mmu_loop();
|
||||
extruder = index;
|
||||
active_extruder = 0;
|
||||
motion.extruder = 0;
|
||||
load_to_nozzle_sequence();
|
||||
mmu2_attn_buzz();
|
||||
}
|
||||
|
|
@ -967,7 +967,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
|
|||
|
||||
if (!_enabled) return false;
|
||||
|
||||
if (thermalManager.tooColdToExtrude(active_extruder)) {
|
||||
if (thermalManager.tooColdToExtrude(motion.extruder)) {
|
||||
mmu2_attn_buzz();
|
||||
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
|
||||
return false;
|
||||
|
|
@ -1012,7 +1012,7 @@ bool MMU2::unload() {
|
|||
|
||||
if (!_enabled) return false;
|
||||
|
||||
if (thermalManager.tooColdToExtrude(active_extruder)) {
|
||||
if (thermalManager.tooColdToExtrude(motion.extruder)) {
|
||||
mmu2_attn_buzz();
|
||||
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -362,12 +362,12 @@ namespace MMU3 {
|
|||
* in the slope's sign or check the last machine position.
|
||||
* y(x)
|
||||
* ▲
|
||||
* │ ^◄────────── tryload_length + current_position
|
||||
* │ ^◄────────── tryload_length + motion.position
|
||||
* machine │ / \
|
||||
* position │ / \◄────────── stepper_position_mm + current_position
|
||||
* position │ / \◄────────── stepper_position_mm + motion.position
|
||||
* (mm) │ / \
|
||||
* │ / \
|
||||
* │/ \◄───────current_position
|
||||
* │/ \◄───────motion.position
|
||||
* └──────────────► x
|
||||
* 0 19
|
||||
* pixel #
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
namespace MMU3 {
|
||||
|
||||
static void planner_line_to_current_position(float feedRate_mm_s) {
|
||||
line_to_current_position(feedRate_mm_s);
|
||||
motion.goto_current_position(feedRate_mm_s);
|
||||
}
|
||||
|
||||
static void planner_line_to_current_position_sync(float feedRate_mm_s) {
|
||||
|
|
@ -50,21 +50,21 @@ namespace MMU3 {
|
|||
}
|
||||
|
||||
void extruder_move(const float delta, const float feedRate_mm_s, const bool sync/*=true*/) {
|
||||
current_position.e += delta / planner.e_factor[active_extruder];
|
||||
motion.position.e += delta / planner.e_factor[motion.extruder];
|
||||
planner_line_to_current_position(feedRate_mm_s);
|
||||
if (sync) planner.synchronize();
|
||||
}
|
||||
|
||||
float move_raise_z(const float delta) {
|
||||
//return raise_z(delta);
|
||||
xyze_pos_t current_position_before = current_position;
|
||||
do_z_clearance_by(delta);
|
||||
return (current_position - current_position_before).z;
|
||||
xyze_pos_t current_position_before = motion.position;
|
||||
motion.do_z_clearance_by(delta);
|
||||
return (motion.position - current_position_before).z;
|
||||
}
|
||||
|
||||
void planner_abort_queued_moves() {
|
||||
//planner_abort_hard();
|
||||
quickstop_stepper();
|
||||
motion.quickstop_stepper();
|
||||
|
||||
// Unblock the planner. This should be safe in the
|
||||
// toolchange context. Currently we are mainly aborting
|
||||
|
|
@ -75,41 +75,21 @@ namespace MMU3 {
|
|||
// eoyilmaz: we don't need this part, the print is not aborted
|
||||
}
|
||||
|
||||
void planner_synchronize() {
|
||||
planner.synchronize();
|
||||
}
|
||||
|
||||
bool planner_any_moves() {
|
||||
return planner.has_blocks_queued();
|
||||
}
|
||||
|
||||
float planner_get_machine_position_E_mm() {
|
||||
return current_position.e;
|
||||
}
|
||||
|
||||
float stepper_get_machine_position_E_mm() {
|
||||
return planner.get_axis_position_mm(E_AXIS);
|
||||
}
|
||||
|
||||
float planner_get_current_position_E() {
|
||||
return current_position.e;
|
||||
}
|
||||
|
||||
void planner_set_current_position_E(float e) {
|
||||
current_position.e = e;
|
||||
}
|
||||
|
||||
xyz_pos_t planner_current_position() {
|
||||
return xyz_pos_t(current_position);
|
||||
}
|
||||
void planner_synchronize() { planner.synchronize(); }
|
||||
bool planner_any_moves() { return planner.has_blocks_queued(); }
|
||||
float planner_get_machine_position_E_mm() { return motion.position.e; }
|
||||
float stepper_get_machine_position_E_mm() { return planner.get_axis_position_mm(E_AXIS); }
|
||||
float planner_get_current_position_E() { return motion.position.e; }
|
||||
void planner_set_current_position_E(float e) { motion.position.e = e; }
|
||||
xyz_pos_t planner_current_position() { return xyz_pos_t(motion.position); }
|
||||
|
||||
void motion_blocking_move_xy(float rx, float ry, float feedRate_mm_s) {
|
||||
current_position.set(rx, ry);
|
||||
motion.position.set(rx, ry);
|
||||
planner_line_to_current_position_sync(feedRate_mm_s);
|
||||
}
|
||||
|
||||
void motion_blocking_move_z(float z, float feedRate_mm_s) {
|
||||
current_position.z = z;
|
||||
motion.position.z = z;
|
||||
planner_line_to_current_position_sync(feedRate_mm_s);
|
||||
}
|
||||
|
||||
|
|
@ -165,7 +145,7 @@ namespace MMU3 {
|
|||
void Disable_E0() { stepper.disable_extruder(TERN_(HAS_EXTRUDERS, 0)); }
|
||||
|
||||
bool xy_are_trusted() {
|
||||
return axis_is_trusted(X_AXIS) && axis_is_trusted(Y_AXIS);
|
||||
return motion.axis_is_trusted(X_AXIS) && motion.axis_is_trusted(Y_AXIS);
|
||||
}
|
||||
|
||||
} // MMU3
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=P
|
|||
DEBUG_ECHOLNPGM("... wait:", wait, " mode:", mode);
|
||||
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder))
|
||||
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, active_extruder);
|
||||
if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(motion.extruder))
|
||||
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, motion.extruder);
|
||||
#endif
|
||||
|
||||
ui.pause_show_message(PAUSE_MESSAGE_HEATING, mode);
|
||||
|
|
@ -157,17 +157,17 @@ static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=P
|
|||
rts.updateTempE0();
|
||||
#endif
|
||||
|
||||
if (wait) return thermalManager.wait_for_hotend(active_extruder);
|
||||
if (wait) return thermalManager.wait_for_hotend(motion.extruder);
|
||||
|
||||
// Allow interruption by Emergency Parser M108
|
||||
marlin.wait_for_heatup = TERN1(PREVENT_COLD_EXTRUSION, !thermalManager.allow_cold_extrude);
|
||||
while (marlin.is_heating() && ABS(thermalManager.wholeDegHotend(active_extruder) - thermalManager.degTargetHotend(active_extruder)) > (TEMP_WINDOW))
|
||||
while (marlin.is_heating() && ABS(thermalManager.wholeDegHotend(motion.extruder) - thermalManager.degTargetHotend(motion.extruder)) > (TEMP_WINDOW))
|
||||
marlin.idle();
|
||||
marlin.heatup_done();
|
||||
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
// A user can cancel wait-for-heating with M108
|
||||
if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) {
|
||||
if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(motion.extruder)) {
|
||||
SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -211,7 +211,7 @@ bool load_filament(const float slow_load_length/*=0*/, const float fast_load_len
|
|||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENTLOAD)));
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder);
|
||||
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, motion.extruder);
|
||||
hostui.prompt_do(PROMPT_USER_CONTINUE, F("Load Filament T"), tool, FPSTR(CONTINUE_STR));
|
||||
#endif
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ bool load_filament(const float slow_load_length/*=0*/, const float fast_load_len
|
|||
#if ALL(HAS_FILAMENT_SENSOR, FILAMENT_CHANGE_RESUME_ON_INSERT)
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
#define _CASE_INSERTED(N) case N-1: if (!FILAMENT_IS_OUT(N)) marlin.user_resume(); break;
|
||||
switch (active_extruder) {
|
||||
switch (motion.extruder) {
|
||||
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_INSERTED)
|
||||
}
|
||||
#else
|
||||
|
|
@ -234,17 +234,17 @@ bool load_filament(const float slow_load_length/*=0*/, const float fast_load_len
|
|||
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_LOAD, mode);
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
const int8_t saved_ext = active_extruder;
|
||||
const bool saved_ext_dup_mode = extruder_duplication_enabled;
|
||||
set_duplication_enabled(false, DXC_ext);
|
||||
const int8_t saved_ext = motion.extruder;
|
||||
const bool saved_ext_dup_mode = motion.extruder_duplication;
|
||||
motion.set_extruder_duplication(false, DXC_ext);
|
||||
#endif
|
||||
|
||||
TERN_(BELTPRINTER, do_blocking_move_to_xy(0.00, 50.00));
|
||||
TERN_(BELTPRINTER, motion.blocking_move_xy(0.00, 50.00));
|
||||
|
||||
TERN_(MPCTEMP, MPC::e_paused = true);
|
||||
|
||||
// Slow Load filament
|
||||
if (slow_load_length) unscaled_e_move(slow_load_length, FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE);
|
||||
if (slow_load_length) motion.unscaled_e_move(slow_load_length, FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE);
|
||||
|
||||
// Fast Load Filament
|
||||
if (fast_load_length) {
|
||||
|
|
@ -253,7 +253,7 @@ bool load_filament(const float slow_load_length/*=0*/, const float fast_load_len
|
|||
planner.settings.retract_acceleration = FILAMENT_CHANGE_FAST_LOAD_ACCEL;
|
||||
#endif
|
||||
|
||||
unscaled_e_move(fast_load_length, FILAMENT_CHANGE_FAST_LOAD_FEEDRATE);
|
||||
motion.unscaled_e_move(fast_load_length, FILAMENT_CHANGE_FAST_LOAD_FEEDRATE);
|
||||
|
||||
#if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0
|
||||
planner.settings.retract_acceleration = saved_acceleration;
|
||||
|
|
@ -261,7 +261,7 @@ bool load_filament(const float slow_load_length/*=0*/, const float fast_load_len
|
|||
}
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE) // Tie the two extruders movement back together.
|
||||
set_duplication_enabled(saved_ext_dup_mode, saved_ext);
|
||||
motion.set_extruder_duplication(saved_ext_dup_mode, saved_ext);
|
||||
#endif
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
|
||||
|
|
@ -272,7 +272,7 @@ bool load_filament(const float slow_load_length/*=0*/, const float fast_load_len
|
|||
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)));
|
||||
marlin.wait_start(); // A click or M108 breaks the purge_length loop
|
||||
for (float purge_count = purge_length; purge_count > 0 && marlin.wait_for_user; --purge_count)
|
||||
unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
||||
motion.unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
||||
marlin.user_resume();
|
||||
|
||||
#else
|
||||
|
|
@ -288,7 +288,7 @@ bool load_filament(const float slow_load_length/*=0*/, const float fast_load_len
|
|||
#endif
|
||||
|
||||
// Extrude filament to get into hotend
|
||||
unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
||||
motion.unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
||||
}
|
||||
|
||||
TERN_(HOST_PROMPT_SUPPORT, hostui.filament_load_prompt()); // Initiate another host prompt.
|
||||
|
|
@ -327,7 +327,7 @@ bool load_filament(const float slow_load_length/*=0*/, const float fast_load_len
|
|||
*/
|
||||
inline void disable_active_extruder() {
|
||||
#if HAS_EXTRUDERS
|
||||
stepper.DISABLE_EXTRUDER(active_extruder);
|
||||
stepper.DISABLE_EXTRUDER(motion.extruder);
|
||||
safe_delay(100);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -372,13 +372,13 @@ bool unload_filament(const float unload_length, const bool show_lcd/*=false*/,
|
|||
#endif
|
||||
|
||||
// Retract filament
|
||||
unscaled_e_move(-(FILAMENT_UNLOAD_PURGE_RETRACT) * mix_multiplier, (PAUSE_PARK_RETRACT_FEEDRATE) * mix_multiplier);
|
||||
motion.unscaled_e_move(-(FILAMENT_UNLOAD_PURGE_RETRACT) * mix_multiplier, (PAUSE_PARK_RETRACT_FEEDRATE) * mix_multiplier);
|
||||
|
||||
// Wait for filament to cool
|
||||
safe_delay(FILAMENT_UNLOAD_PURGE_DELAY);
|
||||
|
||||
// Quickly purge
|
||||
unscaled_e_move((FILAMENT_UNLOAD_PURGE_RETRACT + FILAMENT_UNLOAD_PURGE_LENGTH) * mix_multiplier,
|
||||
motion.unscaled_e_move((FILAMENT_UNLOAD_PURGE_RETRACT + FILAMENT_UNLOAD_PURGE_LENGTH) * mix_multiplier,
|
||||
(FILAMENT_UNLOAD_PURGE_FEEDRATE) * mix_multiplier);
|
||||
|
||||
// Unload filament
|
||||
|
|
@ -387,7 +387,7 @@ bool unload_filament(const float unload_length, const bool show_lcd/*=false*/,
|
|||
planner.settings.retract_acceleration = FILAMENT_CHANGE_UNLOAD_ACCEL;
|
||||
#endif
|
||||
|
||||
unscaled_e_move(unload_length * mix_multiplier, (FILAMENT_CHANGE_UNLOAD_FEEDRATE) * mix_multiplier);
|
||||
motion.unscaled_e_move(unload_length * mix_multiplier, (FILAMENT_CHANGE_UNLOAD_FEEDRATE) * mix_multiplier);
|
||||
|
||||
#if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0
|
||||
planner.settings.retract_acceleration = saved_acceleration;
|
||||
|
|
@ -447,14 +447,14 @@ bool pause_print(const float retract, const xyz_pos_t &park_point, const bool sh
|
|||
print_job_timer.pause();
|
||||
|
||||
// Save current position
|
||||
resume_position = current_position;
|
||||
resume_position = motion.position;
|
||||
|
||||
// Will the nozzle be parking?
|
||||
const bool do_park = !axes_should_home();
|
||||
const bool do_park = !motion.axes_should_home();
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Save PLR info in case the power goes out while parked
|
||||
const float park_raise = do_park ? nozzle.park_mode_0_height(park_point.z) - current_position.z : POWER_LOSS_ZRAISE;
|
||||
const float park_raise = do_park ? nozzle.park_mode_0_height(park_point.z) - motion.position.z : POWER_LOSS_ZRAISE;
|
||||
if (was_sd_printing && recovery.enabled) recovery.save(true, park_raise, do_park);
|
||||
#endif
|
||||
|
||||
|
|
@ -466,7 +466,7 @@ bool pause_print(const float retract, const xyz_pos_t &park_point, const bool sh
|
|||
#endif
|
||||
|
||||
// Initial retract before move to filament change position
|
||||
if (retract && thermalManager.hotEnoughToExtrude(active_extruder)) {
|
||||
if (retract && thermalManager.hotEnoughToExtrude(motion.extruder)) {
|
||||
DEBUG_ECHOLNPGM("... retract:", retract);
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
|
|
@ -474,7 +474,7 @@ bool pause_print(const float retract, const xyz_pos_t &park_point, const bool sh
|
|||
set_bed_leveling_enabled(false); // turn off leveling
|
||||
#endif
|
||||
|
||||
unscaled_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE);
|
||||
motion.unscaled_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE);
|
||||
|
||||
TERN_(AUTO_BED_LEVELING_UBL, set_bed_leveling_enabled(leveling_was_enabled)); // restore leveling
|
||||
}
|
||||
|
|
@ -484,16 +484,16 @@ bool pause_print(const float retract, const xyz_pos_t &park_point, const bool sh
|
|||
if (!do_park) LCD_MESSAGE(MSG_PARK_FAILED);
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
const int8_t saved_ext = active_extruder;
|
||||
const bool saved_ext_dup_mode = extruder_duplication_enabled;
|
||||
set_duplication_enabled(false, DXC_ext);
|
||||
const int8_t saved_ext = motion.extruder;
|
||||
const bool saved_ext_dup_mode = motion.extruder_duplication;
|
||||
motion.set_extruder_duplication(false, DXC_ext);
|
||||
#endif
|
||||
|
||||
// Unload the filament, if specified
|
||||
if (unload_length)
|
||||
unload_filament(unload_length, show_lcd, PAUSE_MODE_CHANGE_FILAMENT);
|
||||
|
||||
TERN_(DUAL_X_CARRIAGE, set_duplication_enabled(saved_ext_dup_mode, saved_ext));
|
||||
TERN_(DUAL_X_CARRIAGE, motion.set_extruder_duplication(saved_ext_dup_mode, saved_ext));
|
||||
|
||||
// Disable the Extruder for manual change
|
||||
disable_active_extruder();
|
||||
|
|
@ -544,9 +544,9 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
|
|||
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
const int8_t saved_ext = active_extruder;
|
||||
const bool saved_ext_dup_mode = extruder_duplication_enabled;
|
||||
set_duplication_enabled(false, DXC_ext);
|
||||
const int8_t saved_ext = motion.extruder;
|
||||
const bool saved_ext_dup_mode = motion.extruder_duplication;
|
||||
motion.set_extruder_duplication(false, DXC_ext);
|
||||
#endif
|
||||
|
||||
// Wait for filament insert by user and press button
|
||||
|
|
@ -613,7 +613,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
|
|||
}
|
||||
marlin.idle_no_sleep();
|
||||
}
|
||||
TERN_(DUAL_X_CARRIAGE, set_duplication_enabled(saved_ext_dup_mode, saved_ext));
|
||||
TERN_(DUAL_X_CARRIAGE, motion.set_extruder_duplication(saved_ext_dup_mode, saved_ext));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -660,9 +660,9 @@ void resume_print(
|
|||
|
||||
/*
|
||||
SERIAL_ECHOLNPGM(
|
||||
"start of resume_print()\ndual_x_carriage_mode:", dual_x_carriage_mode,
|
||||
"\nextruder_duplication_enabled:", extruder_duplication_enabled,
|
||||
"\nactive_extruder:", active_extruder,
|
||||
"start of resume_print()\ndual_x_carriage_mode:", motion.idex_mode,
|
||||
"\nmotion.extruder_duplication:", motion.extruder_duplication,
|
||||
"\nmotion.extruder:", motion.extruder,
|
||||
"\n"
|
||||
);
|
||||
//*/
|
||||
|
|
@ -676,15 +676,15 @@ void resume_print(
|
|||
thermalManager.reset_hotend_idle_timer(e);
|
||||
}
|
||||
|
||||
if (targetTemp > thermalManager.degTargetHotend(active_extruder))
|
||||
thermalManager.setTargetHotend(targetTemp, active_extruder);
|
||||
if (targetTemp > thermalManager.degTargetHotend(motion.extruder))
|
||||
thermalManager.setTargetHotend(targetTemp, motion.extruder);
|
||||
|
||||
// Load the new filament
|
||||
load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, show_lcd, nozzle_timed_out, PAUSE_MODE_SAME DXC_PASS);
|
||||
|
||||
if (targetTemp > 0) {
|
||||
thermalManager.setTargetHotend(targetTemp, active_extruder);
|
||||
thermalManager.wait_for_hotend(active_extruder, false);
|
||||
thermalManager.setTargetHotend(targetTemp, motion.extruder);
|
||||
thermalManager.wait_for_hotend(motion.extruder, false);
|
||||
}
|
||||
|
||||
ui.pause_show_message(PAUSE_MESSAGE_RESUME);
|
||||
|
|
@ -693,16 +693,16 @@ void resume_print(
|
|||
ensure_safe_temperature(DISABLED(BELTPRINTER));
|
||||
|
||||
// Retract to prevent oozing
|
||||
unscaled_e_move(-(PAUSE_PARK_RETRACT_LENGTH), feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
||||
motion.unscaled_e_move(-(PAUSE_PARK_RETRACT_LENGTH), feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
||||
|
||||
if (!axes_should_home()) {
|
||||
if (!motion.axes_should_home()) {
|
||||
// Move XY back to saved position
|
||||
destination.set(resume_position.x, resume_position.y, current_position.z, current_position.e);
|
||||
prepare_internal_move_to_destination(NOZZLE_PARK_XY_FEEDRATE);
|
||||
motion.destination.set(resume_position.x, resume_position.y, motion.position.z, motion.position.e);
|
||||
motion.prepare_internal_move_to_destination(NOZZLE_PARK_XY_FEEDRATE);
|
||||
|
||||
// Move Z back to saved position
|
||||
destination.z = resume_position.z;
|
||||
prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
|
||||
motion.destination.z = resume_position.z;
|
||||
motion.prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
|
||||
}
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
|
|
@ -711,27 +711,27 @@ void resume_print(
|
|||
#endif
|
||||
|
||||
// Unretract
|
||||
unscaled_e_move(PAUSE_PARK_RETRACT_LENGTH, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
||||
motion.unscaled_e_move(PAUSE_PARK_RETRACT_LENGTH, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
||||
|
||||
TERN_(AUTO_BED_LEVELING_UBL, set_bed_leveling_enabled(leveling_was_enabled)); // restore leveling
|
||||
|
||||
// Intelligent resuming
|
||||
#if ENABLED(FWRETRACT)
|
||||
// If retracted before goto pause
|
||||
if (fwretract.retracted[active_extruder])
|
||||
unscaled_e_move(-fwretract.settings.retract_length, fwretract.settings.retract_feedrate_mm_s);
|
||||
if (fwretract.retracted[motion.extruder])
|
||||
motion.unscaled_e_move(-fwretract.settings.retract_length, fwretract.settings.retract_feedrate_mm_s);
|
||||
#endif
|
||||
|
||||
// If resume_position is negative
|
||||
if (resume_position.e < 0) unscaled_e_move(resume_position.e, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
||||
if (resume_position.e < 0) motion.unscaled_e_move(resume_position.e, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
||||
#ifdef ADVANCED_PAUSE_RESUME_PRIME
|
||||
if (ADVANCED_PAUSE_RESUME_PRIME != 0)
|
||||
unscaled_e_move(ADVANCED_PAUSE_RESUME_PRIME, feedRate_t(ADVANCED_PAUSE_PURGE_FEEDRATE));
|
||||
motion.unscaled_e_move(ADVANCED_PAUSE_RESUME_PRIME, feedRate_t(ADVANCED_PAUSE_PURGE_FEEDRATE));
|
||||
#endif
|
||||
|
||||
// Now all extrusion positions are resumed and ready to be confirmed
|
||||
// Set extruder to saved position
|
||||
planner.set_e_position_mm((destination.e = current_position.e = resume_position.e));
|
||||
planner.set_e_position_mm((motion.destination.e = motion.position.e = resume_position.e));
|
||||
|
||||
ui.pause_show_message(PAUSE_MESSAGE_STATUS);
|
||||
#if ENABLED(SOVOL_SV06_RTS)
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
|||
|| ELAPSED(ms, next_save_ms)
|
||||
#endif
|
||||
// Save if Z is above the last-saved position by some minimum height
|
||||
|| current_position.z > info.current_position.z + POWER_LOSS_MIN_Z_CHANGE
|
||||
|| motion.position.z > info.current_position.z + POWER_LOSS_MIN_Z_CHANGE
|
||||
#endif
|
||||
) {
|
||||
|
||||
|
|
@ -216,8 +216,8 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
|||
// Machine state
|
||||
// info.sdpos and info.current_position are pre-filled from the Stepper ISR
|
||||
|
||||
info.feedrate = uint16_t(MMS_TO_MMM(feedrate_mm_s));
|
||||
info.feedrate_percentage = feedrate_percentage;
|
||||
info.feedrate = uint16_t(MMS_TO_MMM(motion.feedrate_mm_s));
|
||||
info.feedrate_percentage = motion.feedrate_percentage;
|
||||
COPY(info.flow_percentage, planner.flow_percentage);
|
||||
|
||||
info.zraise = zraise;
|
||||
|
|
@ -225,16 +225,16 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
|||
|
||||
TERN_(CANCEL_OBJECTS, info.cancel_state = cancelable.state);
|
||||
TERN_(GCODE_REPEAT_MARKERS, info.stored_repeat = repeat);
|
||||
TERN_(HAS_HOME_OFFSET, info.home_offset = home_offset);
|
||||
TERN_(HAS_WORKSPACE_OFFSET, info.workspace_offset = workspace_offset);
|
||||
E_TERN_(info.active_extruder = active_extruder);
|
||||
TERN_(HAS_HOME_OFFSET, info.home_offset = motion.home_offset);
|
||||
TERN_(HAS_WORKSPACE_OFFSET, info.workspace_offset = motion.workspace_offset);
|
||||
E_TERN_(info.extruder = motion.extruder);
|
||||
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
info.flag.volumetric_enabled = parser.volumetric_enabled;
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
COPY(info.filament_size, planner.filament_size);
|
||||
#else
|
||||
if (parser.volumetric_enabled) info.filament_size[0] = planner.filament_size[active_extruder];
|
||||
if (parser.volumetric_enabled) info.filament_size[0] = planner.filament_size[motion.extruder];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
@ -285,10 +285,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
|||
|
||||
#if POWER_LOSS_RETRACT_LEN
|
||||
// Retract filament now
|
||||
const uint16_t old_flow = planner.flow_percentage[active_extruder];
|
||||
planner.set_flow(active_extruder, 100);
|
||||
const uint16_t old_flow = planner.flow_percentage[motion.extruder];
|
||||
planner.set_flow(motion.extruder, 100);
|
||||
gcode.process_subcommands_now(F("G1F3000E-" STRINGIFY(POWER_LOSS_RETRACT_LEN)));
|
||||
planner.set_flow(active_extruder, old_flow);
|
||||
planner.set_flow(motion.extruder, old_flow);
|
||||
#endif
|
||||
|
||||
#if POWER_LOSS_ZRAISE
|
||||
|
|
@ -327,7 +327,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
|||
|
||||
#if POWER_LOSS_ZRAISE
|
||||
// Get the limited Z-raise to do now or on resume
|
||||
const float zraise = _MAX(0, _MIN(current_position.z + POWER_LOSS_ZRAISE, Z_MAX_POS - 1) - current_position.z);
|
||||
const float zraise = _MAX(0, _MIN(motion.position.z + POWER_LOSS_ZRAISE, Z_MAX_POS - 1) - motion.position.z);
|
||||
#else
|
||||
constexpr float zraise = 0;
|
||||
#endif
|
||||
|
|
@ -344,15 +344,15 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
|||
|
||||
#if ENABLED(BACKUP_POWER_SUPPLY)
|
||||
// Do a hard-stop of the steppers (with possibly a loud thud)
|
||||
quickstop_stepper();
|
||||
motion.quickstop_stepper();
|
||||
// With backup power a retract and raise can be done now
|
||||
retract_and_lift(zraise);
|
||||
#endif
|
||||
|
||||
if (TERN0(DEBUG_POWER_LOSS_RECOVERY, simulated)) {
|
||||
card.fileHasFinished();
|
||||
current_position.reset();
|
||||
sync_plan_position();
|
||||
motion.position.reset();
|
||||
motion.sync_plan_position();
|
||||
}
|
||||
else
|
||||
marlin.kill(GET_TEXT_F(MSG_OUTAGE_RECOVERY));
|
||||
|
|
@ -489,8 +489,8 @@ void PrintJobRecovery::resume() {
|
|||
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F1000X"), p_float_t(p.x, 3), 'Y', p_float_t(p.y, 3), F("\nG28HZ")));
|
||||
#endif
|
||||
|
||||
// Mark all axes as having been homed (no effect on current_position)
|
||||
set_all_homed();
|
||||
// Mark all axes as having been homed (no effect on motion.position)
|
||||
motion.set_all_homed();
|
||||
|
||||
#if HAS_LEVELING
|
||||
// Restore Z fade and possibly re-enable bed leveling compensation.
|
||||
|
|
@ -516,7 +516,7 @@ void PrintJobRecovery::resume() {
|
|||
EXTRUDER_LOOP()
|
||||
PROCESS_SUBCOMMANDS_NOW(TS(F("M200T"), e, F("D"), p_float_t(info.filament_size[e], 3)));
|
||||
if (!info.flag.volumetric_enabled)
|
||||
PROCESS_SUBCOMMANDS_NOW(TS(F("M200D0T"), info.active_extruder));
|
||||
PROCESS_SUBCOMMANDS_NOW(TS(F("M200D0T"), info.extruder));
|
||||
#else
|
||||
if (info.flag.volumetric_enabled)
|
||||
PROCESS_SUBCOMMANDS_NOW(TS(F("M200D"), p_float_t(info.filament_size[0], 3)));
|
||||
|
|
@ -536,7 +536,7 @@ void PrintJobRecovery::resume() {
|
|||
|
||||
// Restore the previously active tool (with no_move)
|
||||
#if HAS_MULTI_EXTRUDER || HAS_MULTI_HOTEND
|
||||
PROCESS_SUBCOMMANDS_NOW(TS('T', info.active_extruder, 'S'));
|
||||
PROCESS_SUBCOMMANDS_NOW(TS('T', info.extruder, 'S'));
|
||||
#endif
|
||||
|
||||
// Restore print cooling fan speeds
|
||||
|
|
@ -586,7 +586,7 @@ void PrintJobRecovery::resume() {
|
|||
|
||||
// Restore the feedrate and percentage
|
||||
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F"), info.feedrate));
|
||||
feedrate_percentage = info.feedrate_percentage;
|
||||
motion.feedrate_percentage = info.feedrate_percentage;
|
||||
|
||||
// Flowrate percentage
|
||||
EXTRUDER_LOOP() planner.set_flow(e, info.flow_percentage[e]);
|
||||
|
|
@ -600,8 +600,8 @@ void PrintJobRecovery::resume() {
|
|||
#endif
|
||||
|
||||
TERN_(GCODE_REPEAT_MARKERS, repeat = info.stored_repeat);
|
||||
TERN_(HAS_HOME_OFFSET, home_offset = info.home_offset);
|
||||
TERN_(HAS_WORKSPACE_OFFSET, workspace_offset = info.workspace_offset);
|
||||
TERN_(HAS_HOME_OFFSET, motion.home_offset = info.home_offset);
|
||||
TERN_(HAS_WORKSPACE_OFFSET, motion.workspace_offset = info.workspace_offset);
|
||||
|
||||
// Relative axis modes
|
||||
gcode.axis_relative = info.axis_relative;
|
||||
|
|
@ -625,7 +625,7 @@ void PrintJobRecovery::resume() {
|
|||
DEBUG_ECHOLN(prefix, F(" Job Recovery Info...\nvalid_head:"), info.valid_head, F(" valid_foot:"), info.valid_foot);
|
||||
if (info.valid_head) {
|
||||
if (info.valid_head == info.valid_foot) {
|
||||
DEBUG_ECHOPGM("current_position: ");
|
||||
DEBUG_ECHOPGM("curr.position: ");
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (i) DEBUG_CHAR(',');
|
||||
DEBUG_ECHO(info.current_position[i]);
|
||||
|
|
@ -671,7 +671,7 @@ void PrintJobRecovery::resume() {
|
|||
#endif
|
||||
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
DEBUG_ECHOLNPGM("active_extruder: ", info.active_extruder);
|
||||
DEBUG_ECHOLNPGM("extruder: ", info.extruder);
|
||||
#endif
|
||||
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ typedef struct {
|
|||
xyz_pos_t workspace_offset;
|
||||
#endif
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
uint8_t active_extruder;
|
||||
uint8_t extruder;
|
||||
#endif
|
||||
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
|
|
|
|||
|
|
@ -154,12 +154,12 @@ class TFilamentMonitor : public FilamentMonitorBase {
|
|||
uint8_t extruder = 0;
|
||||
if (ran_out) while (!runout_flags.test(extruder)) extruder++;
|
||||
#else
|
||||
const bool ran_out = runout_flags[active_extruder]; // suppress non active extruders
|
||||
uint8_t extruder = active_extruder;
|
||||
const bool ran_out = runout_flags[motion.extruder]; // suppress non active extruders
|
||||
uint8_t extruder = motion.extruder;
|
||||
#endif
|
||||
#else
|
||||
const bool ran_out = bool(runout_flags);
|
||||
uint8_t extruder = active_extruder;
|
||||
uint8_t extruder = motion.extruder;
|
||||
#endif
|
||||
|
||||
if (!ran_out) return;
|
||||
|
|
@ -303,8 +303,8 @@ class FilamentSensorBase {
|
|||
static bool poll_runout_state(const uint8_t extruder) {
|
||||
const uint8_t runout_states = poll_runout_states();
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
if ( !TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())
|
||||
&& !TERN0(MULTI_NOZZLE_DUPLICATION, extruder_duplication_enabled)
|
||||
if ( !TERN0(DUAL_X_CARRIAGE, motion.idex_is_duplicating())
|
||||
&& !TERN0(MULTI_NOZZLE_DUPLICATION, motion.extruder_duplication)
|
||||
) return TEST(runout_states, extruder); // A specific extruder ran out
|
||||
#else
|
||||
UNUSED(extruder);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "solenoid.h"
|
||||
|
||||
#include "../module/motion.h" // for active_extruder
|
||||
#include "../module/motion.h" // for motion.extruder
|
||||
#include "../module/tool_change.h" // for parking_extruder_set_parked
|
||||
|
||||
// Used primarily with MANUAL_SOLENOID_CONTROL
|
||||
|
|
@ -38,7 +38,7 @@ static void set_solenoid(const uint8_t num, const uint8_t state) {
|
|||
}
|
||||
|
||||
#if ENABLED(PARKING_EXTRUDER)
|
||||
if (state == LOW && active_extruder == num) // If active extruder's solenoid is disabled, carriage is considered parked
|
||||
if (state == LOW && motion.extruder == num) // If active extruder's solenoid is disabled, carriage is considered parked
|
||||
parking_extruder_set_parked(true);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ PGM_P const tramming_point_name[] PROGMEM = { REPLIST_1(_NR_TRAM_NAMES, _TRAM_NA
|
|||
void move_to_tramming_wait_pos() {
|
||||
constexpr xyz_pos_t wait_pos = ASSISTED_TRAMMING_WAIT_POSITION;
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Moving away");
|
||||
do_blocking_move_to(wait_pos, XY_PROBE_FEEDRATE_MM_S);
|
||||
motion.blocking_move(wait_pos, XY_PROBE_FEEDRATE_MM_S);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -174,25 +174,25 @@ void move_to(const float rx, const float ry, const float z, const float e_delta)
|
|||
|
||||
const xy_pos_t dest = { rx, ry };
|
||||
|
||||
const bool has_xy_component = dest != current_position, // Check if X or Y is involved in the movement.
|
||||
const bool has_xy_component = dest != motion.position, // Check if X or Y is involved in the movement.
|
||||
has_e_component = e_delta != 0.0;
|
||||
|
||||
if (z != last_z) {
|
||||
last_z = z;
|
||||
destination.set(current_position.x, current_position.y, z, current_position.e);
|
||||
motion.destination.set(motion.position.x, motion.position.y, z, motion.position.e);
|
||||
const feedRate_t fr_mm_s = planner.settings.max_feedrate_mm_s[Z_AXIS] * 0.5f; // Use half of the Z_AXIS max feed rate
|
||||
prepare_internal_move_to_destination(fr_mm_s);
|
||||
motion.prepare_internal_move_to_destination(fr_mm_s);
|
||||
}
|
||||
|
||||
// If X or Y in combination with E is involved do a 'normal' move.
|
||||
// If X or Y with no E is involved do a 'fast' move
|
||||
// Otherwise retract/recover/hop.
|
||||
destination = dest;
|
||||
destination.e += e_delta;
|
||||
motion.destination = dest;
|
||||
motion.destination.e += e_delta;
|
||||
const feedRate_t fr_mm_s = has_xy_component
|
||||
? (has_e_component ? feedRate_t(G26_XY_FEEDRATE) : feedRate_t(G26_XY_FEEDRATE_TRAVEL))
|
||||
: planner.settings.max_feedrate_mm_s[E_AXIS] * 0.666f;
|
||||
prepare_internal_move_to_destination(fr_mm_s);
|
||||
motion.prepare_internal_move_to_destination(fr_mm_s);
|
||||
}
|
||||
|
||||
void move_to(const xyz_pos_t &where, const float de) { move_to(where.x, where.y, where.z, de); }
|
||||
|
|
@ -229,8 +229,8 @@ typedef struct {
|
|||
|
||||
// TODO: Parameterize the Z lift with a define
|
||||
void retract_lift_move(const xyz_pos_t &s) {
|
||||
retract_filament(destination);
|
||||
move_to(current_position.x, current_position.y, current_position.z + 0.5f, 0.0f); // Z lift to minimize scraping
|
||||
retract_filament(motion.destination);
|
||||
move_to(motion.position.x, motion.position.y, motion.position.z + 0.5f, 0.0f); // Z lift to minimize scraping
|
||||
move_to(s.x, s.y, s.z + 0.5f, 0.0f); // Get to the starting point with no extrusion while lifted
|
||||
}
|
||||
|
||||
|
|
@ -259,7 +259,7 @@ typedef struct {
|
|||
void print_line_from_here_to_there(const xyz_pos_t &s, const xyz_pos_t &e) {
|
||||
|
||||
// Distances to the start / end of the line
|
||||
xy_float_t svec = current_position - s, evec = current_position - e;
|
||||
xy_float_t svec = motion.position - s, evec = motion.position - e;
|
||||
|
||||
const float dist_start = HYPOT2(svec.x, svec.y),
|
||||
dist_end = HYPOT2(evec.x, evec.y),
|
||||
|
|
@ -279,7 +279,7 @@ typedef struct {
|
|||
|
||||
const float e_pos_delta = line_length * g26_e_axis_feedrate * extrusion_multiplier;
|
||||
|
||||
recover_filament(destination);
|
||||
recover_filament(motion.destination);
|
||||
move_to(e, e_pos_delta); // Get to the ending point with an appropriate amount of extrusion
|
||||
}
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ typedef struct {
|
|||
LIMIT(e.x, X_MIN_POS + 1, X_MAX_POS - 1);
|
||||
#endif
|
||||
|
||||
if (position_is_reachable(s) && position_is_reachable(e))
|
||||
if (motion.can_reach(s) && motion.can_reach(e))
|
||||
print_line_from_here_to_there(s, e);
|
||||
}
|
||||
}
|
||||
|
|
@ -341,10 +341,10 @@ typedef struct {
|
|||
// Start heating the active nozzle
|
||||
LCD_MESSAGE_MAX(MSG_G26_HEATING_NOZZLE);
|
||||
ui.quick_feedback();
|
||||
thermalManager.setTargetHotend(hotend_temp, active_extruder);
|
||||
thermalManager.setTargetHotend(hotend_temp, motion.extruder);
|
||||
|
||||
// Wait for the temperature to stabilize
|
||||
if (!thermalManager.wait_for_hotend(active_extruder, true OPTARG(G26_CLICK_CAN_CANCEL, true)))
|
||||
if (!thermalManager.wait_for_hotend(motion.extruder, true OPTARG(G26_CLICK_CAN_CANCEL, true)))
|
||||
return G26_ERR;
|
||||
|
||||
ui.reset_status();
|
||||
|
|
@ -369,13 +369,13 @@ typedef struct {
|
|||
LCD_MESSAGE_MAX(MSG_G26_MANUAL_PRIME);
|
||||
ui.chirp();
|
||||
|
||||
destination = current_position;
|
||||
motion.destination = motion.position;
|
||||
|
||||
recover_filament(destination); // Make sure G26 doesn't think the filament is retracted().
|
||||
recover_filament(motion.destination); // Make sure G26 doesn't think the filament is retracted().
|
||||
|
||||
while (!ui.button_pressed()) {
|
||||
ui.chirp();
|
||||
destination.e += 0.25;
|
||||
motion.destination.e += 0.25;
|
||||
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
||||
Total_Prime += 0.25;
|
||||
if (Total_Prime >= EXTRUDE_MAXLENGTH) {
|
||||
|
|
@ -383,8 +383,8 @@ typedef struct {
|
|||
return G26_ERR;
|
||||
}
|
||||
#endif
|
||||
prepare_internal_move_to_destination(fr_slow_e);
|
||||
destination = current_position;
|
||||
motion.prepare_internal_move_to_destination(fr_slow_e);
|
||||
motion.destination = motion.position;
|
||||
planner.synchronize(); // Without this synchronize, the purge is more consistent,
|
||||
// but because the planner has a buffer, we won't be able
|
||||
// to stop as quickly. So we put up with the less smooth
|
||||
|
|
@ -402,11 +402,11 @@ typedef struct {
|
|||
{
|
||||
LCD_MESSAGE_MAX(MSG_G26_FIXED_LENGTH);
|
||||
ui.quick_feedback();
|
||||
destination = current_position;
|
||||
destination.e += prime_length;
|
||||
prepare_internal_move_to_destination(fr_slow_e);
|
||||
destination.e -= prime_length;
|
||||
retract_filament(destination);
|
||||
motion.destination = motion.position;
|
||||
motion.destination.e += prime_length;
|
||||
motion.prepare_internal_move_to_destination(fr_slow_e);
|
||||
motion.destination.e -= prime_length;
|
||||
retract_filament(motion.destination);
|
||||
}
|
||||
|
||||
return G26_OK;
|
||||
|
|
@ -500,7 +500,7 @@ void GcodeSuite::G26() {
|
|||
|
||||
// Don't allow Mesh Validation without homing first,
|
||||
// or if the parameter parsing did not go OK, abort
|
||||
if (homing_needed_error()) return;
|
||||
if (motion.homing_needed_error()) return;
|
||||
|
||||
#if HAS_TOOLCHANGE
|
||||
// Change the tool first, if specified
|
||||
|
|
@ -616,7 +616,7 @@ void GcodeSuite::G26() {
|
|||
|
||||
// If any preset or temperature was specified
|
||||
if (noztemp) {
|
||||
if (!WITHIN(noztemp, 165, thermalManager.hotend_max_target(active_extruder))) {
|
||||
if (!WITHIN(noztemp, 165, thermalManager.hotend_max_target(motion.extruder))) {
|
||||
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Specified nozzle temperature not plausible."));
|
||||
return;
|
||||
}
|
||||
|
|
@ -647,10 +647,10 @@ void GcodeSuite::G26() {
|
|||
return;
|
||||
}
|
||||
|
||||
// Set a position with 'X' and/or 'Y'. Default: current_position
|
||||
g26.xy_pos.set(parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position.x,
|
||||
parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position.y);
|
||||
if (!position_is_reachable(g26.xy_pos)) {
|
||||
// Set a position with 'X' and/or 'Y'. Default: motion.position
|
||||
g26.xy_pos.set(parser.seenval('X') ? motion.raw_x(parser.value_linear_units()) : motion.position.x,
|
||||
parser.seenval('Y') ? motion.raw_y(parser.value_linear_units()) : motion.position.y);
|
||||
if (!motion.can_reach(g26.xy_pos)) {
|
||||
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Specified X,Y coordinate out of bounds."));
|
||||
return;
|
||||
}
|
||||
|
|
@ -660,7 +660,7 @@ void GcodeSuite::G26() {
|
|||
*/
|
||||
set_bed_leveling_enabled(!parser.seen_test('D'));
|
||||
|
||||
do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES);
|
||||
motion.do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES);
|
||||
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
bool volumetric_was_enabled = parser.volumetric_enabled;
|
||||
|
|
@ -670,8 +670,7 @@ void GcodeSuite::G26() {
|
|||
|
||||
if (g26.turn_on_heaters() != G26_OK) goto LEAVE;
|
||||
|
||||
current_position.e = 0.0;
|
||||
sync_plan_position_e();
|
||||
motion.set_and_sync_e(0.0f);
|
||||
|
||||
if (g26.prime_flag && g26.prime_nozzle() != G26_OK) goto LEAVE;
|
||||
|
||||
|
|
@ -688,10 +687,10 @@ void GcodeSuite::G26() {
|
|||
circle_flags.reset();
|
||||
|
||||
// Move nozzle to the specified height for the first layer
|
||||
destination = current_position;
|
||||
destination.z = g26.layer_height;
|
||||
move_to(destination, 0.0);
|
||||
move_to(destination, g26.ooze_amount);
|
||||
motion.destination = motion.position;
|
||||
motion.destination.z = g26.layer_height;
|
||||
move_to(motion.destination, 0.0);
|
||||
move_to(motion.destination, g26.ooze_amount);
|
||||
|
||||
TERN_(HAS_MARLINUI_MENU, ui.capture());
|
||||
|
||||
|
|
@ -719,14 +718,14 @@ void GcodeSuite::G26() {
|
|||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(location.pos, ExtUI::G26_START));
|
||||
do {
|
||||
// Find the nearest confluence
|
||||
location = g26.find_closest_circle_to_print(g26.continue_with_closest ? xy_pos_t(current_position) : g26.xy_pos);
|
||||
location = g26.find_closest_circle_to_print(g26.continue_with_closest ? xy_pos_t(motion.position) : g26.xy_pos);
|
||||
|
||||
if (location.valid()) {
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(location.pos, ExtUI::G26_POINT_START));
|
||||
const xy_pos_t circle = { bedlevel.get_mesh_x(location.pos.a), bedlevel.get_mesh_y(location.pos.b) };
|
||||
|
||||
// If this mesh location is outside the printable radius, skip it.
|
||||
if (!position_is_reachable(circle)) continue;
|
||||
if (!motion.can_reach(circle)) continue;
|
||||
|
||||
// Determine where to start and end the circle,
|
||||
// which is always drawn counter-clockwise.
|
||||
|
|
@ -767,11 +766,11 @@ void GcodeSuite::G26() {
|
|||
}
|
||||
|
||||
const ab_float_t arc_offset = circle - s;
|
||||
const xy_float_t dist = current_position - s; // Distance from the start of the actual circle
|
||||
const xy_float_t dist = motion.position - s; // Distance from the start of the actual circle
|
||||
const float dist_start = HYPOT2(dist.x, dist.y);
|
||||
const xyze_pos_t endpoint = {
|
||||
e.x, e.y, g26.layer_height,
|
||||
current_position.e + (arc_length * g26_e_axis_feedrate * g26.extrusion_multiplier)
|
||||
motion.position.e + (arc_length * g26_e_axis_feedrate * g26.extrusion_multiplier)
|
||||
};
|
||||
|
||||
if (dist_start > 2.0) {
|
||||
|
|
@ -782,11 +781,11 @@ void GcodeSuite::G26() {
|
|||
s.z = g26.layer_height;
|
||||
move_to(s, 0.0); // Get to the starting point with no extrusion / un-Z lift
|
||||
|
||||
g26.recover_filament(destination);
|
||||
g26.recover_filament(motion.destination);
|
||||
|
||||
{ REMEMBER(fr, feedrate_mm_s, PLANNER_XY_FEEDRATE_MM_S * 0.1f);
|
||||
{ REMEMBER(fr, motion.feedrate_mm_s, PLANNER_XY_FEEDRATE_MM_S * 0.1f);
|
||||
plan_arc(endpoint, arc_offset, false, 0); // Draw a counter-clockwise arc
|
||||
destination = current_position;
|
||||
motion.destination = motion.position;
|
||||
}
|
||||
|
||||
if (TERN0(HAS_MARLINUI_MENU, user_canceled())) goto LEAVE; // Check if the user wants to stop the Mesh Validation
|
||||
|
|
@ -820,7 +819,7 @@ void GcodeSuite::G26() {
|
|||
|
||||
#if IS_KINEMATIC
|
||||
// Check to make sure this segment is entirely on the bed, skip if not.
|
||||
if (!position_is_reachable(p) || !position_is_reachable(q)) continue;
|
||||
if (!motion.can_reach(p) || !motion.can_reach(q)) continue;
|
||||
#elif HAS_ENDSTOPS
|
||||
LIMIT(p.x, X_MIN_POS + 1, X_MAX_POS - 1); // Prevent hitting the endstops
|
||||
LIMIT(p.y, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
||||
|
|
@ -851,9 +850,9 @@ void GcodeSuite::G26() {
|
|||
LCD_MESSAGE_MIN(MSG_G26_LEAVING);
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(location, ExtUI::G26_FINISH));
|
||||
|
||||
g26.retract_filament(destination);
|
||||
destination.z = Z_CLEARANCE_BETWEEN_PROBES;
|
||||
move_to(destination, 0); // Raise the nozzle
|
||||
g26.retract_filament(motion.destination);
|
||||
motion.destination.z = Z_CLEARANCE_BETWEEN_PROBES;
|
||||
move_to(motion.destination, 0); // Raise the nozzle
|
||||
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
parser.volumetric_enabled = volumetric_was_enabled;
|
||||
|
|
@ -864,7 +863,7 @@ void GcodeSuite::G26() {
|
|||
|
||||
if (!g26.keep_heaters_on) {
|
||||
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(0));
|
||||
thermalManager.setTargetHotend(active_extruder, 0);
|
||||
thermalManager.setTargetHotend(motion.extruder, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,10 +84,10 @@ void GcodeSuite::G35() {
|
|||
probe.use_probing_tool();
|
||||
|
||||
// Disable duplication mode on homing
|
||||
TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false));
|
||||
TERN_(HAS_DUPLICATION_MODE, motion.set_extruder_duplication(false));
|
||||
|
||||
// Home only Z axis when X and Y is trusted, otherwise all axes, if needed before this procedure
|
||||
if (!all_axes_trusted()) process_subcommands_now(F("G28Z"));
|
||||
if (!motion.all_axes_trusted()) process_subcommands_now(F("G28Z"));
|
||||
|
||||
bool err_break = false;
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ void GcodeSuite::G35() {
|
|||
move_to_tramming_wait_pos();
|
||||
|
||||
// After this operation the Z position needs correction
|
||||
set_axis_never_homed(Z_AXIS);
|
||||
motion.set_axis_never_homed(Z_AXIS);
|
||||
}
|
||||
|
||||
#endif // ASSISTED_TRAMMING
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
* P : Flag to put the probe at the given point
|
||||
*/
|
||||
void GcodeSuite::G42() {
|
||||
if (!MOTION_CONDITIONS) return;
|
||||
if (motion.gcode_motion_ignored()) return;
|
||||
|
||||
const bool hasI = parser.seenval('I');
|
||||
const int8_t ix = hasI ? parser.value_int() : 0;
|
||||
|
|
@ -54,16 +54,16 @@ void GcodeSuite::G42() {
|
|||
return;
|
||||
}
|
||||
|
||||
// Move to current_position, as modified by I, J, P parameters
|
||||
destination = current_position;
|
||||
// Move to motion.position, as modified by I, J, P parameters
|
||||
motion.destination = motion.position;
|
||||
|
||||
if (hasI) destination.x = bedlevel.get_mesh_x(ix);
|
||||
if (hasJ) destination.y = bedlevel.get_mesh_y(iy);
|
||||
if (hasI) motion.destination.x = bedlevel.get_mesh_x(ix);
|
||||
if (hasJ) motion.destination.y = bedlevel.get_mesh_y(iy);
|
||||
|
||||
#if HAS_PROBE_XY_OFFSET
|
||||
if (parser.seen_test('P')) {
|
||||
if (hasI) destination.x -= probe.offset_xy.x;
|
||||
if (hasJ) destination.y -= probe.offset_xy.y;
|
||||
if (hasI) motion.destination.x -= probe.offset_xy.x;
|
||||
if (hasJ) motion.destination.y -= probe.offset_xy.y;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -72,9 +72,9 @@ void GcodeSuite::G42() {
|
|||
|
||||
// SCARA kinematic has "safe" XY raw moves
|
||||
#if IS_SCARA
|
||||
prepare_internal_fast_move_to_destination(fr_mm_s);
|
||||
motion.prepare_internal_fast_move_to_destination(fr_mm_s);
|
||||
#else
|
||||
prepare_internal_move_to_destination(fr_mm_s);
|
||||
motion.prepare_internal_move_to_destination(fr_mm_s);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ void GcodeSuite::M420() {
|
|||
}
|
||||
#endif
|
||||
|
||||
xyz_pos_t oldpos = current_position;
|
||||
xyz_pos_t oldpos = motion.position;
|
||||
|
||||
// If disabling leveling do it right away
|
||||
// (Don't disable for just M420 or M420 V)
|
||||
|
|
@ -240,8 +240,8 @@ void GcodeSuite::M420() {
|
|||
#endif
|
||||
|
||||
// Report change in position
|
||||
if (oldpos != current_position)
|
||||
report_current_position();
|
||||
if (oldpos != motion.position)
|
||||
motion.report_position();
|
||||
}
|
||||
|
||||
void GcodeSuite::M420_report(const bool forReplay/*=true*/) {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@
|
|||
*/
|
||||
static void pre_g29_return(const bool retry, const bool did) {
|
||||
if (!retry) {
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE, false));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_IDLE, false));
|
||||
}
|
||||
#if DISABLED(G29_RETRY_AND_RECOVER)
|
||||
if (!retry || did) {
|
||||
|
|
@ -259,7 +259,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
process_subcommands_now(TERN(CAN_SET_LEVELING_AFTER_G28, F("G28L0"), FPSTR(G28_STR)));
|
||||
|
||||
// Don't allow auto-leveling without homing first
|
||||
if (homing_needed_error()) G29_RETURN(false, false);
|
||||
if (motion.homing_needed_error()) G29_RETURN(false, false);
|
||||
|
||||
// 3-point leveling gets points from the probe class
|
||||
#if ENABLED(AUTO_BED_LEVELING_3POINT)
|
||||
|
|
@ -273,7 +273,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
#endif
|
||||
|
||||
// Set and report "probing" state to host
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE, false));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_PROBE, false));
|
||||
|
||||
#if DISABLED(PROBE_MANUALLY)
|
||||
// Potentially disable Fixed-Time Motion for probing
|
||||
|
|
@ -307,14 +307,14 @@ G29_TYPE GcodeSuite::G29() {
|
|||
G29_RETURN(false, false);
|
||||
}
|
||||
|
||||
const float rz = parser.seenval('Z') ? RAW_Z_POSITION(parser.value_linear_units()) : current_position.z;
|
||||
const float rz = parser.seenval('Z') ? motion.raw_z(parser.value_linear_units()) : motion.position.z;
|
||||
if (!WITHIN(rz, -10, 10)) {
|
||||
SERIAL_ERROR_MSG("Bad Z value");
|
||||
G29_RETURN(false, false);
|
||||
}
|
||||
|
||||
const float rx = RAW_X_POSITION(parser.linearval('X', NAN)),
|
||||
ry = RAW_Y_POSITION(parser.linearval('Y', NAN));
|
||||
const float rx = motion.raw_x(parser.linearval('X', NAN)),
|
||||
ry = motion.raw_y(parser.linearval('Y', NAN));
|
||||
int8_t i = parser.byteval('I', -1), j = parser.byteval('J', -1);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
|
|
@ -337,7 +337,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(i, j, rz));
|
||||
if (abl.reenable) {
|
||||
set_bed_leveling_enabled(true);
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
}
|
||||
}
|
||||
G29_RETURN(false, false);
|
||||
|
|
@ -395,14 +395,16 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
#endif
|
||||
|
||||
#if ABL_USES_GRID
|
||||
|
||||
#if HAS_VARIABLE_XY_PROBE_FEEDRATE
|
||||
constexpr feedRate_t min_probe_feedrate_mm_s = XY_PROBE_FEEDRATE_MIN;
|
||||
xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_FEEDRATE));
|
||||
if (xy_probe_feedrate_mm_s < min_probe_feedrate_mm_s) {
|
||||
xy_probe_feedrate_mm_s = min_probe_feedrate_mm_s;
|
||||
motion.xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_FEEDRATE));
|
||||
if (motion.xy_probe_feedrate_mm_s < min_probe_feedrate_mm_s) {
|
||||
motion.xy_probe_feedrate_mm_s = min_probe_feedrate_mm_s;
|
||||
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Feedrate (S) too low. (Using ", min_probe_feedrate_mm_s, ")"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ABL_USES_GRID
|
||||
|
||||
const float x_min = probe.min_x(), x_max = probe.max_x(),
|
||||
y_min = probe.min_y(), y_max = probe.max_y();
|
||||
|
|
@ -448,7 +450,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart());
|
||||
|
||||
if (!faux) {
|
||||
remember_feedrate_scaling_off();
|
||||
motion.remember_feedrate_scaling_off();
|
||||
|
||||
#if ENABLED(PREHEAT_BEFORE_LEVELING)
|
||||
#if ENABLED(SOVOL_SV06_RTS)
|
||||
|
|
@ -465,7 +467,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
// Position bed horizontally and Z probe vertically.
|
||||
#if HAS_SAFE_BED_LEVELING
|
||||
xyze_pos_t safe_position = current_position;
|
||||
xyze_pos_t safe_position = motion.position;
|
||||
#ifdef SAFE_BED_LEVELING_START_X
|
||||
safe_position.x = SAFE_BED_LEVELING_START_X;
|
||||
#endif
|
||||
|
|
@ -494,7 +496,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
safe_position.w = SAFE_BED_LEVELING_START_W;
|
||||
#endif
|
||||
|
||||
do_blocking_move_to(safe_position);
|
||||
motion.blocking_move(safe_position);
|
||||
#endif // HAS_SAFE_BED_LEVELING
|
||||
|
||||
// Disable auto bed leveling during G29.
|
||||
|
|
@ -503,7 +505,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
// Deploy certain probes before starting probing
|
||||
#if ENABLED(BLTOUCH) || ALL(HAS_Z_SERVO_PROBE, Z_SERVO_INTERMEDIATE_STOW)
|
||||
do_z_clearance(Z_CLEARANCE_DEPLOY_PROBE);
|
||||
motion.do_z_clearance(Z_CLEARANCE_DEPLOY_PROBE);
|
||||
#elif HAS_BED_PROBE
|
||||
if (probe.deploy()) { // (returns true on deploy failure)
|
||||
set_bed_leveling_enabled(abl.reenable);
|
||||
|
|
@ -534,7 +536,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
// Abort current G29 procedure, go back to idle state
|
||||
if (seenA && g29_in_progress) {
|
||||
SERIAL_ECHOLNPGM("Manual G29 aborted");
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
motion.set_soft_endstop_loose(false);
|
||||
set_bed_leveling_enabled(abl.reenable);
|
||||
g29_in_progress = false;
|
||||
TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
|
||||
|
|
@ -554,9 +556,9 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
if (abl.abl_probe_index == 0) {
|
||||
// For the initial G29 S2 save software endstop state
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
motion.set_soft_endstop_loose(true);
|
||||
// Move close to the bed before the first point
|
||||
do_blocking_move_to_z(0);
|
||||
motion.blocking_move_z(0);
|
||||
}
|
||||
else {
|
||||
|
||||
|
|
@ -566,7 +568,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
// For G29 after adjusting Z.
|
||||
// Save the previous Z before going to the next point
|
||||
abl.measured_z = current_position.z;
|
||||
abl.measured_z = motion.position.z;
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
||||
|
||||
|
|
@ -615,7 +617,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
TERN_(AUTO_BED_LEVELING_LINEAR, abl.indexIntoAB[abl.meshCount.x][abl.meshCount.y] = abl.abl_probe_index);
|
||||
|
||||
// Keep looping till a reachable point is found
|
||||
if (position_is_reachable(abl.probePos)) break;
|
||||
if (motion.can_reach(abl.probePos)) break;
|
||||
++abl.abl_probe_index;
|
||||
}
|
||||
|
||||
|
|
@ -624,14 +626,14 @@ G29_TYPE GcodeSuite::G29() {
|
|||
_manual_goto_xy(abl.probePos); // Can be used here too!
|
||||
// Disable software endstops to allow manual adjustment
|
||||
// If G29 is not completed, they will not be re-enabled
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
motion.set_soft_endstop_loose(true);
|
||||
G29_RETURN(false, true);
|
||||
}
|
||||
else {
|
||||
// Leveling done! Fall through to G29 finishing code below
|
||||
SERIAL_ECHOLNPGM("Grid probing done.");
|
||||
// Re-enable software endstops, if needed
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
motion.set_soft_endstop_loose(false);
|
||||
}
|
||||
|
||||
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
|
||||
|
|
@ -642,7 +644,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
_manual_goto_xy(abl.probePos);
|
||||
// Disable software endstops to allow manual adjustment
|
||||
// If G29 is not completed, they will not be re-enabled
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
motion.set_soft_endstop_loose(true);
|
||||
G29_RETURN(false, true);
|
||||
}
|
||||
else {
|
||||
|
|
@ -650,7 +652,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
SERIAL_ECHOLNPGM("3-point probing done.");
|
||||
|
||||
// Re-enable software endstops, if needed
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
motion.set_soft_endstop_loose(false);
|
||||
|
||||
if (!abl.dryrun) {
|
||||
vector_3 planeNormal = vector_3::cross(points[0] - points[1], points[2] - points[1]).get_normal();
|
||||
|
|
@ -731,9 +733,9 @@ G29_TYPE GcodeSuite::G29() {
|
|||
// Put a G1 move into the buffer
|
||||
// TODO: Instead of G1, we can just add the move directly to the planner...
|
||||
// {
|
||||
// destination = current_position; destination = abl.probePos;
|
||||
// REMEMBER(fr, feedrate_mm_s, XY_PROBE_FEEDRATE_MM_S);
|
||||
// prepare_line_to_destination();
|
||||
// motion.destination = motion.position; motion.destination = abl.probePos;
|
||||
// REMEMBER(fr, motion.feedrate_mm_s, XY_PROBE_FEEDRATE_MM_S);
|
||||
// motion.prepare_line_to_destination();
|
||||
// }
|
||||
sprintf_P(tmp_1, PSTR("G1X%d.%d Y%d.%d F%d"),
|
||||
int(abl.probePos.x), int(abl.probePos.x * 10) % 10,
|
||||
|
|
@ -764,7 +766,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
//if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM_P(axis == Y_AXIS ? PSTR("Y=") : PSTR("X=", pos);
|
||||
|
||||
safe_delay(4);
|
||||
abl.measured_z = current_position.z - bdl.read();
|
||||
abl.measured_z = motion.position.z - bdl.read();
|
||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("x_cur ", planner.get_axis_position_mm(X_AXIS), " z ", abl.measured_z);
|
||||
|
||||
#else // !BD_SENSOR_PROBE_NO_STOP
|
||||
|
|
@ -857,7 +859,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
* return or loop before this point.
|
||||
*/
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
|
||||
if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", motion.position);
|
||||
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
g29_in_progress = false;
|
||||
|
|
@ -969,24 +971,24 @@ G29_TYPE GcodeSuite::G29() {
|
|||
// Correct the current XYZ position based on the tilted plane.
|
||||
//
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_POS("G29 uncorrected XYZ", current_position);
|
||||
if (DEBUGGING(LEVELING)) DEBUG_POS("G29 uncorrected XYZ", motion.position);
|
||||
|
||||
xyze_pos_t converted = current_position;
|
||||
xyze_pos_t converted = motion.position;
|
||||
planner.force_unapply_leveling(converted); // use conversion machinery
|
||||
|
||||
// Use the last measured distance to the bed, if possible
|
||||
if ( NEAR(current_position.x, abl.probePos.x - probe.offset_xy.x)
|
||||
&& NEAR(current_position.y, abl.probePos.y - probe.offset_xy.y)
|
||||
if ( NEAR(motion.position.x, abl.probePos.x - probe.offset_xy.x)
|
||||
&& NEAR(motion.position.y, abl.probePos.y - probe.offset_xy.y)
|
||||
) {
|
||||
const float simple_z = current_position.z - abl.measured_z;
|
||||
const float simple_z = motion.position.z - abl.measured_z;
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Probed Z", simple_z, " Matrix Z", converted.z, " Discrepancy ", simple_z - converted.z);
|
||||
converted.z = simple_z;
|
||||
}
|
||||
|
||||
// The rotated XY and corrected Z are now current_position
|
||||
current_position = converted;
|
||||
// The rotated XY and corrected Z are now motion.position
|
||||
motion.position = converted;
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_POS("G29 corrected XYZ", current_position);
|
||||
if (DEBUGGING(LEVELING)) DEBUG_POS("G29 corrected XYZ", motion.position);
|
||||
|
||||
abl.reenable = true;
|
||||
}
|
||||
|
|
@ -994,7 +996,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
// Auto Bed Leveling is complete! Enable if possible.
|
||||
if (abl.reenable) {
|
||||
planner.leveling_active = true;
|
||||
sync_plan_position();
|
||||
motion.sync_plan_position();
|
||||
}
|
||||
|
||||
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||
|
|
@ -1007,7 +1009,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
} // !isnan(abl.measured_z)
|
||||
|
||||
// Restore state after probing
|
||||
if (!faux) restore_feedrate_and_scaling();
|
||||
if (!faux) motion.restore_feedrate_and_scaling();
|
||||
|
||||
TERN_(HAS_BED_PROBE, probe.move_z_after_probing());
|
||||
|
||||
|
|
@ -1021,7 +1023,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
probe.use_probing_tool(false);
|
||||
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
|
||||
G29_RETURN(isnan(abl.measured_z), true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ void GcodeSuite::G29() {
|
|||
return;
|
||||
}
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_PROBE));
|
||||
|
||||
int8_t ix, iy;
|
||||
ix = iy = 0;
|
||||
|
|
@ -114,7 +114,7 @@ void GcodeSuite::G29() {
|
|||
|
||||
// Position bed horizontally and Z probe vertically.
|
||||
#if HAS_SAFE_BED_LEVELING
|
||||
xyze_pos_t safe_position = current_position;
|
||||
xyze_pos_t safe_position = motion.position;
|
||||
#ifdef SAFE_BED_LEVELING_START_X
|
||||
safe_position.x = SAFE_BED_LEVELING_START_X;
|
||||
#endif
|
||||
|
|
@ -143,7 +143,7 @@ void GcodeSuite::G29() {
|
|||
safe_position.w = SAFE_BED_LEVELING_START_W;
|
||||
#endif
|
||||
|
||||
do_blocking_move_to(safe_position);
|
||||
motion.blocking_move(safe_position);
|
||||
#endif // HAS_SAFE_BED_LEVELING
|
||||
|
||||
queue.inject(F("G29S2"));
|
||||
|
|
@ -162,7 +162,7 @@ void GcodeSuite::G29() {
|
|||
// For each G29 S2...
|
||||
if (mbl_probe_index == 0) {
|
||||
// Move close to the bed before the first point
|
||||
do_blocking_move_to_z(
|
||||
motion.blocking_move_z(
|
||||
#ifdef MANUAL_PROBE_START_Z
|
||||
MANUAL_PROBE_START_Z
|
||||
#else
|
||||
|
|
@ -172,28 +172,28 @@ void GcodeSuite::G29() {
|
|||
}
|
||||
else {
|
||||
// Save Z for the previous mesh position
|
||||
bedlevel.set_zigzag_z(mbl_probe_index - 1, current_position.z);
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, current_position.z));
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
bedlevel.set_zigzag_z(mbl_probe_index - 1, motion.position.z);
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, motion.position.z));
|
||||
motion.set_soft_endstop_loose(false);
|
||||
}
|
||||
// If there's another point to sample, move there with optional lift.
|
||||
if (mbl_probe_index < GRID_MAX_POINTS) {
|
||||
// Disable software endstops to allow manual adjustment
|
||||
// If G29 is left hanging without completion they won't be re-enabled!
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
motion.set_soft_endstop_loose(true);
|
||||
bedlevel.zigzag(mbl_probe_index++, ix, iy);
|
||||
_manual_goto_xy({ bedlevel.index_to_xpos[ix], bedlevel.index_to_ypos[iy] });
|
||||
}
|
||||
else {
|
||||
// Move to the after probing position
|
||||
current_position.z = (
|
||||
motion.position.z = (
|
||||
#ifdef Z_AFTER_PROBING
|
||||
Z_AFTER_PROBING
|
||||
#else
|
||||
Z_CLEARANCE_BETWEEN_MANUAL_PROBES
|
||||
#endif
|
||||
);
|
||||
line_to_current_position();
|
||||
motion.goto_current_position();
|
||||
planner.synchronize();
|
||||
|
||||
// After recording the last point, activate home and activate
|
||||
|
|
@ -206,8 +206,8 @@ void GcodeSuite::G29() {
|
|||
set_bed_leveling_enabled(true);
|
||||
|
||||
#if ENABLED(MESH_G28_REST_ORIGIN)
|
||||
current_position.z = 0;
|
||||
line_to_current_position(homing_feedrate(Z_AXIS));
|
||||
motion.position.z = 0;
|
||||
motion.goto_current_position(motion.homing_feedrate(Z_AXIS));
|
||||
planner.synchronize();
|
||||
#endif
|
||||
|
||||
|
|
@ -263,9 +263,9 @@ void GcodeSuite::G29() {
|
|||
if (mbl_probe_index > 0) TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), _MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS)));
|
||||
}
|
||||
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_IDLE));
|
||||
}
|
||||
|
||||
#endif // MESH_BED_LEVELING
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@
|
|||
*/
|
||||
void GcodeSuite::M421() {
|
||||
const bool hasX = parser.seen('X'), hasI = parser.seen('I');
|
||||
const int8_t ix = hasI ? parser.value_int() : hasX ? bedlevel.probe_index_x(RAW_X_POSITION(parser.value_linear_units())) : -1;
|
||||
const int8_t ix = hasI ? parser.value_int() : hasX ? bedlevel.probe_index_x(motion.raw_x(parser.value_linear_units())) : -1;
|
||||
const bool hasY = parser.seen('Y'), hasJ = parser.seen('J');
|
||||
const int8_t iy = hasJ ? parser.value_int() : hasY ? bedlevel.probe_index_y(RAW_Y_POSITION(parser.value_linear_units())) : -1;
|
||||
const int8_t iy = hasJ ? parser.value_int() : hasY ? bedlevel.probe_index_y(motion.raw_y(parser.value_linear_units())) : -1;
|
||||
const bool hasZ = parser.seen('Z'), hasQ = !hasZ && parser.seen('Q');
|
||||
|
||||
if (int(hasI && hasJ) + int(hasX && hasY) != 1 || !(hasZ || hasQ))
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@
|
|||
|
||||
void GcodeSuite::G29() {
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_PROBE));
|
||||
|
||||
bedlevel.G29();
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_IDLE));
|
||||
}
|
||||
|
||||
#endif // AUTO_BED_LEVELING_UBL
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ void GcodeSuite::M421() {
|
|||
hasZ = parser.seen('Z'),
|
||||
hasQ = !hasZ && parser.seen('Q');
|
||||
|
||||
if (hasC) ij = bedlevel.find_closest_mesh_point_of_type(CLOSEST, current_position);
|
||||
if (hasC) ij = bedlevel.find_closest_mesh_point_of_type(CLOSEST, motion.position);
|
||||
|
||||
// Test for bad parameter combinations
|
||||
if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN))
|
||||
|
|
|
|||
|
|
@ -78,19 +78,19 @@
|
|||
static void quick_home_xy() {
|
||||
|
||||
// Pretend the current position is 0,0
|
||||
current_position.set(0.0, 0.0);
|
||||
sync_plan_position();
|
||||
motion.position.set(0.0, 0.0);
|
||||
motion.sync_plan_position();
|
||||
|
||||
const int x_axis_home_dir = TOOL_X_HOME_DIR(active_extruder);
|
||||
const int x_axis_home_dir = motion.tool_x_home_dir();
|
||||
|
||||
// Use a higher diagonal feedrate so axes move at homing speed
|
||||
const float minfr = _MIN(homing_feedrate(X_AXIS), homing_feedrate(Y_AXIS)),
|
||||
const float minfr = _MIN(motion.homing_feedrate(X_AXIS), motion.homing_feedrate(Y_AXIS)),
|
||||
fr_mm_s = HYPOT(minfr, minfr);
|
||||
|
||||
// Set homing current to X and Y axis if defined
|
||||
TERN_(X_HAS_HOME_CURRENT, set_homing_current(X_AXIS));
|
||||
TERN_(X_HAS_HOME_CURRENT, motion.set_homing_current(X_AXIS));
|
||||
#if Y_HAS_HOME_CURRENT && NONE(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX)
|
||||
set_homing_current(Y_AXIS);
|
||||
motion.set_homing_current(Y_AXIS);
|
||||
#endif
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
|
|
@ -105,15 +105,15 @@
|
|||
};
|
||||
#endif
|
||||
|
||||
do_blocking_move_to_xy(1.5 * max_length(X_AXIS) * x_axis_home_dir, 1.5 * max_length(Y_AXIS) * Y_HOME_DIR, fr_mm_s);
|
||||
motion.blocking_move_xy(1.5 * motion.max_axis_length(X_AXIS) * x_axis_home_dir, 1.5 * motion.max_axis_length(Y_AXIS) * Y_HOME_DIR, fr_mm_s);
|
||||
|
||||
endstops.validate_homing_move();
|
||||
|
||||
current_position.set(0.0, 0.0);
|
||||
motion.position.set(0.0, 0.0);
|
||||
|
||||
TERN_(X_HAS_HOME_CURRENT, restore_homing_current(X_AXIS));
|
||||
TERN_(X_HAS_HOME_CURRENT, motion.restore_homing_current(X_AXIS));
|
||||
#if Y_HAS_HOME_CURRENT && NONE(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX)
|
||||
restore_homing_current(Y_AXIS);
|
||||
motion.restore_homing_current(Y_AXIS);
|
||||
#endif
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING) && DISABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
|
||||
|
|
@ -132,33 +132,33 @@
|
|||
DEBUG_SECTION(log_G28, "home_z_safely", DEBUGGING(LEVELING));
|
||||
|
||||
// Disallow Z homing if X or Y homing is needed
|
||||
if (homing_needed_error(_BV(X_AXIS) | _BV(Y_AXIS))) return;
|
||||
if (motion.homing_needed_error(_BV(X_AXIS) | _BV(Y_AXIS))) return;
|
||||
|
||||
// Potentially disable Fixed-Time Motion for homing
|
||||
TERN_(FT_MOTION, FTM_DISABLE_IN_SCOPE());
|
||||
|
||||
sync_plan_position();
|
||||
motion.sync_plan_position();
|
||||
|
||||
/**
|
||||
* Move the Z probe (or just the nozzle) to the safe homing point
|
||||
* (Z is already at the right height)
|
||||
*/
|
||||
constexpr xy_float_t safe_homing_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT };
|
||||
destination.set(safe_homing_xy, current_position.z);
|
||||
motion.destination.set(safe_homing_xy, motion.position.z);
|
||||
|
||||
TERN_(HOMING_Z_WITH_PROBE, destination -= probe.offset_xy);
|
||||
TERN_(HOMING_Z_WITH_PROBE, motion.destination -= probe.offset_xy);
|
||||
|
||||
if (position_is_reachable(destination)) {
|
||||
if (motion.can_reach(motion.destination)) {
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_POS("home_z_safely", destination);
|
||||
if (DEBUGGING(LEVELING)) DEBUG_POS("home_z_safely", motion.destination);
|
||||
|
||||
// Free the active extruder for movement
|
||||
TERN_(DUAL_X_CARRIAGE, idex_set_parked(false));
|
||||
TERN_(DUAL_X_CARRIAGE, motion.idex_set_parked(false));
|
||||
|
||||
TERN_(SENSORLESS_HOMING, safe_delay(500)); // Short delay needed to settle
|
||||
|
||||
do_blocking_move_to_xy(destination);
|
||||
homeaxis(Z_AXIS);
|
||||
motion.blocking_move_xy(motion.destination);
|
||||
motion.homeaxis(Z_AXIS);
|
||||
}
|
||||
else {
|
||||
LCD_MESSAGE(MSG_ZPROBE_OUT);
|
||||
|
|
@ -227,10 +227,10 @@ void GcodeSuite::G28() {
|
|||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
if (parser.seen_test('S')) {
|
||||
LOOP_NUM_AXES(a) set_axis_is_at_home((AxisEnum)a);
|
||||
sync_plan_position();
|
||||
LOOP_NUM_AXES(a) motion.set_axis_is_at_home((AxisEnum)a);
|
||||
motion.sync_plan_position();
|
||||
SERIAL_ECHOLNPGM("Simulated Homing");
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -243,14 +243,14 @@ void GcodeSuite::G28() {
|
|||
#endif
|
||||
|
||||
// Home (O)nly if position is unknown
|
||||
if (!axes_should_home() && parser.seen_test('O')) {
|
||||
if (!motion.axes_should_home() && parser.seen_test('O')) {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> homing not needed, skip");
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED(FULL_REPORT_TO_HOST_FEATURE)
|
||||
const M_StateEnum old_grblstate = M_State_grbl;
|
||||
set_and_report_grblstate(M_HOMING);
|
||||
const M_StateEnum old_grblstate = motion.M_State_grbl;
|
||||
motion.set_and_report_grblstate(M_HOMING);
|
||||
#endif
|
||||
|
||||
TERN_(DWIN_CREALITY_LCD, dwinHomingStart());
|
||||
|
|
@ -264,11 +264,11 @@ void GcodeSuite::G28() {
|
|||
#if NUM_AXES
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
bool IDEX_saved_duplication_state = extruder_duplication_enabled;
|
||||
DualXMode IDEX_saved_mode = dual_x_carriage_mode;
|
||||
bool IDEX_saved_duplication_state = motion.extruder_duplication;
|
||||
DualXMode IDEX_saved_mode = motion.idex_mode;
|
||||
#endif
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(false); // Reset a leftover 'loose' motion state
|
||||
motion.set_soft_endstop_loose(false); // Reset a leftover 'loose' motion state
|
||||
|
||||
// Disable the leveling matrix before homing
|
||||
#if CAN_SET_LEVELING_AFTER_G28
|
||||
|
|
@ -294,7 +294,7 @@ void GcodeSuite::G28() {
|
|||
// Always home with tool 0 active
|
||||
#if HAS_MULTI_HOTEND
|
||||
#if DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)
|
||||
const uint8_t old_tool_index = active_extruder;
|
||||
const uint8_t old_tool_index = motion.extruder;
|
||||
#endif
|
||||
// PARKING_EXTRUDER homing requires different handling of movement / solenoid activation, depending on the side of homing
|
||||
#if ENABLED(PARKING_EXTRUDER)
|
||||
|
|
@ -304,9 +304,9 @@ void GcodeSuite::G28() {
|
|||
tool_change(0, true);
|
||||
#endif
|
||||
|
||||
TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false));
|
||||
TERN_(HAS_DUPLICATION_MODE, motion.set_extruder_duplication(false));
|
||||
|
||||
remember_feedrate_scaling_off();
|
||||
motion.remember_feedrate_scaling_off();
|
||||
|
||||
endstops.enable(true); // Enable endstops for next homing move
|
||||
|
||||
|
|
@ -330,7 +330,7 @@ void GcodeSuite::G28() {
|
|||
|
||||
#else // !DELTA && !AXEL_TPARA
|
||||
|
||||
#define _UNSAFE(A) TERN0(Z_SAFE_HOMING, homeZZ && axis_should_home(_AXIS(A)))
|
||||
#define _UNSAFE(A) TERN0(Z_SAFE_HOMING, homeZZ && motion.axis_should_home(_AXIS(A)))
|
||||
|
||||
const bool homeZZ = TERN0(HAS_Z_AXIS, parser.seen_test('Z')),
|
||||
NUM_AXIS_LIST_( // Other axes should be homed before Z safe-homing
|
||||
|
|
@ -367,7 +367,7 @@ void GcodeSuite::G28() {
|
|||
|
||||
// Z may home first, e.g., when homing away from the bed.
|
||||
// This is also permitted when homing with a Z endstop.
|
||||
if (TERN0(HOME_Z_FIRST, doZ)) homeaxis(Z_AXIS);
|
||||
if (TERN0(HOME_Z_FIRST, doZ)) motion.homeaxis(Z_AXIS);
|
||||
|
||||
// 'R' to specify a specific raise. 'R0' indicates no raise, e.g., for recovery.resume
|
||||
// When 'R0' is used, there should already be adequate clearance, e.g., from homing Z to max.
|
||||
|
|
@ -386,15 +386,15 @@ void GcodeSuite::G28() {
|
|||
bool with_probe = ENABLED(HOMING_Z_WITH_PROBE);
|
||||
// Raise above the current Z (which should be synced in the planner)
|
||||
// The "height" for Z is a coordinate. But if Z is not trusted/homed make it relative.
|
||||
if (seenR || !(z_min_trusted || axis_should_home(Z_AXIS))) {
|
||||
z_homing_height += current_position.z;
|
||||
if (seenR || !(motion.z_min_trusted || motion.axis_should_home(Z_AXIS))) {
|
||||
z_homing_height += motion.position.z;
|
||||
with_probe = false;
|
||||
}
|
||||
|
||||
if (may_skate) {
|
||||
// Apply Z clearance before doing any lateral motion
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Raise Z before homing:");
|
||||
do_z_clearance(z_homing_height, with_probe);
|
||||
motion.do_z_clearance(z_homing_height, with_probe);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -409,50 +409,33 @@ void GcodeSuite::G28() {
|
|||
#if HAS_Y_AXIS
|
||||
// Home Y (before X)
|
||||
if (ENABLED(HOME_Y_BEFORE_X) && (doY || TERN0(CODEPENDENT_XY_HOMING, doX)))
|
||||
homeaxis(Y_AXIS);
|
||||
motion.homeaxis(Y_AXIS);
|
||||
#endif
|
||||
|
||||
// Home X
|
||||
#if HAS_X_AXIS
|
||||
if (doX || (doY && ENABLED(CODEPENDENT_XY_HOMING) && DISABLED(HOME_Y_BEFORE_X))) {
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
|
||||
// Always home the 2nd (right) extruder first
|
||||
active_extruder = 1;
|
||||
homeaxis(X_AXIS);
|
||||
|
||||
// Remember this extruder's position for later tool change
|
||||
inactive_extruder_x = current_position.x;
|
||||
|
||||
// Home the 1st (left) extruder
|
||||
active_extruder = 0;
|
||||
homeaxis(X_AXIS);
|
||||
|
||||
// Consider the active extruder to be in its "parked" position
|
||||
idex_set_parked();
|
||||
|
||||
motion.idex_home_x();
|
||||
#else
|
||||
|
||||
homeaxis(X_AXIS);
|
||||
|
||||
motion.homeaxis(X_AXIS);
|
||||
#endif
|
||||
}
|
||||
#endif // HAS_X_AXIS
|
||||
|
||||
#if ALL(FOAMCUTTER_XYUV, HAS_I_AXIS)
|
||||
// Home I (after X)
|
||||
if (doI) homeaxis(I_AXIS);
|
||||
if (doI) motion.homeaxis(I_AXIS);
|
||||
#endif
|
||||
|
||||
#if HAS_Y_AXIS
|
||||
// Home Y (after X)
|
||||
if (DISABLED(HOME_Y_BEFORE_X) && doY) homeaxis(Y_AXIS);
|
||||
if (DISABLED(HOME_Y_BEFORE_X) && doY) motion.homeaxis(Y_AXIS);
|
||||
#endif
|
||||
|
||||
#if ALL(FOAMCUTTER_XYUV, HAS_J_AXIS)
|
||||
// Home J (after Y)
|
||||
if (doJ) homeaxis(J_AXIS);
|
||||
if (doJ) motion.homeaxis(J_AXIS);
|
||||
#endif
|
||||
|
||||
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(saved_motion_state));
|
||||
|
|
@ -460,7 +443,7 @@ void GcodeSuite::G28() {
|
|||
#if ENABLED(FOAMCUTTER_XYUV)
|
||||
|
||||
// Skip homing of unused Z axis for foamcutters
|
||||
if (doZ) set_axis_is_at_home(Z_AXIS);
|
||||
if (doZ) motion.set_axis_is_at_home(Z_AXIS);
|
||||
|
||||
#elif HAS_Z_AXIS
|
||||
|
||||
|
|
@ -478,9 +461,9 @@ void GcodeSuite::G28() {
|
|||
if (!parser.seen_test('H'))
|
||||
home_z_safely();
|
||||
else
|
||||
homeaxis(Z_AXIS);
|
||||
motion.homeaxis(Z_AXIS);
|
||||
#else
|
||||
homeaxis(Z_AXIS);
|
||||
motion.homeaxis(Z_AXIS);
|
||||
#endif
|
||||
|
||||
#if ANY(Z_HOME_TO_MIN, ALLOW_Z_AFTER_HOMING)
|
||||
|
|
@ -490,19 +473,19 @@ void GcodeSuite::G28() {
|
|||
#endif
|
||||
|
||||
SECONDARY_AXIS_CODE(
|
||||
if (doI) homeaxis(I_AXIS),
|
||||
if (doJ) homeaxis(J_AXIS),
|
||||
if (doK) homeaxis(K_AXIS),
|
||||
if (doU) homeaxis(U_AXIS),
|
||||
if (doV) homeaxis(V_AXIS),
|
||||
if (doW) homeaxis(W_AXIS)
|
||||
if (doI) motion.homeaxis(I_AXIS),
|
||||
if (doJ) motion.homeaxis(J_AXIS),
|
||||
if (doK) motion.homeaxis(K_AXIS),
|
||||
if (doU) motion.homeaxis(U_AXIS),
|
||||
if (doV) motion.homeaxis(V_AXIS),
|
||||
if (doW) motion.homeaxis(W_AXIS)
|
||||
);
|
||||
|
||||
#endif // HAS_Z_AXIS
|
||||
|
||||
sync_plan_position();
|
||||
motion.sync_plan_position();
|
||||
|
||||
#endif
|
||||
#endif // !DELTA && !AXEL_TPARA
|
||||
|
||||
/**
|
||||
* Preserve DXC mode across a G28 for IDEX printers in DXC_DUPLICATION_MODE.
|
||||
|
|
@ -511,31 +494,13 @@ void GcodeSuite::G28() {
|
|||
* IDEX specific commands in it.
|
||||
*/
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
|
||||
if (idex_is_duplicating()) {
|
||||
|
||||
if (motion.idex_is_duplicating()) {
|
||||
TERN_(IMPROVE_HOMING_RELIABILITY, saved_motion_state = begin_slow_homing());
|
||||
|
||||
// Always home the 2nd (right) extruder first
|
||||
active_extruder = 1;
|
||||
homeaxis(X_AXIS);
|
||||
|
||||
// Remember this extruder's position for later tool change
|
||||
inactive_extruder_x = current_position.x;
|
||||
|
||||
// Home the 1st (left) extruder
|
||||
active_extruder = 0;
|
||||
homeaxis(X_AXIS);
|
||||
|
||||
// Consider the active extruder to be parked
|
||||
idex_set_parked();
|
||||
|
||||
dual_x_carriage_mode = IDEX_saved_mode;
|
||||
set_duplication_enabled(IDEX_saved_duplication_state);
|
||||
|
||||
motion.idex_home_x();
|
||||
motion.idex_mode = IDEX_saved_mode;
|
||||
motion.set_extruder_duplication(IDEX_saved_duplication_state);
|
||||
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(saved_motion_state));
|
||||
}
|
||||
|
||||
#endif // DUAL_X_CARRIAGE
|
||||
|
||||
endstops.not_homing();
|
||||
|
|
@ -544,13 +509,13 @@ void GcodeSuite::G28() {
|
|||
TERN_(SPI_ENDSTOPS, endstops.clear_endstop_state());
|
||||
|
||||
// Move to a height where we can use the full xy-area
|
||||
TERN_(DELTA_HOME_TO_SAFE_ZONE, do_blocking_move_to_z(delta_clip_start_height));
|
||||
TERN_(DELTA_HOME_TO_SAFE_ZONE, motion.blocking_move_z(delta_clip_start_height));
|
||||
|
||||
#if HAS_Z_AXIS
|
||||
// Move to the configured Z only if Z was homed to MIN, because machines that
|
||||
// home to MAX historically expect 'G28 Z' to be safe to use at the end of a
|
||||
// print, and do_move_after_z_homing is not very nuanced.
|
||||
if (finalRaiseZ) do_move_after_z_homing();
|
||||
if (finalRaiseZ) motion.do_move_after_z_homing();
|
||||
#endif
|
||||
|
||||
TERN_(CAN_SET_LEVELING_AFTER_G28, if (leveling_restore_state) set_bed_leveling_enabled());
|
||||
|
|
@ -561,11 +526,11 @@ void GcodeSuite::G28() {
|
|||
#endif
|
||||
|
||||
#ifdef XY_AFTER_HOMING
|
||||
if (!axes_should_home(_BV(X_AXIS) | _BV(Y_AXIS)))
|
||||
do_blocking_move_to(xy_pos_t(XY_AFTER_HOMING));
|
||||
if (!motion.axes_should_home(_BV(X_AXIS) | _BV(Y_AXIS)))
|
||||
motion.blocking_move(xy_pos_t(XY_AFTER_HOMING));
|
||||
#endif
|
||||
|
||||
restore_feedrate_and_scaling();
|
||||
motion.restore_feedrate_and_scaling();
|
||||
|
||||
if (ENABLED(NANODLP_Z_SYNC) && (ENABLED(NANODLP_ALL_AXIS) || TERN0(HAS_Z_AXIS, doZ)))
|
||||
SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP);
|
||||
|
|
@ -578,9 +543,9 @@ void GcodeSuite::G28() {
|
|||
TERN_(DWIN_CREALITY_LCD, dwinHomingDone());
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onHomingDone());
|
||||
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(old_grblstate));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(old_grblstate));
|
||||
|
||||
#ifdef EVENT_GCODE_AFTER_HOMING
|
||||
gcode.process_subcommands_now(F(EVENT_GCODE_AFTER_HOMING));
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ void ac_setup(const bool reset_bed) {
|
|||
TERN_(HAS_BED_PROBE, probe.use_probing_tool());
|
||||
|
||||
planner.synchronize();
|
||||
remember_feedrate_scaling_off();
|
||||
motion.remember_feedrate_scaling_off();
|
||||
|
||||
#if HAS_LEVELING
|
||||
if (reset_bed) reset_bed_level(); // After full calibration bed-level data is no longer valid
|
||||
|
|
@ -81,9 +81,9 @@ void ac_setup(const bool reset_bed) {
|
|||
}
|
||||
|
||||
void ac_cleanup() {
|
||||
TERN_(DELTA_HOME_TO_SAFE_ZONE, do_blocking_move_to_z(delta_clip_start_height));
|
||||
TERN_(DELTA_HOME_TO_SAFE_ZONE, motion.blocking_move_z(delta_clip_start_height));
|
||||
TERN_(HAS_BED_PROBE, probe.stow());
|
||||
restore_feedrate_and_scaling();
|
||||
motion.restore_feedrate_and_scaling();
|
||||
TERN_(HAS_BED_PROBE, probe.use_probing_tool(false));
|
||||
}
|
||||
|
||||
|
|
@ -247,7 +247,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
|
|||
LOOP_CAL_RAD(rad)
|
||||
z_pt[rad] /= _7P_STEP / steps;
|
||||
|
||||
do_blocking_move_to_xy(0.0f, 0.0f);
|
||||
motion.blocking_move_xy(0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -268,7 +268,7 @@ static void reverse_kinematics_probe_points(float z_pt[NPP + 1], abc_float_t mm_
|
|||
r = (rad == CEN ? 0.0f : dcr);
|
||||
pos.set(cos(a) * r, sin(a) * r, z_pt[rad]);
|
||||
inverse_kinematics(pos);
|
||||
mm_at_pt_axis[rad] = delta;
|
||||
mm_at_pt_axis[rad] = motion.delta;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -387,7 +387,7 @@ static float auto_tune_a(const float dcr) {
|
|||
*/
|
||||
void GcodeSuite::G33() {
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_PROBE));
|
||||
|
||||
const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
|
||||
if (!WITHIN(probe_points, 0, 10)) {
|
||||
|
|
@ -677,7 +677,7 @@ void GcodeSuite::G33() {
|
|||
|
||||
ac_cleanup();
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_IDLE));
|
||||
#if HAS_DELTA_SENSORLESS_PROBING
|
||||
probe.test_sensitivity = { true, true, true };
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@
|
|||
void GcodeSuite::G34() {
|
||||
|
||||
// Home before the alignment procedure
|
||||
home_if_needed();
|
||||
motion.home_if_needed();
|
||||
|
||||
TERN_(HAS_LEVELING, TEMPORARY_BED_LEVELING_STATE(false));
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
motion.set_soft_endstop_loose(true);
|
||||
TemporaryGlobalEndstopsState unlock_z(false);
|
||||
|
||||
#ifdef GANTRY_CALIBRATION_COMMANDS_PRE
|
||||
|
|
@ -77,7 +77,7 @@ void GcodeSuite::G34() {
|
|||
// Move XY to safe position
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Parking XY");
|
||||
const xy_pos_t safe_pos = GANTRY_CALIBRATION_SAFE_POSITION;
|
||||
do_blocking_move_to_xy(safe_pos, MMM_TO_MMS(GANTRY_CALIBRATION_XY_PARK_FEEDRATE));
|
||||
motion.blocking_move_xy(safe_pos, MMM_TO_MMS(GANTRY_CALIBRATION_XY_PARK_FEEDRATE));
|
||||
#endif
|
||||
|
||||
const float move_distance = parser.intval('Z', GANTRY_CALIBRATION_EXTRA_HEIGHT),
|
||||
|
|
@ -86,7 +86,7 @@ void GcodeSuite::G34() {
|
|||
|
||||
// Move Z to pounce position
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Setting Z Pounce");
|
||||
do_blocking_move_to_z(zpounce, homing_feedrate(Z_AXIS));
|
||||
motion.blocking_move_z(zpounce, motion.homing_feedrate(Z_AXIS));
|
||||
|
||||
// Store current motor settings, then apply reduced value
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ void GcodeSuite::G34() {
|
|||
|
||||
// Do Final Z move to adjust
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Final Z Move");
|
||||
do_blocking_move_to_z(zgrind, MMM_TO_MMS(GANTRY_CALIBRATION_FEEDRATE));
|
||||
motion.blocking_move_z(zgrind, MMM_TO_MMS(GANTRY_CALIBRATION_FEEDRATE));
|
||||
|
||||
#if _REDUCE_CURRENT
|
||||
// Reset current to original values
|
||||
|
|
@ -157,14 +157,14 @@ void GcodeSuite::G34() {
|
|||
|
||||
// Back off end plate, back to normal motion range
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Z Backoff");
|
||||
do_blocking_move_to_z(zpounce, MMM_TO_MMS(GANTRY_CALIBRATION_FEEDRATE));
|
||||
motion.blocking_move_z(zpounce, MMM_TO_MMS(GANTRY_CALIBRATION_FEEDRATE));
|
||||
|
||||
#ifdef GANTRY_CALIBRATION_COMMANDS_POST
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Running Post Commands");
|
||||
process_subcommands_now(F(GANTRY_CALIBRATION_COMMANDS_POST));
|
||||
#endif
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
motion.set_soft_endstop_loose(false);
|
||||
}
|
||||
|
||||
#endif // MECHANICAL_GANTRY_CALIBRATION
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ void GcodeSuite::G34() {
|
|||
gcode.process_subcommands_now(F(EVENT_GCODE_BEFORE_G34));
|
||||
#endif
|
||||
|
||||
TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false));
|
||||
TERN_(HAS_DUPLICATION_MODE, motion.set_extruder_duplication(false));
|
||||
|
||||
// Compute a worst-case clearance height to probe from. After the first
|
||||
// iteration this will be re-calculated based on the actual bed position
|
||||
|
|
@ -167,7 +167,7 @@ void GcodeSuite::G34() {
|
|||
));
|
||||
|
||||
// Home before the alignment procedure
|
||||
home_if_needed();
|
||||
motion.home_if_needed();
|
||||
|
||||
#if !HAS_Z_STEPPER_ALIGN_STEPPER_XY
|
||||
float last_z_align_move[NUM_Z_STEPPERS] = ARRAY_N_1(NUM_Z_STEPPERS, 10000.0f);
|
||||
|
|
@ -217,7 +217,7 @@ void GcodeSuite::G34() {
|
|||
|
||||
// Probe a Z height for each stepper.
|
||||
// Probing sanity check is disabled, as it would trigger even in normal cases because
|
||||
// current_position.z has been manually altered in the "dirty trick" above.
|
||||
// motion.position.z has been manually altered in the "dirty trick" above.
|
||||
|
||||
const float minz = (Z_PROBE_LOW_POINT) - (z_probe * 0.5f);
|
||||
|
||||
|
|
@ -228,7 +228,7 @@ void GcodeSuite::G34() {
|
|||
}
|
||||
|
||||
const float z_probed_height = probe.probe_at_point(
|
||||
DIFF_TERN(HAS_HOME_OFFSET, ppos, xy_pos_t(home_offset)), // xy
|
||||
DIFF_TERN(HAS_HOME_OFFSET, ppos, xy_pos_t(motion.home_offset)), // xy
|
||||
raise_after, // raise_after
|
||||
(DEBUGGING(LEVELING) || DEBUGGING(INFO)) ? 3 : 0, // verbose_level
|
||||
true, false, // probe_relative, sanity_check
|
||||
|
|
@ -396,7 +396,7 @@ void GcodeSuite::G34() {
|
|||
#endif
|
||||
|
||||
// Do a move to correct part of the misalignment for the current stepper
|
||||
do_blocking_move_to_z(amplification * z_align_move + current_position.z);
|
||||
motion.blocking_move_z(amplification * z_align_move + motion.position.z);
|
||||
} // for (zstepper)
|
||||
|
||||
// Back to normal stepper operations
|
||||
|
|
@ -440,8 +440,8 @@ void GcodeSuite::G34() {
|
|||
);
|
||||
|
||||
if (!err_break)
|
||||
current_position.z -= z_measured_min - (Z_TWEEN_SAFE_CLEARANCE + zoffs); // We shouldn't want to subtract the clearance from here right? (Depends if we added it further up)
|
||||
sync_plan_position();
|
||||
motion.position.z -= z_measured_min - (Z_TWEEN_SAFE_CLEARANCE + zoffs); // We shouldn't want to subtract the clearance from here right? (Depends if we added it further up)
|
||||
motion.sync_plan_position();
|
||||
#endif
|
||||
|
||||
#ifdef EVENT_GCODE_AFTER_G34
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ struct measurements_t {
|
|||
#endif
|
||||
|
||||
inline void calibration_move() {
|
||||
do_blocking_move_to((xyz_pos_t)current_position, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL));
|
||||
motion.blocking_move((xyz_pos_t)motion.position, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -156,17 +156,17 @@ inline void calibration_move() {
|
|||
*/
|
||||
inline void park_above_object(measurements_t &m, const float uncertainty) {
|
||||
// Move to safe distance above calibration object
|
||||
current_position.z = m.obj_center.z + dimensions.z / 2 + uncertainty;
|
||||
motion.position.z = m.obj_center.z + dimensions.z / 2 + uncertainty;
|
||||
calibration_move();
|
||||
|
||||
// Move to center of calibration object in XY
|
||||
current_position = xy_pos_t(m.obj_center);
|
||||
motion.position = xy_pos_t(m.obj_center);
|
||||
calibration_move();
|
||||
}
|
||||
|
||||
#if HAS_MULTI_HOTEND
|
||||
inline void set_nozzle(measurements_t &m, const uint8_t extruder) {
|
||||
if (extruder != active_extruder) {
|
||||
if (extruder != motion.extruder) {
|
||||
park_above_object(m, CALIBRATION_MEASUREMENT_UNKNOWN);
|
||||
tool_change(extruder);
|
||||
}
|
||||
|
|
@ -177,8 +177,8 @@ inline void park_above_object(measurements_t &m, const float uncertainty) {
|
|||
|
||||
inline void normalize_hotend_offsets() {
|
||||
for (uint8_t e = 1; e < HOTENDS; ++e)
|
||||
hotend_offset[e] -= hotend_offset[0];
|
||||
hotend_offset[0].reset();
|
||||
motion.hotend_offset[e] -= motion.hotend_offset[0];
|
||||
motion.hotend_offset[0].reset();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -196,15 +196,15 @@ float measuring_movement(const AxisEnum axis, const int dir, const bool stop_sta
|
|||
const feedRate_t mms = fast ? MMM_TO_MMS(CALIBRATION_FEEDRATE_FAST) : MMM_TO_MMS(CALIBRATION_FEEDRATE_SLOW);
|
||||
const float limit = fast ? 50 : 5;
|
||||
|
||||
destination = current_position;
|
||||
destination[axis] += dir * limit;
|
||||
motion.destination = motion.position;
|
||||
motion.destination[axis] += dir * limit;
|
||||
endstops.enable_calibration_probe(true, stop_state);
|
||||
do_blocking_move_to((xyz_pos_t)destination, mms);
|
||||
motion.blocking_move((xyz_pos_t)motion.destination, mms);
|
||||
endstops.enable_calibration_probe(false);
|
||||
endstops.hit_on_purpose();
|
||||
set_current_from_steppers_for_axis(axis);
|
||||
sync_plan_position();
|
||||
return current_position[axis];
|
||||
motion.set_current_from_steppers_for_axis(axis);
|
||||
motion.sync_plan_position();
|
||||
return motion.position[axis];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -221,7 +221,7 @@ inline float measure(const AxisEnum axis, const int dir, const bool stop_state,
|
|||
const bool fast = uncertainty == CALIBRATION_MEASUREMENT_UNKNOWN;
|
||||
|
||||
// Save the current position of the specified axis
|
||||
const float start_pos = current_position[axis];
|
||||
const float start_pos = motion.position[axis];
|
||||
|
||||
// Take a measurement. Only the specified axis will be affected.
|
||||
const float measured_pos = measuring_movement(axis, dir, stop_state, fast);
|
||||
|
|
@ -233,9 +233,9 @@ inline float measure(const AxisEnum axis, const int dir, const bool stop_state,
|
|||
}
|
||||
|
||||
// Move back to the starting position
|
||||
destination = current_position;
|
||||
destination[axis] = start_pos;
|
||||
do_blocking_move_to((xyz_pos_t)destination, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL));
|
||||
motion.destination = motion.position;
|
||||
motion.destination[axis] = start_pos;
|
||||
motion.blocking_move((xyz_pos_t)motion.destination, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL));
|
||||
return measured_pos;
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ inline void probe_side(measurements_t &m, const float uncertainty, const side_t
|
|||
if (probe_top_at_edge) {
|
||||
#if AXIS_CAN_CALIBRATE(Z)
|
||||
// Probe top nearest the side we are probing
|
||||
current_position[axis] = m.obj_center[axis] + (-dir) * (dimensions[axis] / 2 - m.nozzle_outer_dimension[axis]);
|
||||
motion.position[axis] = m.obj_center[axis] + (-dir) * (dimensions[axis] / 2 - m.nozzle_outer_dimension[axis]);
|
||||
calibration_move();
|
||||
m.obj_side[TOP] = measure(Z_AXIS, -1, true, &m.backlash[TOP], uncertainty);
|
||||
m.obj_center.z = m.obj_side[TOP] - dimensions.z / 2;
|
||||
|
|
@ -306,11 +306,11 @@ inline void probe_side(measurements_t &m, const float uncertainty, const side_t
|
|||
|
||||
if ((AXIS_CAN_CALIBRATE(X) && axis == X_AXIS) || (AXIS_CAN_CALIBRATE(Y) && axis == Y_AXIS)) {
|
||||
// Move to safe distance to the side of the calibration object
|
||||
current_position[axis] = m.obj_center[axis] + (-dir) * (dimensions[axis] / 2 + m.nozzle_outer_dimension[axis] / 2 + uncertainty);
|
||||
motion.position[axis] = m.obj_center[axis] + (-dir) * (dimensions[axis] / 2 + m.nozzle_outer_dimension[axis] / 2 + uncertainty);
|
||||
calibration_move();
|
||||
|
||||
// Plunge below the side of the calibration object and measure
|
||||
current_position.z = m.obj_side[TOP] - (CALIBRATION_NOZZLE_TIP_HEIGHT) * 0.7f;
|
||||
motion.position.z = m.obj_side[TOP] - (CALIBRATION_NOZZLE_TIP_HEIGHT) * 0.7f;
|
||||
calibration_move();
|
||||
const float measurement = measure(axis, dir, true, &m.backlash[side], uncertainty);
|
||||
m.obj_center[axis] = measurement + dir * (dimensions[axis] / 2 + m.nozzle_outer_dimension[axis] / 2);
|
||||
|
|
@ -522,7 +522,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
|
|||
|
||||
inline void report_measured_positional_error(const measurements_t &m) {
|
||||
SERIAL_CHAR('T');
|
||||
SERIAL_ECHO(active_extruder);
|
||||
SERIAL_ECHO(motion.extruder);
|
||||
SERIAL_ECHOLNPGM(" Positional Error:");
|
||||
#if HAS_X_CENTER && AXIS_CAN_CALIBRATE(X)
|
||||
SERIAL_ECHOLNPGM_P(SP_X_STR, m.pos_error.x);
|
||||
|
|
@ -568,7 +568,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
|
|||
//
|
||||
inline void report_hotend_offsets() {
|
||||
for (uint8_t e = 1; e < HOTENDS; ++e)
|
||||
SERIAL_ECHOLNPGM_P(PSTR("T"), e, PSTR(" Hotend Offset X"), hotend_offset[e].x, SP_Y_STR, hotend_offset[e].y, SP_Z_STR, hotend_offset[e].z);
|
||||
SERIAL_ECHOLNPGM_P(PSTR("T"), e, PSTR(" Hotend Offset X"), motion.hotend_offset[e].x, SP_Y_STR, motion.hotend_offset[e].y, SP_Z_STR, motion.hotend_offset[e].z);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -673,14 +673,14 @@ inline void calibrate_backlash(measurements_t &m, const float uncertainty) {
|
|||
AXIS_CAN_CALIBRATE(I) * 3, AXIS_CAN_CALIBRATE(J) * 3, AXIS_CAN_CALIBRATE(K) * 3,
|
||||
AXIS_CAN_CALIBRATE(U) * 3, AXIS_CAN_CALIBRATE(V) * 3, AXIS_CAN_CALIBRATE(W) * 3
|
||||
);
|
||||
current_position += move; calibration_move();
|
||||
current_position -= move; calibration_move();
|
||||
motion.position += move; calibration_move();
|
||||
motion.position -= move; calibration_move();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void update_measurements(measurements_t &m, const AxisEnum axis) {
|
||||
current_position[axis] += m.pos_error[axis];
|
||||
motion.position[axis] += m.pos_error[axis];
|
||||
m.obj_center[axis] = true_center[axis];
|
||||
m.pos_error[axis] = 0;
|
||||
}
|
||||
|
|
@ -706,9 +706,10 @@ inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const
|
|||
|
||||
// Adjust the hotend offset
|
||||
#if HAS_HOTEND_OFFSET
|
||||
if (ENABLED(HAS_X_CENTER) && AXIS_CAN_CALIBRATE(X)) hotend_offset[extruder].x += m.pos_error.x;
|
||||
if (ENABLED(HAS_Y_CENTER) && AXIS_CAN_CALIBRATE(Y)) hotend_offset[extruder].y += m.pos_error.y;
|
||||
if (AXIS_CAN_CALIBRATE(Z)) hotend_offset[extruder].z += m.pos_error.z;
|
||||
xyz_pos_t &hotoff = motion.active_hotend_offset();
|
||||
if (ENABLED(HAS_X_CENTER) && AXIS_CAN_CALIBRATE(X)) hotoff.x += m.pos_error.x;
|
||||
if (ENABLED(HAS_Y_CENTER) && AXIS_CAN_CALIBRATE(Y)) hotoff.y += m.pos_error.y;
|
||||
if (AXIS_CAN_CALIBRATE(Z)) hotoff.z += m.pos_error.z;
|
||||
normalize_hotend_offsets();
|
||||
#endif
|
||||
|
||||
|
|
@ -726,7 +727,7 @@ inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const
|
|||
TERN_(HAS_V_CENTER, update_measurements(m, V_AXIS));
|
||||
TERN_(HAS_W_CENTER, update_measurements(m, W_AXIS));
|
||||
|
||||
sync_plan_position();
|
||||
motion.sync_plan_position();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -761,7 +762,7 @@ inline void calibrate_all_toolheads(measurements_t &m, const float uncertainty)
|
|||
inline void calibrate_all() {
|
||||
measurements_t m;
|
||||
|
||||
TERN_(HAS_HOTEND_OFFSET, reset_hotend_offsets());
|
||||
TERN_(HAS_HOTEND_OFFSET, motion.reset_hotend_offsets());
|
||||
|
||||
TEMPORARY_BACKLASH_CORRECTION(backlash.all_on);
|
||||
TEMPORARY_BACKLASH_SMOOTHING(0.0f);
|
||||
|
|
@ -779,7 +780,7 @@ inline void calibrate_all() {
|
|||
// Do a slow and precise calibration of the toolheads
|
||||
calibrate_all_toolheads(m, CALIBRATION_MEASUREMENT_UNCERTAIN);
|
||||
|
||||
current_position.x = X_CENTER;
|
||||
motion.position.x = X_CENTER;
|
||||
calibration_move(); // Park nozzle away from calibration object
|
||||
}
|
||||
|
||||
|
|
@ -799,10 +800,10 @@ void GcodeSuite::G425() {
|
|||
process_subcommands_now(F(CALIBRATION_SCRIPT_PRE));
|
||||
#endif
|
||||
|
||||
if (homing_needed_error()) return;
|
||||
if (motion.homing_needed_error()) return;
|
||||
|
||||
TEMPORARY_BED_LEVELING_STATE(false);
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
motion.set_soft_endstop_loose(true);
|
||||
|
||||
measurements_t m;
|
||||
const float uncertainty = parser.floatval('U', CALIBRATION_MEASUREMENT_UNCERTAIN);
|
||||
|
|
@ -810,7 +811,7 @@ void GcodeSuite::G425() {
|
|||
if (parser.seen_test('B'))
|
||||
calibrate_backlash(m, uncertainty);
|
||||
else if (parser.seen_test('T'))
|
||||
calibrate_toolhead(m, uncertainty, parser.intval('T', active_extruder));
|
||||
calibrate_toolhead(m, uncertainty, parser.intval('T', motion.extruder));
|
||||
#if ENABLED(CALIBRATION_REPORTING)
|
||||
else if (parser.seen('V')) {
|
||||
probe_sides(m, uncertainty);
|
||||
|
|
@ -829,7 +830,7 @@ void GcodeSuite::G425() {
|
|||
else
|
||||
calibrate_all();
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
motion.set_soft_endstop_loose(false);
|
||||
|
||||
#ifdef CALIBRATION_SCRIPT_POST
|
||||
process_subcommands_now(F(CALIBRATION_SCRIPT_POST));
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@
|
|||
const millis_t ms = millis();
|
||||
if (ELAPSED(ms, ntr)) {
|
||||
ntr = ms + 1000;
|
||||
thermalManager.print_heater_states(active_extruder);
|
||||
thermalManager.print_heater_states(motion.extruder);
|
||||
}
|
||||
return (timeout && ELAPSED(ms, timeout));
|
||||
};
|
||||
|
|
@ -150,7 +150,7 @@
|
|||
|
||||
if (do_bed_cal || do_probe_cal) {
|
||||
// Ensure park position is reachable
|
||||
bool reachable = position_is_reachable(parkpos) || WITHIN(parkpos.z, Z_MIN_POS - fslop, Z_MAX_POS + fslop);
|
||||
bool reachable = motion.can_reach(parkpos) || WITHIN(parkpos.z, Z_MIN_POS - fslop, Z_MAX_POS + fslop);
|
||||
if (!reachable)
|
||||
SERIAL_ECHOLNPGM("!Park");
|
||||
else {
|
||||
|
|
@ -167,7 +167,7 @@
|
|||
process_subcommands_now(FPSTR(G28_STR));
|
||||
}
|
||||
|
||||
remember_feedrate_scaling_off();
|
||||
motion.remember_feedrate_scaling_off();
|
||||
|
||||
/******************************************
|
||||
* Calibrate bed temperature offsets
|
||||
|
|
@ -198,7 +198,7 @@
|
|||
report_targets(target_bed, target_probe);
|
||||
|
||||
// Park nozzle
|
||||
do_blocking_move_to(parkpos);
|
||||
motion.blocking_move(parkpos);
|
||||
|
||||
// Wait for heatbed to reach target temp and probe to cool below target temp
|
||||
if (wait_for_temps(target_bed, target_probe, next_temp_report, millis() + MIN_TO_MS(15))) {
|
||||
|
|
@ -207,7 +207,7 @@
|
|||
}
|
||||
|
||||
// Move the nozzle to the probing point and wait for the probe to reach target temp
|
||||
do_blocking_move_to(noz_pos_xyz);
|
||||
motion.blocking_move(noz_pos_xyz);
|
||||
say_waiting_for_probe_heating();
|
||||
SERIAL_EOL();
|
||||
while (thermalManager.wholeDegProbe() < target_probe)
|
||||
|
|
@ -239,7 +239,7 @@
|
|||
if (do_probe_cal) {
|
||||
|
||||
// Park nozzle
|
||||
do_blocking_move_to(parkpos);
|
||||
motion.blocking_move(parkpos);
|
||||
|
||||
// Initialize temperatures
|
||||
const celsius_t target_bed = BED_MAX_TARGET;
|
||||
|
|
@ -258,7 +258,7 @@
|
|||
bool timeout = false;
|
||||
for (uint8_t idx = 0; idx <= PTC_PROBE_COUNT; idx++) {
|
||||
// Move probe to probing point and wait for it to reach target temperature
|
||||
do_blocking_move_to(noz_pos_xyz);
|
||||
motion.blocking_move(noz_pos_xyz);
|
||||
|
||||
say_waiting_for_probe_heating();
|
||||
SERIAL_ECHOLNPGM(" Bed:", target_bed, " Probe:", target_probe);
|
||||
|
|
@ -291,7 +291,7 @@
|
|||
ptc.print_offsets();
|
||||
} // do_probe_cal
|
||||
|
||||
restore_feedrate_and_scaling();
|
||||
motion.restore_feedrate_and_scaling();
|
||||
}
|
||||
|
||||
#endif // PTC_PROBE && PTC_BED
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
void GcodeSuite::M48() {
|
||||
|
||||
if (homing_needed_error()) return;
|
||||
if (motion.homing_needed_error()) return;
|
||||
|
||||
const int8_t verbose_level = parser.byteval('V', 1);
|
||||
if (!WITHIN(verbose_level, 0, 4)) {
|
||||
|
|
@ -76,8 +76,8 @@ void GcodeSuite::M48() {
|
|||
|
||||
// Test at the current position by default, overridden by X and Y
|
||||
const xy_pos_t test_position = {
|
||||
parser.linearval('X', current_position.x + probe.offset_xy.x), // If no X use the probe's current X position
|
||||
parser.linearval('Y', current_position.y + probe.offset_xy.y) // If no Y, ditto
|
||||
parser.linearval('X', motion.position.x + probe.offset_xy.x), // If no X use the probe's current X position
|
||||
parser.linearval('Y', motion.position.y + probe.offset_xy.y) // If no Y, ditto
|
||||
};
|
||||
|
||||
if (!probe.can_reach(test_position)) {
|
||||
|
|
@ -115,7 +115,7 @@ void GcodeSuite::M48() {
|
|||
TERN_(HAS_PTC, ptc.set_enabled(parser.boolval('C', true)));
|
||||
|
||||
// Work with reasonable feedrates
|
||||
remember_feedrate_scaling_off();
|
||||
motion.remember_feedrate_scaling_off();
|
||||
|
||||
// Working variables
|
||||
float mean = 0.0, // The average of all points so far, used to calculate deviation
|
||||
|
|
@ -216,7 +216,7 @@ void GcodeSuite::M48() {
|
|||
if (verbose_level > 3)
|
||||
SERIAL_ECHOLN(F("Going to: X"), next_pos.x, FPSTR(SP_Y_STR), next_pos.y);
|
||||
|
||||
do_blocking_move_to_xy(next_pos);
|
||||
motion.blocking_move_xy(next_pos);
|
||||
} // n_legs loop
|
||||
} // n_legs
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ void GcodeSuite::M48() {
|
|||
#endif
|
||||
}
|
||||
|
||||
restore_feedrate_and_scaling();
|
||||
motion.restore_feedrate_and_scaling();
|
||||
|
||||
// Re-enable bed level correction if it had been on
|
||||
TERN_(HAS_LEVELING, set_bed_leveling_enabled(was_enabled));
|
||||
|
|
@ -285,7 +285,7 @@ void GcodeSuite::M48() {
|
|||
// Re-enable probe temperature correction
|
||||
TERN_(HAS_PTC, ptc.set_enabled(true));
|
||||
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
}
|
||||
|
||||
#endif // Z_MIN_PROBE_REPEATABILITY_TEST
|
||||
|
|
|
|||
|
|
@ -106,13 +106,13 @@
|
|||
|
||||
#if HAS_SCARA_OFFSET
|
||||
|
||||
if (parser.seenval('Z')) scara_home_offset.z = parser.value_linear_units();
|
||||
if (parser.seenval('Z')) motion.scara_home_offset.z = parser.value_linear_units();
|
||||
|
||||
const bool hasA = parser.seenval('A'), hasP = parser.seenval('P'), hasX = parser.seenval('X');
|
||||
const uint8_t sumAPX = hasA + hasP + hasX;
|
||||
if (sumAPX) {
|
||||
if (sumAPX == 1)
|
||||
scara_home_offset.a = parser.value_float();
|
||||
motion.scara_home_offset.a = parser.value_float();
|
||||
else {
|
||||
SERIAL_ERROR_MSG("Only one of A, P, or X is allowed.");
|
||||
return;
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
const uint8_t sumBTY = hasB + hasT + hasY;
|
||||
if (sumBTY) {
|
||||
if (sumBTY == 1)
|
||||
scara_home_offset.b = parser.value_float();
|
||||
motion.scara_home_offset.b = parser.value_float();
|
||||
else {
|
||||
SERIAL_ERROR_MSG("Only one of B, T, or Y is allowed.");
|
||||
return;
|
||||
|
|
@ -140,9 +140,9 @@
|
|||
SERIAL_ECHOLNPGM_P(
|
||||
PSTR(" M665 S"), segments_per_second
|
||||
#if HAS_SCARA_OFFSET
|
||||
, SP_P_STR, scara_home_offset.a
|
||||
, SP_T_STR, scara_home_offset.b
|
||||
, SP_Z_STR, LINEAR_UNIT(scara_home_offset.z)
|
||||
, SP_P_STR, motion.scara_home_offset.a
|
||||
, SP_T_STR, motion.scara_home_offset.b
|
||||
, SP_Z_STR, LINEAR_UNIT(motion.scara_home_offset.z)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,9 +89,9 @@ void GcodeSuite::M852() {
|
|||
|
||||
// When skew is changed the current position changes
|
||||
if (setval) {
|
||||
set_current_from_steppers_for_axis(ALL_AXES_ENUM);
|
||||
sync_plan_position();
|
||||
report_current_position();
|
||||
motion.set_current_from_steppers_for_axis(ALL_AXES_ENUM);
|
||||
motion.sync_plan_position();
|
||||
motion.report_position();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,15 +48,15 @@ void GcodeSuite::M210() {
|
|||
return M210_report();
|
||||
|
||||
NUM_AXIS_CODE(
|
||||
if (parser.floatval(AXIS1_PARAM) > 0) homing_feedrate_mm_m.x = parser.value_axis_units(X_AXIS),
|
||||
if (parser.floatval(AXIS2_PARAM) > 0) homing_feedrate_mm_m.y = parser.value_axis_units(Y_AXIS),
|
||||
if (parser.floatval(AXIS3_PARAM) > 0) homing_feedrate_mm_m.z = parser.value_axis_units(Z_AXIS),
|
||||
if (parser.floatval(AXIS4_PARAM) > 0) homing_feedrate_mm_m.i = parser.value_axis_units(I_AXIS),
|
||||
if (parser.floatval(AXIS5_PARAM) > 0) homing_feedrate_mm_m.j = parser.value_axis_units(J_AXIS),
|
||||
if (parser.floatval(AXIS6_PARAM) > 0) homing_feedrate_mm_m.k = parser.value_axis_units(K_AXIS),
|
||||
if (parser.floatval(AXIS7_PARAM) > 0) homing_feedrate_mm_m.u = parser.value_axis_units(U_AXIS),
|
||||
if (parser.floatval(AXIS8_PARAM) > 0) homing_feedrate_mm_m.v = parser.value_axis_units(V_AXIS),
|
||||
if (parser.floatval(AXIS9_PARAM) > 0) homing_feedrate_mm_m.w = parser.value_axis_units(W_AXIS)
|
||||
if (parser.floatval(AXIS1_PARAM) > 0) motion.homing_feedrate_mm_m.x = parser.value_axis_units(X_AXIS),
|
||||
if (parser.floatval(AXIS2_PARAM) > 0) motion.homing_feedrate_mm_m.y = parser.value_axis_units(Y_AXIS),
|
||||
if (parser.floatval(AXIS3_PARAM) > 0) motion.homing_feedrate_mm_m.z = parser.value_axis_units(Z_AXIS),
|
||||
if (parser.floatval(AXIS4_PARAM) > 0) motion.homing_feedrate_mm_m.i = parser.value_axis_units(I_AXIS),
|
||||
if (parser.floatval(AXIS5_PARAM) > 0) motion.homing_feedrate_mm_m.j = parser.value_axis_units(J_AXIS),
|
||||
if (parser.floatval(AXIS6_PARAM) > 0) motion.homing_feedrate_mm_m.k = parser.value_axis_units(K_AXIS),
|
||||
if (parser.floatval(AXIS7_PARAM) > 0) motion.homing_feedrate_mm_m.u = parser.value_axis_units(U_AXIS),
|
||||
if (parser.floatval(AXIS8_PARAM) > 0) motion.homing_feedrate_mm_m.v = parser.value_axis_units(V_AXIS),
|
||||
if (parser.floatval(AXIS9_PARAM) > 0) motion.homing_feedrate_mm_m.w = parser.value_axis_units(W_AXIS)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -67,15 +67,15 @@ void GcodeSuite::M210_report(const bool forReplay/*=true*/) {
|
|||
|
||||
SERIAL_ECHOPGM(" M210");
|
||||
SERIAL_ECHOLNPGM_P(NUM_AXIS_PAIRED_LIST(
|
||||
SP_X_STR, X_AXIS_UNIT(homing_feedrate_mm_m.x),
|
||||
SP_Y_STR, Y_AXIS_UNIT(homing_feedrate_mm_m.y),
|
||||
SP_Z_STR, Z_AXIS_UNIT(homing_feedrate_mm_m.z),
|
||||
SP_I_STR, I_AXIS_UNIT(homing_feedrate_mm_m.i),
|
||||
SP_J_STR, J_AXIS_UNIT(homing_feedrate_mm_m.j),
|
||||
SP_K_STR, K_AXIS_UNIT(homing_feedrate_mm_m.k),
|
||||
SP_U_STR, U_AXIS_UNIT(homing_feedrate_mm_m.u),
|
||||
SP_V_STR, V_AXIS_UNIT(homing_feedrate_mm_m.v),
|
||||
SP_W_STR, W_AXIS_UNIT(homing_feedrate_mm_m.w)
|
||||
SP_X_STR, X_AXIS_UNIT(motion.homing_feedrate_mm_m.x),
|
||||
SP_Y_STR, Y_AXIS_UNIT(motion.homing_feedrate_mm_m.y),
|
||||
SP_Z_STR, Z_AXIS_UNIT(motion.homing_feedrate_mm_m.z),
|
||||
SP_I_STR, I_AXIS_UNIT(motion.homing_feedrate_mm_m.i),
|
||||
SP_J_STR, J_AXIS_UNIT(motion.homing_feedrate_mm_m.j),
|
||||
SP_K_STR, K_AXIS_UNIT(motion.homing_feedrate_mm_m.k),
|
||||
SP_U_STR, U_AXIS_UNIT(motion.homing_feedrate_mm_m.u),
|
||||
SP_V_STR, V_AXIS_UNIT(motion.homing_feedrate_mm_m.v),
|
||||
SP_W_STR, W_AXIS_UNIT(motion.homing_feedrate_mm_m.w)
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#endif
|
||||
|
||||
#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
|
||||
#include "../../module/motion.h" // for active_extruder
|
||||
#include "../../module/motion.h" // for motion.extruder
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
@ -133,7 +133,7 @@ void GcodeSuite::M217() {
|
|||
const int16_t lval = parser.value_int();
|
||||
if (WITHIN(lval, 0, EXTRUDERS - 1)) {
|
||||
migration.last = lval;
|
||||
migration.automode = (active_extruder < migration.last);
|
||||
migration.automode = (motion.extruder < migration.last);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ void GcodeSuite::M217() {
|
|||
if (parser.seen('T')) { // Migrate now
|
||||
if (parser.has_value()) {
|
||||
const int16_t tval = parser.value_int();
|
||||
if (WITHIN(tval, 0, EXTRUDERS - 1) && tval != active_extruder) {
|
||||
if (WITHIN(tval, 0, EXTRUDERS - 1) && tval != motion.extruder) {
|
||||
migration.target = tval + 1;
|
||||
extruder_migration();
|
||||
migration.target = 0; // disable
|
||||
|
|
|
|||
|
|
@ -47,18 +47,18 @@ void GcodeSuite::M218() {
|
|||
if (target_extruder < 0) return;
|
||||
|
||||
#if HAS_X_AXIS
|
||||
if (parser.seenval('X')) hotend_offset[target_extruder].x = parser.value_linear_units();
|
||||
if (parser.seenval('X')) motion.hotend_offset[target_extruder].x = parser.value_linear_units();
|
||||
#endif
|
||||
#if HAS_Y_AXIS
|
||||
if (parser.seenval('Y')) hotend_offset[target_extruder].y = parser.value_linear_units();
|
||||
if (parser.seenval('Y')) motion.hotend_offset[target_extruder].y = parser.value_linear_units();
|
||||
#endif
|
||||
#if HAS_Z_AXIS
|
||||
if (parser.seenval('Z')) hotend_offset[target_extruder].z = parser.value_linear_units();
|
||||
if (parser.seenval('Z')) motion.hotend_offset[target_extruder].z = parser.value_linear_units();
|
||||
#endif
|
||||
|
||||
#if ENABLED(DELTA)
|
||||
if (target_extruder == active_extruder)
|
||||
do_blocking_move_to_xy(current_position, planner.settings.max_feedrate_mm_s[X_AXIS]);
|
||||
if (target_extruder == motion.extruder)
|
||||
motion.blocking_move_xy(motion.position, planner.settings.max_feedrate_mm_s[X_AXIS]);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -70,9 +70,9 @@ void GcodeSuite::M218_report(const bool forReplay/*=true*/) {
|
|||
report_echo_start(forReplay);
|
||||
SERIAL_ECHOLNPGM_P(
|
||||
PSTR(" M218 T"), e,
|
||||
SP_X_STR, LINEAR_UNIT(hotend_offset[e].x),
|
||||
SP_Y_STR, LINEAR_UNIT(hotend_offset[e].y),
|
||||
SP_Z_STR, p_float_t(LINEAR_UNIT(hotend_offset[e].z), 3)
|
||||
SP_X_STR, LINEAR_UNIT(motion.hotend_offset[e].x),
|
||||
SP_Y_STR, LINEAR_UNIT(motion.hotend_offset[e].y),
|
||||
SP_Z_STR, p_float_t(LINEAR_UNIT(motion.hotend_offset[e].z), 3)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,14 +36,14 @@
|
|||
*/
|
||||
void GcodeSuite::M220() {
|
||||
if (!parser.seen_any()) {
|
||||
SERIAL_ECHOLNPGM("FR:", feedrate_percentage, "%");
|
||||
SERIAL_ECHOLNPGM("FR:", motion.feedrate_percentage, "%");
|
||||
return;
|
||||
}
|
||||
|
||||
static int16_t backup_feedrate_percentage = 100;
|
||||
const int16_t now_feedrate_perc = feedrate_percentage;
|
||||
if (parser.seen_test('R')) feedrate_percentage = backup_feedrate_percentage;
|
||||
const int16_t now_feedrate_perc = motion.feedrate_percentage;
|
||||
if (parser.seen_test('R')) motion.feedrate_percentage = backup_feedrate_percentage;
|
||||
if (parser.seen_test('B')) backup_feedrate_percentage = now_feedrate_perc;
|
||||
if (parser.seenval('S')) feedrate_percentage = parser.value_int();
|
||||
if (parser.seenval('S')) motion.feedrate_percentage = parser.value_int();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ void GcodeSuite::M92() {
|
|||
planner.settings.axis_steps_per_mm[i] = parser.value_per_axis_units((AxisEnum)i);
|
||||
else {
|
||||
#if HAS_EXTRUDERS
|
||||
const float value = parser.value_per_axis_units((AxisEnum)(E_AXIS_N(target_extruder)));
|
||||
const float value = parser.value_per_axis_units(AxisEnum(E_AXIS_N(target_extruder)));
|
||||
if (value < 20) {
|
||||
float factor = planner.settings.axis_steps_per_mm[E_AXIS_N(target_extruder)] / value; // increase e constants if M92 E14 is given for netfab.
|
||||
#if ALL(CLASSIC_JERK, HAS_CLASSIC_E_JERK)
|
||||
|
|
|
|||
|
|
@ -45,5 +45,5 @@ void GcodeSuite::M112() {
|
|||
* will be out of sync with the stepper position after this.
|
||||
*/
|
||||
void GcodeSuite::M410() {
|
||||
quickstop_stepper();
|
||||
motion.quickstop_stepper();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
void GcodeSuite::M211() {
|
||||
if (parser.seen('S'))
|
||||
soft_endstop._enabled = parser.value_bool();
|
||||
motion.soft_endstop._enabled = parser.value_bool();
|
||||
else
|
||||
M211_report();
|
||||
}
|
||||
|
|
@ -43,11 +43,11 @@ void GcodeSuite::M211_report(const bool forReplay/*=true*/) {
|
|||
TERN_(MARLIN_SMALL_BUILD, return);
|
||||
|
||||
report_heading_etc(forReplay, F(STR_SOFT_ENDSTOPS));
|
||||
SERIAL_ECHOLNPGM(" M211 S", AS_DIGIT(soft_endstop._enabled), " ; ", ON_OFF(soft_endstop._enabled));
|
||||
SERIAL_ECHOLNPGM(" M211 S", AS_DIGIT(motion.soft_endstop._enabled), " ; ", ON_OFF(motion.soft_endstop._enabled));
|
||||
|
||||
report_echo_start(forReplay);
|
||||
const xyz_pos_t l_soft_min = soft_endstop.min.asLogical(),
|
||||
l_soft_max = soft_endstop.max.asLogical();
|
||||
const xyz_pos_t l_soft_min = motion.soft_endstop.min.asLogical(),
|
||||
l_soft_max = motion.soft_endstop.max.asLogical();
|
||||
print_xyz(l_soft_min, F(STR_SOFT_MIN), F(" "));
|
||||
print_xyz(l_soft_max, F(STR_SOFT_MAX));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@
|
|||
*/
|
||||
void GcodeSuite::M380() {
|
||||
#if ENABLED(MANUAL_SOLENOID_CONTROL)
|
||||
enable_solenoid(parser.intval('S', active_extruder));
|
||||
enable_solenoid(parser.intval('S', motion.extruder));
|
||||
#else
|
||||
enable_solenoid(active_extruder);
|
||||
enable_solenoid(motion.extruder);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ void GcodeSuite::M380() {
|
|||
*/
|
||||
void GcodeSuite::M381() {
|
||||
#if ENABLED(MANUAL_SOLENOID_CONTROL)
|
||||
disable_solenoid(parser.intval('S', active_extruder));
|
||||
disable_solenoid(parser.intval('S', motion.extruder));
|
||||
#else
|
||||
disable_all_solenoids();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -64,12 +64,12 @@
|
|||
planner.synchronize();
|
||||
|
||||
if (parser.seenval('S')) {
|
||||
const DualXMode previous_mode = dual_x_carriage_mode;
|
||||
const DualXMode previous_mode = motion.idex_mode;
|
||||
|
||||
dual_x_carriage_mode = (DualXMode)parser.value_byte();
|
||||
idex_set_mirrored_mode(false);
|
||||
motion.idex_mode = (DualXMode)parser.value_byte();
|
||||
motion.idex_set_mirrored_mode(false);
|
||||
|
||||
switch (dual_x_carriage_mode) {
|
||||
switch (motion.idex_mode) {
|
||||
|
||||
case DXC_FULL_CONTROL_MODE:
|
||||
case DXC_AUTO_PARK_MODE:
|
||||
|
|
@ -77,74 +77,74 @@
|
|||
|
||||
case DXC_DUPLICATION_MODE:
|
||||
// Set the X offset, but no less than the safety gap
|
||||
if (parser.seenval('X')) duplicate_extruder_x_offset = _MAX(parser.value_linear_units(), (X2_MIN_POS) - (X1_MIN_POS));
|
||||
if (parser.seenval('R')) duplicate_extruder_temp_offset = parser.value_celsius_diff();
|
||||
if (parser.seenval('X')) motion.duplicate_extruder_x_offset = _MAX(parser.value_linear_units(), (X2_MIN_POS) - (X1_MIN_POS));
|
||||
if (parser.seenval('R')) motion.duplicate_extruder_temp_offset = parser.value_celsius_diff();
|
||||
// Always switch back to tool 0
|
||||
if (active_extruder != 0) tool_change(0);
|
||||
if (motion.extruder != 0) tool_change(0);
|
||||
break;
|
||||
|
||||
case DXC_MIRRORED_MODE: {
|
||||
if (previous_mode != DXC_DUPLICATION_MODE) {
|
||||
SERIAL_ECHOLNPGM("Printer must be in DXC_DUPLICATION_MODE prior to ");
|
||||
SERIAL_ECHOLNPGM("specifying DXC_MIRRORED_MODE.");
|
||||
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
|
||||
motion.idex_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
|
||||
return;
|
||||
}
|
||||
idex_set_mirrored_mode(true);
|
||||
motion.idex_set_mirrored_mode(true);
|
||||
|
||||
// Do a small 'jog' motion in the X axis
|
||||
xyze_pos_t dest = current_position; dest.x -= 0.1f;
|
||||
xyze_pos_t dest = motion.position; dest.x -= 0.1f;
|
||||
for (uint8_t i = 2; --i;) {
|
||||
planner.buffer_line(dest, feedrate_mm_s, 0);
|
||||
planner.buffer_line(dest, motion.feedrate_mm_s, 0);
|
||||
dest.x += 0.1f;
|
||||
}
|
||||
} return;
|
||||
|
||||
default:
|
||||
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
|
||||
motion.idex_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
|
||||
break;
|
||||
}
|
||||
|
||||
idex_set_parked(false);
|
||||
set_duplication_enabled(false);
|
||||
motion.idex_set_parked(false);
|
||||
motion.set_extruder_duplication(false);
|
||||
|
||||
#ifdef EVENT_GCODE_IDEX_AFTER_MODECHANGE
|
||||
process_subcommands_now(F(EVENT_GCODE_IDEX_AFTER_MODECHANGE));
|
||||
#endif
|
||||
}
|
||||
else if (!parser.seen('W')) // if no S or W parameter, the DXC mode gets reset to the user's default
|
||||
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
|
||||
motion.idex_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
|
||||
|
||||
#if ENABLED(DEBUG_DXC_MODE)
|
||||
|
||||
if (parser.seen('W')) {
|
||||
DEBUG_ECHO_START();
|
||||
DEBUG_ECHOPGM("Dual X Carriage Mode ");
|
||||
switch (dual_x_carriage_mode) {
|
||||
switch (motion.idex_mode) {
|
||||
case DXC_FULL_CONTROL_MODE: DEBUG_ECHOPGM("FULL_CONTROL"); break;
|
||||
case DXC_AUTO_PARK_MODE: DEBUG_ECHOPGM("AUTO_PARK"); break;
|
||||
case DXC_DUPLICATION_MODE: DEBUG_ECHOPGM("DUPLICATION"); break;
|
||||
case DXC_MIRRORED_MODE: DEBUG_ECHOPGM("MIRRORED"); break;
|
||||
}
|
||||
DEBUG_ECHOPGM("\nActive Ext: ", active_extruder);
|
||||
if (!active_extruder_parked) DEBUG_ECHOPGM(" NOT ", F(" parked."));
|
||||
DEBUG_ECHOPGM("\nActive Ext: ", motion.extruder);
|
||||
if (!motion.active_extruder_parked) DEBUG_ECHOPGM(" NOT ", F(" parked."));
|
||||
DEBUG_ECHOLNPGM(
|
||||
"\nactive_extruder_x_pos: ", current_position.x,
|
||||
"\ninactive_extruder_x: ", inactive_extruder_x,
|
||||
"\nextruder_duplication_enabled: ", extruder_duplication_enabled,
|
||||
"\nduplicate_extruder_x_offset: ", duplicate_extruder_x_offset,
|
||||
"\nduplicate_extruder_temp_offset: ", duplicate_extruder_temp_offset,
|
||||
"\ndelayed_move_time: ", delayed_move_time,
|
||||
"\nX1 Home: ", x_home_pos(0), " X1_MIN_POS=", X1_MIN_POS, " X1_MAX_POS=", X1_MAX_POS,
|
||||
"\nX2 Home: ", x_home_pos(1), " X2_MIN_POS=", X2_MIN_POS, " X2_MAX_POS=", X2_MAX_POS,
|
||||
"\nmotion.position.x: ", motion.position.x,
|
||||
"\nmotion.inactive_extruder_x: ", motion.inactive_extruder_x,
|
||||
"\nmotion.extruder_duplication: ", motion.extruder_duplication,
|
||||
"\nmotion.duplicate_extruder_x_offset: ", motion.duplicate_extruder_x_offset,
|
||||
"\nmotion.duplicate_extruder_temp_offset: ", motion.duplicate_extruder_temp_offset,
|
||||
"\nmotion.delayed_move_time: ", motion.delayed_move_time,
|
||||
"\nX1 Home: ", motion.x_home_pos(0), " X1_MIN_POS=", X1_MIN_POS, " X1_MAX_POS=", X1_MAX_POS,
|
||||
"\nX2 Home: ", motion.x_home_pos(1), " X2_MIN_POS=", X2_MIN_POS, " X2_MAX_POS=", X2_MAX_POS,
|
||||
"\nDEFAULT_DUAL_X_CARRIAGE_MODE=", STRINGIFY(DEFAULT_DUAL_X_CARRIAGE_MODE),
|
||||
"\toolchange_settings.z_raise=", toolchange_settings.z_raise,
|
||||
"\ntoolchange_settings.z_raise=", toolchange_settings.z_raise,
|
||||
"\nDEFAULT_DUPLICATION_X_OFFSET=", DEFAULT_DUPLICATION_X_OFFSET
|
||||
);
|
||||
|
||||
HOTEND_LOOP() {
|
||||
DEBUG_ECHOPGM_P(SP_T_STR, e);
|
||||
LOOP_NUM_AXES(a) DEBUG_ECHOPGM(" hotend_offset[", e, "].", C(AXIS_CHAR(a) | 0x20), "=", hotend_offset[e][a]);
|
||||
LOOP_NUM_AXES(a) DEBUG_ECHOPGM(" hotend_offset[", e, "].", C(AXIS_CHAR(a) | 0x20), "=", motion.hotend_offset[e][a]);
|
||||
DEBUG_EOL();
|
||||
}
|
||||
DEBUG_EOL();
|
||||
|
|
@ -170,16 +170,16 @@
|
|||
bool ena = false;
|
||||
if (parser.seen("EPS")) {
|
||||
planner.synchronize();
|
||||
if (parser.seenval('P')) duplication_e_mask = parser.value_int(); // Set the mask directly
|
||||
else if (parser.seenval('E')) duplication_e_mask = _BV(parser.value_int() + 1) - 1; // Set the mask by E index
|
||||
ena = (2 == parser.intval('S', extruder_duplication_enabled ? 2 : 0));
|
||||
set_duplication_enabled(ena && (duplication_e_mask >= 3));
|
||||
if (parser.seenval('P')) motion.duplication_e_mask = parser.value_int(); // Set the mask directly
|
||||
else if (parser.seenval('E')) motion.duplication_e_mask = _BV(parser.value_int() + 1) - 1; // Set the mask by E index
|
||||
ena = (2 == parser.intval('S', motion.extruder_duplication ? 2 : 0));
|
||||
motion.set_extruder_duplication(ena && (motion.duplication_e_mask >= 3));
|
||||
}
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM(STR_DUPLICATION_MODE, ON_OFF(extruder_duplication_enabled));
|
||||
SERIAL_ECHOPGM(STR_DUPLICATION_MODE, ON_OFF(motion.extruder_duplication));
|
||||
if (ena) {
|
||||
SERIAL_ECHOPGM(" ( ");
|
||||
HOTEND_LOOP() if (TEST(duplication_e_mask, e)) { SERIAL_ECHO(e); SERIAL_CHAR(' '); }
|
||||
HOTEND_LOOP() if (TEST(motion.duplication_e_mask, e)) { SERIAL_ECHO(e); SERIAL_CHAR(' '); }
|
||||
SERIAL_CHAR(')');
|
||||
}
|
||||
SERIAL_EOL();
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ void GcodeSuite::T(const int8_t tool_index) {
|
|||
#if HAS_MULTI_EXTRUDER
|
||||
// For 'T' with no parameter report the current tool.
|
||||
if (parser.string_arg && *parser.string_arg == '*') {
|
||||
SERIAL_ECHOLNPGM(STR_ACTIVE_EXTRUDER, active_extruder);
|
||||
SERIAL_ECHOLNPGM(STR_ACTIVE_EXTRUDER, motion.extruder);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -84,7 +84,7 @@ void GcodeSuite::T(const int8_t tool_index) {
|
|||
tool_change(tool_index
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
, parser.boolval('S')
|
||||
|| TERN(PARKING_EXTRUDER, false, tool_index == active_extruder) // For PARKING_EXTRUDER motion is decided in tool_change()
|
||||
|| TERN(PARKING_EXTRUDER, false, tool_index == motion.extruder) // For PARKING_EXTRUDER motion is decided in tool_change()
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ void GcodeSuite::M900() {
|
|||
constexpr uint8_t tool_index = 0;
|
||||
UNUSED(tool_index);
|
||||
#else
|
||||
const uint8_t tool_index = parser.intval('T', active_extruder);
|
||||
const uint8_t tool_index = parser.intval('T', motion.extruder);
|
||||
if (tool_index >= EXTRUDERS) {
|
||||
echo_value_oor('T', false);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#if ENABLED(PHOTO_GCODE)
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../module/motion.h" // for active_extruder and current_position
|
||||
#include "../../../module/motion.h" // for motion.extruder and motion.position
|
||||
|
||||
#if PIN_EXISTS(CHDK)
|
||||
millis_t chdk_timeout; // = 0
|
||||
|
|
@ -44,8 +44,8 @@
|
|||
|
||||
#ifdef PHOTO_RETRACT_MM
|
||||
inline void e_move_m240(const float length, const feedRate_t fr_mm_s) {
|
||||
if (length && thermalManager.hotEnoughToExtrude(active_extruder))
|
||||
unscaled_e_move(length, fr_mm_s);
|
||||
if (length && thermalManager.hotEnoughToExtrude(motion.extruder))
|
||||
motion.unscaled_e_move(length, fr_mm_s);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -122,14 +122,14 @@ void GcodeSuite::M240() {
|
|||
|
||||
#ifdef PHOTO_POSITION
|
||||
|
||||
if (homing_needed_error()) return;
|
||||
if (motion.homing_needed_error()) return;
|
||||
|
||||
const xyz_pos_t old_pos = NUM_AXIS_ARRAY(
|
||||
current_position.x + parser.linearval('A'),
|
||||
current_position.y + parser.linearval('B'),
|
||||
current_position.z,
|
||||
current_position.i, current_position.j, current_position.k,
|
||||
current_position.u, current_position.v, current_position.w
|
||||
motion.position.x + parser.linearval('A'),
|
||||
motion.position.y + parser.linearval('B'),
|
||||
motion.position.z,
|
||||
motion.position.i, motion.position.j, motion.position.k,
|
||||
motion.position.u, motion.position.v, motion.position.w
|
||||
);
|
||||
|
||||
#ifdef PHOTO_RETRACT_MM
|
||||
|
|
@ -143,24 +143,24 @@ void GcodeSuite::M240() {
|
|||
|
||||
constexpr xyz_pos_t photo_position = PHOTO_POSITION;
|
||||
xyz_pos_t raw = {
|
||||
parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : photo_position.x,
|
||||
parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : photo_position.y,
|
||||
(parser.seenval('Z') ? parser.value_linear_units() : photo_position.z) + current_position.z
|
||||
parser.seenval('X') ? motion.raw_x(parser.value_linear_units()) : photo_position.x,
|
||||
parser.seenval('Y') ? motion.raw_y(parser.value_linear_units()) : photo_position.y,
|
||||
(parser.seenval('Z') ? parser.value_linear_units() : photo_position.z) + motion.position.z
|
||||
};
|
||||
apply_motion_limits(raw);
|
||||
do_blocking_move_to(raw, fr_mm_s);
|
||||
motion.apply_limits(raw);
|
||||
motion.blocking_move(raw, fr_mm_s);
|
||||
|
||||
#ifdef PHOTO_SWITCH_POSITION
|
||||
constexpr xy_pos_t photo_switch_position = PHOTO_SWITCH_POSITION;
|
||||
const xy_pos_t sraw = {
|
||||
parser.seenval('I') ? RAW_X_POSITION(parser.value_linear_units()) : photo_switch_position.x,
|
||||
parser.seenval('J') ? RAW_Y_POSITION(parser.value_linear_units()) : photo_switch_position.y
|
||||
parser.seenval('I') ? motion.raw_x(parser.value_linear_units()) : photo_switch_position.x,
|
||||
parser.seenval('J') ? motion.raw_y(parser.value_linear_units()) : photo_switch_position.y
|
||||
};
|
||||
do_blocking_move_to_xy(sraw, get_homing_bump_feedrate(X_AXIS));
|
||||
motion.blocking_move_xy(sraw, motion.get_homing_bump_feedrate(X_AXIS));
|
||||
#if PHOTO_SWITCH_MS > 0
|
||||
safe_delay(parser.intval('D', PHOTO_SWITCH_MS));
|
||||
#endif
|
||||
do_blocking_move_to(raw);
|
||||
motion.blocking_move(raw);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -183,7 +183,7 @@ void GcodeSuite::M240() {
|
|||
const millis_t timeout = millis() + parser.intval('P', PHOTO_DELAY_MS);
|
||||
while (PENDING(millis(), timeout)) marlin.idle();
|
||||
#endif
|
||||
do_blocking_move_to(old_pos, fr_mm_s);
|
||||
motion.blocking_move(old_pos, fr_mm_s);
|
||||
#ifdef PHOTO_RETRACT_MM
|
||||
e_move_m240(rval, sval);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ void GcodeSuite::G12() {
|
|||
|
||||
// Don't allow nozzle cleaning without homing first
|
||||
constexpr main_axes_bits_t clean_axis_mask = main_axes_mask & ~TERN0(NOZZLE_CLEAN_NO_Z, Z_AXIS) & ~TERN0(NOZZLE_CLEAN_NO_Y, Y_AXIS);
|
||||
if (homing_needed_error(clean_axis_mask)) return;
|
||||
if (motion.homing_needed_error(clean_axis_mask)) return;
|
||||
|
||||
#ifdef WIPE_SEQUENCE_COMMANDS
|
||||
if (!parser.seen_any()) {
|
||||
|
|
@ -79,11 +79,11 @@ void GcodeSuite::G12() {
|
|||
TEMPORARY_BED_LEVELING_STATE(!TEST(cleans, Z_AXIS) && planner.leveling_active);
|
||||
#endif
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(!parser.boolval('E'));
|
||||
motion.set_soft_endstop_loose(!parser.boolval('E'));
|
||||
|
||||
nozzle.clean(pattern, strokes, radius, objects, cleans);
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
motion.set_soft_endstop_loose(false);
|
||||
}
|
||||
|
||||
#endif // NOZZLE_CLEAN_FEATURE
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ void GcodeSuite::M166() {
|
|||
|
||||
SERIAL_ECHOPGM(" ; Current Z");
|
||||
#if ENABLED(DELTA)
|
||||
get_cartesian_from_steppers();
|
||||
SERIAL_ECHO(cartes.z);
|
||||
motion.get_cartesian_from_steppers();
|
||||
SERIAL_ECHO(motion.cartes.z);
|
||||
#else
|
||||
SERIAL_ECHO(planner.get_axis_position_mm(Z_AXIS));
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
*/
|
||||
void GcodeSuite::G27() {
|
||||
// Don't allow nozzle parking without homing first
|
||||
if (homing_needed_error()) return;
|
||||
if (motion.homing_needed_error()) return;
|
||||
const int16_t pval = parser.intval('P');
|
||||
if (WITHIN(pval, 0, 4)) {
|
||||
nozzle.park(pval);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ void GcodeSuite::G60() {
|
|||
}
|
||||
|
||||
// G60 S
|
||||
stored_position[slot] = current_position;
|
||||
stored_position[slot] = motion.position;
|
||||
did_save_position.set(slot);
|
||||
report_stored_position(slot);
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ void GcodeSuite::G61(int8_t slot/*=-1*/) {
|
|||
|
||||
if (slot < 0) slot = parser.byteval('S');
|
||||
|
||||
#define SYNC_E(E) planner.set_e_position_mm(current_position.e = (E))
|
||||
#define SYNC_E(E) planner.set_e_position_mm(motion.position.e = (E))
|
||||
|
||||
if (SAVED_POSITIONS < 256 && slot >= SAVED_POSITIONS) {
|
||||
SERIAL_ERROR_MSG(STR_INVALID_POS_SLOT STRINGIFY(SAVED_POSITIONS));
|
||||
|
|
@ -141,9 +141,9 @@ void GcodeSuite::G61(int8_t slot/*=-1*/) {
|
|||
if (!did_save_position[slot]) return;
|
||||
|
||||
// Apply any given feedrate over 0.0
|
||||
REMEMBER(saved, feedrate_mm_s);
|
||||
REMEMBER(saved, motion.feedrate_mm_s);
|
||||
const float fr = parser.linearval('F');
|
||||
if (fr > 0.0) feedrate_mm_s = MMM_TO_MMS(fr);
|
||||
if (fr > 0.0) motion.feedrate_mm_s = MMM_TO_MMS(fr);
|
||||
|
||||
// No XYZ...E parameters, move to stored position
|
||||
|
||||
|
|
@ -153,10 +153,10 @@ void GcodeSuite::G61(int8_t slot/*=-1*/) {
|
|||
if (!parser.seen_axis()) {
|
||||
DEBUG_ECHOLNPGM(STR_RESTORING_POSITION, slot, " (all axes)");
|
||||
// Move to the saved position, all axes except E
|
||||
do_blocking_move_to(stored_position[slot], feedrate_mm_s);
|
||||
motion.blocking_move(stored_position[slot], motion.feedrate_mm_s);
|
||||
// Just set E to the saved position without moving it
|
||||
TERN_(HAS_EXTRUDERS, SYNC_E(stored_position[slot].e));
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -165,14 +165,14 @@ void GcodeSuite::G61(int8_t slot/*=-1*/) {
|
|||
DEBUG_ECHOPGM(STR_RESTORING_POSITION " S", slot);
|
||||
|
||||
if (parser.seen(STR_AXES_MAIN)) {
|
||||
destination = current_position;
|
||||
motion.destination = motion.position;
|
||||
LOOP_NUM_AXES(i) {
|
||||
if (parser.seen(AXIS_CHAR(i))) {
|
||||
destination[i] = stored_position[slot][i] + parser.value_axis_units((AxisEnum)i);
|
||||
DEBUG_ECHO(C(' '), C(AXIS_CHAR(i)), p_float_t(destination[i], 2));
|
||||
motion.destination[i] = stored_position[slot][i] + parser.value_axis_units((AxisEnum)i);
|
||||
DEBUG_ECHO(C(' '), C(AXIS_CHAR(i)), p_float_t(motion.destination[i], 2));
|
||||
}
|
||||
}
|
||||
prepare_line_to_destination();
|
||||
motion.prepare_line_to_destination();
|
||||
}
|
||||
|
||||
#if HAS_EXTRUDERS
|
||||
|
|
@ -185,7 +185,7 @@ void GcodeSuite::G61(int8_t slot/*=-1*/) {
|
|||
|
||||
DEBUG_EOL();
|
||||
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
}
|
||||
|
||||
#endif // SAVED_POSITIONS
|
||||
|
|
|
|||
|
|
@ -68,15 +68,15 @@ void GcodeSuite::M125() {
|
|||
|
||||
// Move to filament change position or given position
|
||||
NUM_AXIS_CODE(
|
||||
if (parser.seenval('X')) park_point.x = RAW_X_POSITION(parser.linearval('X')),
|
||||
if (parser.seenval('Y')) park_point.y = RAW_Y_POSITION(parser.linearval('Y')),
|
||||
if (parser.seenval('X')) park_point.x = motion.raw_x(parser.linearval('X')),
|
||||
if (parser.seenval('Y')) park_point.y = motion.raw_y(parser.linearval('Y')),
|
||||
NOOP,
|
||||
if (parser.seenval(AXIS4_NAME)) park_point.i = RAW_I_POSITION(parser.linearval(AXIS4_NAME)),
|
||||
if (parser.seenval(AXIS5_NAME)) park_point.j = RAW_J_POSITION(parser.linearval(AXIS5_NAME)),
|
||||
if (parser.seenval(AXIS6_NAME)) park_point.k = RAW_K_POSITION(parser.linearval(AXIS6_NAME)),
|
||||
if (parser.seenval(AXIS7_NAME)) park_point.u = RAW_U_POSITION(parser.linearval(AXIS7_NAME)),
|
||||
if (parser.seenval(AXIS8_NAME)) park_point.v = RAW_V_POSITION(parser.linearval(AXIS8_NAME)),
|
||||
if (parser.seenval(AXIS9_NAME)) park_point.w = RAW_W_POSITION(parser.linearval(AXIS9_NAME))
|
||||
if (parser.seenval(AXIS4_NAME)) park_point.i = motion.raw_i(parser.linearval(AXIS4_NAME)),
|
||||
if (parser.seenval(AXIS5_NAME)) park_point.j = motion.raw_j(parser.linearval(AXIS5_NAME)),
|
||||
if (parser.seenval(AXIS6_NAME)) park_point.k = motion.raw_k(parser.linearval(AXIS6_NAME)),
|
||||
if (parser.seenval(AXIS7_NAME)) park_point.u = motion.raw_u(parser.linearval(AXIS7_NAME)),
|
||||
if (parser.seenval(AXIS8_NAME)) park_point.v = motion.raw_v(parser.linearval(AXIS8_NAME)),
|
||||
if (parser.seenval(AXIS9_NAME)) park_point.w = motion.raw_w(parser.linearval(AXIS9_NAME))
|
||||
);
|
||||
|
||||
// Lift Z axis
|
||||
|
|
@ -85,7 +85,7 @@ void GcodeSuite::M125() {
|
|||
#endif
|
||||
|
||||
#if HAS_HOTEND_OFFSET && NONE(DUAL_X_CARRIAGE, DELTA)
|
||||
park_point += hotend_offset[active_extruder];
|
||||
park_point += motion.active_hotend_offset();
|
||||
#endif
|
||||
|
||||
const bool sd_printing = card.isStillPrinting();
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ void GcodeSuite::M600() {
|
|||
MIXER_STEPPER_LOOP(i) mixer.set_collector(i, i == uint8_t(eindex) ? 1.0 : 0.0);
|
||||
mixer.normalize();
|
||||
|
||||
const int8_t target_extruder = active_extruder;
|
||||
const int8_t target_extruder = motion.extruder;
|
||||
#else
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
|
|
@ -105,10 +105,10 @@ void GcodeSuite::M600() {
|
|||
if (!parser.seen_test('T')) { // If no tool index is specified, M600 was (probably) sent in response to filament runout.
|
||||
// In this case, for duplicating modes set DXC_ext to the extruder that ran out.
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
if (idex_is_duplicating())
|
||||
if (motion.idex_is_duplicating())
|
||||
DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT2_STATE) ? 1 : 0;
|
||||
#else
|
||||
DXC_ext = active_extruder;
|
||||
DXC_ext = motion.extruder;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
@ -122,12 +122,12 @@ void GcodeSuite::M600() {
|
|||
TERN_(SOVOL_SV06_RTS, rts.gotoPage(ID_ChangeWait_L, ID_ChangeWait_D)); //given the context it seems this likely should have been pages 6 & 61
|
||||
|
||||
// If needed, home before parking for filament change
|
||||
TERN_(HOME_BEFORE_FILAMENT_CHANGE, home_if_needed(true));
|
||||
TERN_(HOME_BEFORE_FILAMENT_CHANGE, motion.home_if_needed(true));
|
||||
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
// Change toolhead if specified
|
||||
const uint8_t active_extruder_before_filament_change = active_extruder;
|
||||
if (active_extruder != target_extruder && TERN1(DUAL_X_CARRIAGE, !idex_is_duplicating()))
|
||||
const uint8_t active_extruder_before_filament_change = motion.extruder;
|
||||
if (motion.extruder != target_extruder && TERN1(DUAL_X_CARRIAGE, !motion.idex_is_duplicating()))
|
||||
tool_change(target_extruder);
|
||||
#endif
|
||||
|
||||
|
|
@ -150,12 +150,12 @@ void GcodeSuite::M600() {
|
|||
);
|
||||
|
||||
#if HAS_HOTEND_OFFSET && NONE(DUAL_X_CARRIAGE, DELTA)
|
||||
park_point += hotend_offset[active_extruder];
|
||||
park_point += motion.active_hotend_offset();
|
||||
#endif
|
||||
|
||||
// Unload filament
|
||||
// For MMU2, when enabled, reset retract value so it doesn't mess with MMU filament handling
|
||||
const float unload_length = standardM600 ? -ABS(parser.axisunitsval('U', E_AXIS, fc_settings[active_extruder].unload_length)) : 0.5f;
|
||||
const float unload_length = standardM600 ? -ABS(parser.axisunitsval('U', E_AXIS, fc_settings[motion.extruder].unload_length)) : 0.5f;
|
||||
|
||||
const int beep_count = parser.intval('B', -1
|
||||
#ifdef FILAMENT_CHANGE_ALERT_BEEPS
|
||||
|
|
@ -168,7 +168,7 @@ void GcodeSuite::M600() {
|
|||
wait_for_confirmation(true, beep_count DXC_PASS);
|
||||
resume_print(
|
||||
FILAMENT_CHANGE_SLOW_LOAD_LENGTH,
|
||||
ABS(parser.axisunitsval('L', E_AXIS, fc_settings[active_extruder].load_length)),
|
||||
ABS(parser.axisunitsval('L', E_AXIS, fc_settings[motion.extruder].load_length)),
|
||||
ADVANCED_PAUSE_PURGE_LENGTH,
|
||||
beep_count,
|
||||
parser.celsiusval('R'),
|
||||
|
|
@ -188,7 +188,7 @@ void GcodeSuite::M600() {
|
|||
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
// Restore toolhead if it was changed
|
||||
if (active_extruder_before_filament_change != active_extruder)
|
||||
if (active_extruder_before_filament_change != motion.extruder)
|
||||
tool_change(active_extruder_before_filament_change);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void GcodeSuite::M701() {
|
|||
xyz_pos_t park_point = NOZZLE_PARK_POINT;
|
||||
|
||||
// Don't raise Z if the machine isn't homed
|
||||
if (TERN0(NO_MOTION_BEFORE_HOMING, axes_should_home())) park_point.z = 0;
|
||||
if (TERN0(NO_MOTION_BEFORE_HOMING, motion.axes_should_home())) park_point.z = 0;
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
const int8_t eindex = get_target_e_stepper_from_command();
|
||||
|
|
@ -71,7 +71,7 @@ void GcodeSuite::M701() {
|
|||
MIXER_STEPPER_LOOP(i) mixer.set_collector(i, i == uint8_t(eindex) ? 1.0 : 0.0);
|
||||
mixer.normalize();
|
||||
|
||||
const int8_t target_extruder = active_extruder;
|
||||
const int8_t target_extruder = motion.extruder;
|
||||
#else
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
|
|
@ -85,21 +85,21 @@ void GcodeSuite::M701() {
|
|||
|
||||
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
|
||||
// Change toolhead if specified
|
||||
uint8_t active_extruder_before_filament_change = active_extruder;
|
||||
if (active_extruder != target_extruder)
|
||||
uint8_t active_extruder_before_filament_change = motion.extruder;
|
||||
if (motion.extruder != target_extruder)
|
||||
tool_change(target_extruder);
|
||||
#endif
|
||||
|
||||
auto move_z_by = [](const float zdist) {
|
||||
if (zdist) {
|
||||
destination = current_position;
|
||||
destination.z += zdist;
|
||||
prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
|
||||
motion.destination = motion.position;
|
||||
motion.destination.z += zdist;
|
||||
motion.prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
|
||||
}
|
||||
};
|
||||
|
||||
// Raise the Z axis (with max limit)
|
||||
const float park_raise = _MIN(park_point.z, (Z_MAX_POS) - current_position.z);
|
||||
const float park_raise = _MIN(park_point.z, (Z_MAX_POS) - motion.position.z);
|
||||
move_z_by(park_raise);
|
||||
|
||||
// Load filament
|
||||
|
|
@ -111,7 +111,7 @@ void GcodeSuite::M701() {
|
|||
constexpr float purge_length = ADVANCED_PAUSE_PURGE_LENGTH,
|
||||
slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH;
|
||||
const float fast_load_length = ABS(parser.seenval('L') ? parser.value_axis_units(E_AXIS)
|
||||
: fc_settings[active_extruder].load_length);
|
||||
: fc_settings[motion.extruder].load_length);
|
||||
load_filament(
|
||||
slow_load_length, fast_load_length, purge_length,
|
||||
FILAMENT_CHANGE_ALERT_BEEPS,
|
||||
|
|
@ -127,7 +127,7 @@ void GcodeSuite::M701() {
|
|||
|
||||
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
|
||||
// Restore toolhead if it was changed
|
||||
if (active_extruder_before_filament_change != active_extruder)
|
||||
if (active_extruder_before_filament_change != motion.extruder)
|
||||
tool_change(active_extruder_before_filament_change);
|
||||
#endif
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ void GcodeSuite::M702() {
|
|||
xyz_pos_t park_point = NOZZLE_PARK_POINT;
|
||||
|
||||
// Don't raise Z if the machine isn't homed
|
||||
if (TERN0(NO_MOTION_BEFORE_HOMING, axes_should_home())) park_point.z = 0;
|
||||
if (TERN0(NO_MOTION_BEFORE_HOMING, motion.axes_should_home())) park_point.z = 0;
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
const uint8_t old_mixing_tool = mixer.get_current_vtool();
|
||||
|
|
@ -176,7 +176,7 @@ void GcodeSuite::M702() {
|
|||
mixer.normalize();
|
||||
}
|
||||
|
||||
const int8_t target_extruder = active_extruder;
|
||||
const int8_t target_extruder = motion.extruder;
|
||||
#else
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
|
|
@ -190,14 +190,14 @@ void GcodeSuite::M702() {
|
|||
|
||||
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
|
||||
// Change toolhead if specified
|
||||
uint8_t active_extruder_before_filament_change = active_extruder;
|
||||
if (active_extruder != target_extruder)
|
||||
uint8_t active_extruder_before_filament_change = motion.extruder;
|
||||
if (motion.extruder != target_extruder)
|
||||
tool_change(target_extruder);
|
||||
#endif
|
||||
|
||||
// Lift Z axis
|
||||
if (park_point.z > 0)
|
||||
do_blocking_move_to_z(_MIN(current_position.z + park_point.z, Z_MAX_POS), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
|
||||
motion.blocking_move_z(_MIN(motion.position.z + park_point.z, Z_MAX_POS), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
|
||||
|
||||
// Unload filament
|
||||
#if HAS_PRUSA_MMU3
|
||||
|
|
@ -208,7 +208,7 @@ void GcodeSuite::M702() {
|
|||
#if ALL(HAS_MULTI_EXTRUDER, FILAMENT_UNLOAD_ALL_EXTRUDERS)
|
||||
if (!parser.seenval('T')) {
|
||||
HOTEND_LOOP() {
|
||||
if (e != active_extruder) tool_change(e);
|
||||
if (e != motion.extruder) tool_change(e);
|
||||
unload_filament(-fc_settings[e].unload_length, true, PAUSE_MODE_UNLOAD_FILAMENT);
|
||||
}
|
||||
}
|
||||
|
|
@ -229,11 +229,11 @@ void GcodeSuite::M702() {
|
|||
|
||||
// Restore Z axis
|
||||
if (park_point.z > 0)
|
||||
do_blocking_move_to_z(_MAX(current_position.z - park_point.z, 0), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
|
||||
motion.blocking_move_z(_MAX(motion.position.z - park_point.z, 0), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
|
||||
|
||||
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
|
||||
// Restore toolhead if it was changed
|
||||
if (active_extruder_before_filament_change != active_extruder)
|
||||
if (active_extruder_before_filament_change != motion.extruder)
|
||||
tool_change(active_extruder_before_filament_change);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ void GcodeSuite::say_units() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the target extruder from the T parameter or the active_extruder
|
||||
* Get the target extruder from the T parameter or the motion.extruder
|
||||
* Return -1 if the T parameter is out of range
|
||||
*/
|
||||
int8_t GcodeSuite::get_target_extruder_from_command() {
|
||||
|
|
@ -137,7 +137,7 @@ int8_t GcodeSuite::get_target_extruder_from_command() {
|
|||
SERIAL_ECHOLN(C('M'), parser.codenum, F(" " STR_INVALID_EXTRUDER " "), e);
|
||||
return -1;
|
||||
}
|
||||
return active_extruder;
|
||||
return motion.extruder;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -181,22 +181,22 @@ void GcodeSuite::get_destination_from_command() {
|
|||
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];
|
||||
motion.destination[i] = motion.position[i];
|
||||
else
|
||||
destination[i] = axis_is_relative((AxisEnum)i) ? current_position[i] + v : LOGICAL_TO_NATIVE(v, i);
|
||||
motion.destination[i] = axis_is_relative((AxisEnum)i) ? motion.position[i] + v : motion.logical_to_native(v, (AxisEnum)i);
|
||||
}
|
||||
else
|
||||
destination[i] = current_position[i];
|
||||
motion.destination[i] = motion.position[i];
|
||||
}
|
||||
|
||||
#if HAS_EXTRUDERS
|
||||
// Get new E position, whether absolute or relative
|
||||
if ( (seen.e = parser.seenval('E')) ) {
|
||||
const float v = parser.value_axis_units(E_AXIS);
|
||||
destination.e = axis_is_relative(E_AXIS) ? current_position.e + v : v;
|
||||
motion.destination.e = axis_is_relative(E_AXIS) ? motion.position.e + v : v;
|
||||
}
|
||||
else
|
||||
destination.e = current_position.e;
|
||||
motion.destination.e = motion.position.e;
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY) && !PIN_EXISTS(POWER_LOSS)
|
||||
|
|
@ -207,14 +207,14 @@ void GcodeSuite::get_destination_from_command() {
|
|||
|
||||
if (parser.floatval('F') > 0) {
|
||||
const float fr_mm_min = parser.value_linear_units();
|
||||
feedrate_mm_s = MMM_TO_MMS(fr_mm_min);
|
||||
motion.feedrate_mm_s = MMM_TO_MMS(fr_mm_min);
|
||||
// Update the cutter feed rate for use by M4 I set inline moves.
|
||||
TERN_(LASER_FEATURE, cutter.feedrate_mm_m = fr_mm_min);
|
||||
}
|
||||
|
||||
#if ALL(PRINTCOUNTER, HAS_EXTRUDERS)
|
||||
if (!DEBUGGING(DRYRUN) && !skip_move)
|
||||
print_job_timer.incFilamentUsed(destination.e - current_position.e);
|
||||
print_job_timer.incFilamentUsed(motion.destination.e - motion.position.e);
|
||||
#endif
|
||||
|
||||
// Get ABCDHI mixing factors
|
||||
|
|
@ -904,7 +904,7 @@ void GcodeSuite::process_parsed_command(bool no_ok/*=false*/) {
|
|||
#endif
|
||||
|
||||
#if HAS_HOME_OFFSET
|
||||
case 428: M428(); break; // M428: Apply current_position to home_offset
|
||||
case 428: M428(); break; // M428: Apply position to home_offset
|
||||
#endif
|
||||
|
||||
#if HAS_POWER_MONITOR
|
||||
|
|
@ -1273,15 +1273,15 @@ void GcodeSuite::process_subcommands_now(char * gcode) {
|
|||
case IN_HANDLER:
|
||||
case IN_PROCESS:
|
||||
SERIAL_ECHO_MSG(STR_BUSY_PROCESSING);
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_position_moving());
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.report_position_moving());
|
||||
break;
|
||||
case PAUSED_FOR_USER:
|
||||
SERIAL_ECHO_MSG(STR_BUSY_PAUSED_FOR_USER);
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_HOLD));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_HOLD));
|
||||
break;
|
||||
case PAUSED_FOR_INPUT:
|
||||
SERIAL_ECHO_MSG(STR_BUSY_PAUSED_FOR_INPUT);
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_HOLD));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_HOLD));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@
|
|||
* M421 - Set a single Z coordinate in the Mesh Leveling grid. X<units> Y<units> Z<units> (Requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL)
|
||||
* M422 - Set Z Stepper automatic alignment position using probe. X<units> Y<units> A<axis> (Requires Z_STEPPER_AUTO_ALIGN)
|
||||
* M425 - Enable/Disable and tune backlash correction. (Requires BACKLASH_COMPENSATION and BACKLASH_GCODE)
|
||||
* M428 - Set the home_offset based on the current_position. Nearest edge applies. (Disabled by NO_WORKSPACE_OFFSETS or DELTA)
|
||||
* M428 - Set the home_offset based on the position. Nearest edge applies. (Disabled by NO_WORKSPACE_OFFSETS or DELTA)
|
||||
* M430 - Read the system current, voltage, and power (Requires POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE, or POWER_MONITOR_FIXED_VOLTAGE)
|
||||
* M485 - Send RS485 packets (Requires RS485_SERIAL_PORT)
|
||||
* M486 - Identify and cancel objects. (Requires CANCEL_OBJECTS)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,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];
|
||||
workspace_offset = new_offset;
|
||||
motion.workspace_offset = new_offset;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ void GcodeSuite::G53() {
|
|||
select_coordinate_system(-1); // Always remove workspace offsets
|
||||
#ifdef DEBUG_M53
|
||||
SERIAL_ECHOLNPGM("Go to native space");
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
#endif
|
||||
|
||||
if (parser.chain()) { // Command to chain?
|
||||
|
|
@ -63,7 +63,7 @@ void GcodeSuite::G53() {
|
|||
select_coordinate_system(old_system);
|
||||
#ifdef DEBUG_M53
|
||||
SERIAL_ECHOLNPGM("Go back to workspace ", old_system);
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ void G54_59(uint8_t subcode=0) {
|
|||
const int8_t _space = parser.codenum - 54 + subcode;
|
||||
if (gcode.select_coordinate_system(_space)) {
|
||||
SERIAL_ECHOLNPGM("Select workspace ", _space);
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
}
|
||||
}
|
||||
void GcodeSuite::G54() { G54_59(); }
|
||||
|
|
|
|||
|
|
@ -59,16 +59,16 @@ void GcodeSuite::G92() {
|
|||
#endif
|
||||
|
||||
switch (subcode_G92) {
|
||||
default: return; // Ignore unknown G92.x
|
||||
default: return; // Ignore unknown G92.x
|
||||
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS) && !IS_SCARA
|
||||
case 1: // G92.1 - Zero the Workspace Offset
|
||||
workspace_offset.reset();
|
||||
case 1: // G92.1 - Zero the Workspace Offset
|
||||
motion.workspace_offset.reset();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if ANY(POWER_LOSS_RECOVERY, HAS_ROTATIONAL_AXES)
|
||||
case 9: // G92.9 - Set Current Position directly (like Marlin 1.0)
|
||||
case 9: // G92.9 - Set Current Position directly (like Marlin 1.0)
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (parser.seenval(AXIS_CHAR(i))) {
|
||||
if (TERN1(HAS_EXTRUDERS, i != E_AXIS))
|
||||
|
|
@ -76,7 +76,7 @@ void GcodeSuite::G92() {
|
|||
else {
|
||||
TERN_(HAS_EXTRUDERS, sync_E = true);
|
||||
}
|
||||
current_position[i] = parser.value_axis_units((AxisEnum)i);
|
||||
motion.position[i] = parser.value_axis_units((AxisEnum)i);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -86,17 +86,17 @@ void GcodeSuite::G92() {
|
|||
LOOP_LOGICAL_AXES(i) {
|
||||
if (parser.seenval(AXIS_CHAR(i))) {
|
||||
const float l = parser.value_axis_units((AxisEnum)i), // Given axis coordinate value, converted to millimeters
|
||||
v = TERN0(HAS_EXTRUDERS, i == E_AXIS) ? l : LOGICAL_TO_NATIVE(l, i), // Axis position in NATIVE space (applying the existing offset)
|
||||
d = v - current_position[i]; // How much is the current axis position altered by?
|
||||
v = TERN0(HAS_EXTRUDERS, i == E_AXIS) ? l : motion.logical_to_native(l, (AxisEnum)i), // Axis position in NATIVE space (applying the existing offset)
|
||||
d = v - motion.position[i]; // How much is the current axis position altered by?
|
||||
if (!NEAR_ZERO(d)) {
|
||||
#if HAS_WORKSPACE_OFFSET && NONE(IS_SCARA, POLARGRAPH) // When using workspaces...
|
||||
if (TERN1(HAS_EXTRUDERS, i != E_AXIS)) {
|
||||
workspace_offset[i] += d; // ...most axes offset the workspace...
|
||||
motion.workspace_offset[i] += d; // ...most axes offset the workspace...
|
||||
}
|
||||
else {
|
||||
#if HAS_EXTRUDERS
|
||||
sync_E = true;
|
||||
current_position.e = v; // ...but E is set directly
|
||||
motion.position.e = v; // ...but E is set directly
|
||||
#endif
|
||||
}
|
||||
#else // Without workspaces...
|
||||
|
|
@ -105,7 +105,7 @@ void GcodeSuite::G92() {
|
|||
else {
|
||||
TERN_(HAS_EXTRUDERS, sync_E = true);
|
||||
}
|
||||
current_position[i] = v; // ...set Current Position directly (like Marlin 1.0)
|
||||
motion.position[i] = v; // ...set Current Position directly (like Marlin 1.0)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -116,13 +116,13 @@ void GcodeSuite::G92() {
|
|||
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
||||
// Apply Workspace Offset to the active coordinate system
|
||||
if (WITHIN(active_coordinate_system, 0, MAX_COORDINATE_SYSTEMS - 1))
|
||||
coordinate_system[active_coordinate_system] = workspace_offset;
|
||||
coordinate_system[active_coordinate_system] = motion.workspace_offset;
|
||||
#endif
|
||||
|
||||
if (sync_XYZE) sync_plan_position();
|
||||
if (sync_XYZE) motion.sync_plan_position();
|
||||
#if HAS_EXTRUDERS
|
||||
else if (sync_E) sync_plan_position_e();
|
||||
else if (sync_E) motion.sync_plan_position_e();
|
||||
#endif
|
||||
|
||||
IF_DISABLED(DIRECT_STEPPING, report_current_position());
|
||||
IF_DISABLED(DIRECT_STEPPING, motion.report_position());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,13 +37,13 @@
|
|||
void GcodeSuite::M206() {
|
||||
if (!parser.seen_any()) return M206_report();
|
||||
LOOP_NUM_AXES(a)
|
||||
if (parser.seenval(AXIS_CHAR(a))) set_home_offset((AxisEnum)a, parser.value_axis_units((AxisEnum)a));
|
||||
if (parser.seenval(AXIS_CHAR(a))) motion.set_home_offset((AxisEnum)a, parser.value_axis_units((AxisEnum)a));
|
||||
#if ENABLED(MORGAN_SCARA)
|
||||
if (parser.seenval('T')) set_home_offset(A_AXIS, parser.value_float()); // Theta
|
||||
if (parser.seenval('P')) set_home_offset(B_AXIS, parser.value_float()); // Psi
|
||||
if (parser.seenval('T')) motion.set_home_offset(A_AXIS, parser.value_float()); // Theta
|
||||
if (parser.seenval('P')) motion.set_home_offset(B_AXIS, parser.value_float()); // Psi
|
||||
#endif
|
||||
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
}
|
||||
|
||||
void GcodeSuite::M206_report(const bool forReplay/*=true*/) {
|
||||
|
|
@ -52,24 +52,24 @@ void GcodeSuite::M206_report(const bool forReplay/*=true*/) {
|
|||
report_heading_etc(forReplay, F(STR_HOME_OFFSET));
|
||||
#if IS_CARTESIAN
|
||||
SERIAL_ECHOLNPGM_P(NUM_AXIS_PAIRED_LIST(
|
||||
PSTR(" M206 X"), LINEAR_UNIT(home_offset.x),
|
||||
SP_Y_STR, LINEAR_UNIT(home_offset.y),
|
||||
SP_Z_STR, LINEAR_UNIT(home_offset.z),
|
||||
SP_I_STR, I_AXIS_UNIT(home_offset.i),
|
||||
SP_J_STR, J_AXIS_UNIT(home_offset.j),
|
||||
SP_K_STR, K_AXIS_UNIT(home_offset.k),
|
||||
SP_U_STR, U_AXIS_UNIT(home_offset.u),
|
||||
SP_V_STR, V_AXIS_UNIT(home_offset.v),
|
||||
SP_W_STR, W_AXIS_UNIT(home_offset.w)
|
||||
PSTR(" M206 X"), LINEAR_UNIT(motion.home_offset.x),
|
||||
SP_Y_STR, LINEAR_UNIT(motion.home_offset.y),
|
||||
SP_Z_STR, LINEAR_UNIT(motion.home_offset.z),
|
||||
SP_I_STR, I_AXIS_UNIT(motion.home_offset.i),
|
||||
SP_J_STR, J_AXIS_UNIT(motion.home_offset.j),
|
||||
SP_K_STR, K_AXIS_UNIT(motion.home_offset.k),
|
||||
SP_U_STR, U_AXIS_UNIT(motion.home_offset.u),
|
||||
SP_V_STR, V_AXIS_UNIT(motion.home_offset.v),
|
||||
SP_W_STR, W_AXIS_UNIT(motion.home_offset.w)
|
||||
));
|
||||
#else
|
||||
SERIAL_ECHOLNPGM_P(PSTR(" M206 Z"), LINEAR_UNIT(home_offset.z));
|
||||
SERIAL_ECHOLNPGM_P(PSTR(" M206 Z"), LINEAR_UNIT(motion.home_offset.z));
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* M428: Set home_offset based on the distance between the
|
||||
* current_position and the nearest "reference point."
|
||||
* current position and the nearest "reference point."
|
||||
* If an axis is past center its endstop position
|
||||
* is the reference-point. Otherwise it uses 0. This allows
|
||||
* the Z offset to be set near the bed when using a max endstop.
|
||||
|
|
@ -79,13 +79,13 @@ void GcodeSuite::M206_report(const bool forReplay/*=true*/) {
|
|||
* Use M206 to set these values directly.
|
||||
*/
|
||||
void GcodeSuite::M428() {
|
||||
if (homing_needed_error()) return;
|
||||
if (motion.homing_needed_error()) return;
|
||||
|
||||
xyz_float_t diff;
|
||||
LOOP_NUM_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];
|
||||
diff[i] = motion.base_home_pos((AxisEnum)i) - motion.position[i];
|
||||
if (!WITHIN(diff[i], -20, 20) && motion.home_dir((AxisEnum)i) > 0)
|
||||
diff[i] = -motion.position[i];
|
||||
if (!WITHIN(diff[i], -20, 20)) {
|
||||
SERIAL_ERROR_MSG(STR_ERR_M428_TOO_FAR);
|
||||
LCD_ALERTMESSAGE(MSG_ERR_M428_TOO_FAR);
|
||||
|
|
@ -94,8 +94,8 @@ void GcodeSuite::M428() {
|
|||
}
|
||||
}
|
||||
|
||||
LOOP_NUM_AXES(i) set_home_offset((AxisEnum)i, diff[i]);
|
||||
report_current_position();
|
||||
LOOP_NUM_AXES(i) motion.set_home_offset((AxisEnum)i, diff[i]);
|
||||
motion.report_position();
|
||||
LCD_MESSAGE(MSG_HOME_OFFSETS_APPLIED);
|
||||
OKAY_BUZZ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,20 +39,21 @@
|
|||
inline void report_linear_axis_pos(const xyze_pos_t &pos) { report_all_axis_pos(pos, 3); }
|
||||
|
||||
void report_linear_axis_pos(const xyz_pos_t &pos, const uint8_t precision=3) {
|
||||
LOOP_NUM_AXES(a) SERIAL_ECHO(FPSTR(pgm_read_ptr(&SP_AXIS_LBL[a])), p_float_t(pos[a], precision));
|
||||
LOOP_NUM_AXES(a)
|
||||
SERIAL_ECHO(FPSTR(pgm_read_ptr(&SP_AXIS_LBL[a])), p_float_t(pos[a], precision));
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
void report_current_position_detail() {
|
||||
// Position as sent by G-code
|
||||
SERIAL_ECHOPGM("\nLogical:");
|
||||
report_linear_axis_pos(current_position.asLogical());
|
||||
report_linear_axis_pos(motion.position.asLogical());
|
||||
|
||||
// Cartesian position in native machine space
|
||||
SERIAL_ECHOPGM("Raw: ");
|
||||
report_linear_axis_pos(current_position);
|
||||
report_linear_axis_pos(motion.position);
|
||||
|
||||
xyze_pos_t leveled = current_position;
|
||||
xyze_pos_t leveled = motion.position;
|
||||
|
||||
#if HAS_LEVELING
|
||||
// Current position with leveling applied
|
||||
|
|
@ -71,7 +72,7 @@
|
|||
// Kinematics applied to the leveled position
|
||||
SERIAL_ECHOPGM(TERN(POLAR, "Polar", TERN(IS_SCARA, "SCARA", "Delta")) "K: " );
|
||||
inverse_kinematics(leveled); // writes delta[]
|
||||
report_linear_axis_pos(delta);
|
||||
report_linear_axis_pos(motion.delta);
|
||||
#endif
|
||||
|
||||
planner.synchronize();
|
||||
|
|
@ -92,10 +93,10 @@
|
|||
#endif
|
||||
|
||||
SERIAL_ECHOPGM("FromStp:");
|
||||
get_cartesian_from_steppers(); // Writes 'cartes' (with forward kinematics)
|
||||
motion.get_cartesian_from_steppers(); // Writes 'motion.cartes' (with forward kinematics)
|
||||
xyze_pos_t from_steppers = LOGICAL_AXIS_ARRAY(
|
||||
planner.get_axis_position_mm(E_AXIS),
|
||||
cartes.x, cartes.y, cartes.z,
|
||||
motion.cartes.x, motion.cartes.y, motion.cartes.z,
|
||||
planner.get_axis_position_mm(I_AXIS),
|
||||
planner.get_axis_position_mm(J_AXIS),
|
||||
planner.get_axis_position_mm(K_AXIS),
|
||||
|
|
@ -109,7 +110,7 @@
|
|||
SERIAL_ECHOPGM("Diff: ");
|
||||
report_all_axis_pos(diff);
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.report_current_grblstate_moving());
|
||||
}
|
||||
|
||||
#endif // M114_DETAIL
|
||||
|
|
@ -133,7 +134,7 @@ void GcodeSuite::M114() {
|
|||
#if ENABLED(M114_DETAIL)
|
||||
if (parser.seen_test('D')) {
|
||||
IF_DISABLED(M114_LEGACY, planner.synchronize());
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
report_current_position_detail();
|
||||
return;
|
||||
}
|
||||
|
|
@ -145,10 +146,10 @@ void GcodeSuite::M114() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
TERN_(M114_REALTIME, if (parser.seen_test('R')) return report_real_position());
|
||||
TERN_(M114_REALTIME, if (parser.seen_test('R')) return motion.report_position_real());
|
||||
|
||||
TERN_(M114_LEGACY, planner.synchronize());
|
||||
report_current_position_projected();
|
||||
motion.report_position_projected();
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.report_current_grblstate_moving());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,8 +254,8 @@ void GcodeSuite::M115() {
|
|||
dmin = NUM_AXIS_ARRAY(X_MIN_POS, Y_MIN_POS, Z_MIN_POS, I_MIN_POS, J_MIN_POS, K_MIN_POS, U_MIN_POS, V_MIN_POS, W_MIN_POS),
|
||||
dmax = NUM_AXIS_ARRAY(X_MAX_POS, Y_MAX_POS, Z_MAX_POS, I_MAX_POS, J_MAX_POS, K_MAX_POS, U_MAX_POS, V_MAX_POS, W_MAX_POS);
|
||||
xyz_pos_t cmin = bmin, cmax = bmax;
|
||||
apply_motion_limits(cmin);
|
||||
apply_motion_limits(cmax);
|
||||
motion.apply_limits(cmin);
|
||||
motion.apply_limits(cmax);
|
||||
const xyz_pos_t lmin = dmin.asLogical(), lmax = dmax.asLogical(),
|
||||
wmin = cmin.asLogical(), wmax = cmax.asLogical();
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
void GcodeSuite::M154() {
|
||||
|
||||
if (parser.seenval('S'))
|
||||
position_auto_reporter.set_interval(parser.value_byte());
|
||||
motion.position_auto_reporter.set_interval(parser.value_byte());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -171,8 +171,8 @@ void GcodeSuite::M360() {
|
|||
const xyz_pos_t dmin = NUM_AXIS_ARRAY(X_MIN_POS, Y_MIN_POS, Z_MIN_POS, I_MIN_POS, J_MIN_POS, K_MIN_POS, U_MIN_POS, V_MIN_POS, W_MIN_POS),
|
||||
dmax = NUM_AXIS_ARRAY(X_MAX_POS, Y_MAX_POS, Z_MAX_POS, I_MAX_POS, J_MAX_POS, K_MAX_POS, U_MAX_POS, V_MAX_POS, W_MAX_POS);
|
||||
xyz_pos_t cmin = dmin, cmax = dmax;
|
||||
apply_motion_limits(cmin);
|
||||
apply_motion_limits(cmax);
|
||||
motion.apply_limits(cmin);
|
||||
motion.apply_limits(cmax);
|
||||
const xyz_pos_t wmin = cmin.asLogical(), wmax = cmax.asLogical();
|
||||
|
||||
PGMSTR(MIN_STR, "Min");
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@
|
|||
#include "../../lcd/sovol_rts/sovol_rts.h"
|
||||
#endif
|
||||
|
||||
extern xyze_pos_t destination;
|
||||
|
||||
#if ENABLED(VARIABLE_G0_FEEDRATE)
|
||||
feedRate_t fast_move_feedrate = MMM_TO_MMS(G0_FEEDRATE);
|
||||
#endif
|
||||
|
|
@ -49,29 +47,29 @@ extern xyze_pos_t destination;
|
|||
* G0, G1: Coordinated movement of X Y Z E axes
|
||||
*/
|
||||
void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
|
||||
if (!MOTION_CONDITIONS) return;
|
||||
if (motion.gcode_motion_ignored()) return;
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_RUNNING));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_RUNNING));
|
||||
|
||||
#ifdef G0_FEEDRATE
|
||||
feedRate_t old_feedrate;
|
||||
#if ENABLED(VARIABLE_G0_FEEDRATE)
|
||||
if (fast_move) {
|
||||
old_feedrate = feedrate_mm_s; // Back up the (old) motion mode feedrate
|
||||
feedrate_mm_s = fast_move_feedrate; // Get G0 feedrate from last usage
|
||||
old_feedrate = motion.feedrate_mm_s; // Back up the (old) motion mode feedrate
|
||||
motion.feedrate_mm_s = fast_move_feedrate; // Get G0 feedrate from last usage
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
get_destination_from_command(); // Get X Y [Z[I[J[K]]]] [E] F (and set cutter power)
|
||||
get_destination_from_command(); // Get X Y [Z[I[J[K]]]] [E] F (and set cutter power)
|
||||
|
||||
#ifdef G0_FEEDRATE
|
||||
if (fast_move) {
|
||||
#if ENABLED(VARIABLE_G0_FEEDRATE)
|
||||
fast_move_feedrate = feedrate_mm_s; // Save feedrate for the next G0
|
||||
fast_move_feedrate = motion.feedrate_mm_s; // Save feedrate for the next G0
|
||||
#else
|
||||
old_feedrate = feedrate_mm_s; // Back up the (new) motion mode feedrate
|
||||
feedrate_mm_s = MMM_TO_MMS(G0_FEEDRATE); // Get the fixed G0 feedrate
|
||||
old_feedrate = motion.feedrate_mm_s; // Back up the (new) motion mode feedrate
|
||||
motion.feedrate_mm_s = MMM_TO_MMS(G0_FEEDRATE); // Get the fixed G0 feedrate
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
@ -83,12 +81,11 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
|
|||
if (fwretract.autoretract_enabled && parser.seen_test('E')
|
||||
&& !parser.seen(STR_AXES_MAIN)
|
||||
) {
|
||||
const float echange = destination.e - current_position.e;
|
||||
const float echange = motion.destination.e - motion.position.e;
|
||||
// Is this a retract or recover move?
|
||||
if (WITHIN(ABS(echange), MIN_AUTORETRACT, MAX_AUTORETRACT) && fwretract.retracted[active_extruder] == (echange > 0.0)) {
|
||||
current_position.e = destination.e; // Hide a G1-based retract/recover from calculations
|
||||
sync_plan_position_e(); // AND from the planner
|
||||
fwretract.retract(echange < 0.0); // Firmware-based retract/recover (double-retract ignored)
|
||||
if (WITHIN(ABS(echange), MIN_AUTORETRACT, MAX_AUTORETRACT) && fwretract.retracted[motion.extruder] == (echange > 0.0f)) {
|
||||
motion.set_and_sync_e(motion.destination.e); // Hide a G1-based retract/recover from calculations AND from the planner
|
||||
fwretract.retract(echange < 0.0f); // Firmware-based retract/recover (double-retract ignored)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -97,14 +94,14 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
|
|||
#endif // FWRETRACT
|
||||
|
||||
#if ANY(IS_SCARA, POLAR)
|
||||
fast_move ? prepare_fast_move_to_destination() : prepare_line_to_destination();
|
||||
fast_move ? motion.prepare_fast_move_to_destination() : motion.prepare_line_to_destination();
|
||||
#else
|
||||
prepare_line_to_destination();
|
||||
motion.prepare_line_to_destination();
|
||||
#endif
|
||||
|
||||
#ifdef G0_FEEDRATE
|
||||
// Restore the motion mode feedrate
|
||||
if (fast_move) feedrate_mm_s = old_feedrate;
|
||||
if (fast_move) motion.feedrate_mm_s = old_feedrate;
|
||||
#endif
|
||||
|
||||
#if ENABLED(NANODLP_Z_SYNC)
|
||||
|
|
@ -117,9 +114,9 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
|
|||
planner.synchronize();
|
||||
SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP);
|
||||
}
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_IDLE));
|
||||
#else
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.report_current_grblstate_moving());
|
||||
#endif
|
||||
|
||||
TERN_(SOVOL_SV06_RTS, RTS_PauseMoveAxisPage());
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
*/
|
||||
void plan_arc(
|
||||
const xyze_pos_t &cart, // Destination position
|
||||
const ab_float_t &offset, // Center of rotation relative to current_position
|
||||
const ab_float_t &offset, // Center of rotation relative to motion.position
|
||||
const bool clockwise, // Clockwise?
|
||||
const uint8_t circles // Take the scenic route
|
||||
) {
|
||||
|
|
@ -71,22 +71,22 @@ void plan_arc(
|
|||
ab_float_t rvec = -offset;
|
||||
|
||||
const float radius = HYPOT(rvec.a, rvec.b),
|
||||
center_P = current_position[axis_p] - rvec.a,
|
||||
center_Q = current_position[axis_q] - rvec.b,
|
||||
center_P = motion.position[axis_p] - rvec.a,
|
||||
center_Q = motion.position[axis_q] - rvec.b,
|
||||
rt_X = cart[axis_p] - center_P,
|
||||
rt_Y = cart[axis_q] - center_Q;
|
||||
|
||||
// Starting position of the move for all non-arc axes
|
||||
// i.e., only one of X, Y, or Z, plus the rest.
|
||||
ARC_LIJKUVWE_CODE(
|
||||
float start_L = current_position[axis_l],
|
||||
float start_I = current_position.i,
|
||||
float start_J = current_position.j,
|
||||
float start_K = current_position.k,
|
||||
float start_U = current_position.u,
|
||||
float start_V = current_position.v,
|
||||
float start_W = current_position.w,
|
||||
float start_E = current_position.e
|
||||
float start_L = motion.position[axis_l],
|
||||
float start_I = motion.position.i,
|
||||
float start_J = motion.position.j,
|
||||
float start_K = motion.position.k,
|
||||
float start_U = motion.position.u,
|
||||
float start_V = motion.position.v,
|
||||
float start_W = motion.position.w,
|
||||
float start_E = motion.position.e
|
||||
);
|
||||
|
||||
// Angle of rotation between position and target from the circle center.
|
||||
|
|
@ -96,7 +96,7 @@ void plan_arc(
|
|||
uint16_t min_segments = 1;
|
||||
|
||||
// Do a full circle if starting and ending positions are "identical"
|
||||
if (NEAR(current_position[axis_p], cart[axis_p]) && NEAR(current_position[axis_q], cart[axis_q])) {
|
||||
if (NEAR(motion.position[axis_p], cart[axis_p]) && NEAR(motion.position[axis_q], cart[axis_q])) {
|
||||
// Preserve direction for circles
|
||||
angular_travel = clockwise ? -RADIANS(360) : RADIANS(360);
|
||||
abs_angular_travel = RADIANS(360);
|
||||
|
|
@ -150,7 +150,7 @@ void plan_arc(
|
|||
const float per_circle_E = travel_E * part_per_circle // E movement per circle
|
||||
);
|
||||
|
||||
xyze_pos_t temp_position = current_position;
|
||||
xyze_pos_t temp_position = motion.position;
|
||||
for (uint16_t n = circles; n--;) {
|
||||
ARC_LIJKUVWE_CODE( // Destination Linear Axes
|
||||
temp_position[axis_l] += per_circle_L, // Linear X, Y, or Z
|
||||
|
|
@ -167,14 +167,14 @@ void plan_arc(
|
|||
|
||||
// Get starting coordinates for the remainder from the current position
|
||||
ARC_LIJKUVWE_CODE(
|
||||
start_L = current_position[axis_l],
|
||||
start_I = current_position.i,
|
||||
start_J = current_position.j,
|
||||
start_K = current_position.k,
|
||||
start_U = current_position.u,
|
||||
start_V = current_position.v,
|
||||
start_W = current_position.w,
|
||||
start_E = current_position.e
|
||||
start_L = motion.position[axis_l],
|
||||
start_I = motion.position.i,
|
||||
start_J = motion.position.j,
|
||||
start_K = motion.position.k,
|
||||
start_U = motion.position.u,
|
||||
start_V = motion.position.v,
|
||||
start_W = motion.position.w,
|
||||
start_E = motion.position.e
|
||||
);
|
||||
|
||||
// Update travel distance for the remainder
|
||||
|
|
@ -212,7 +212,7 @@ void plan_arc(
|
|||
}
|
||||
|
||||
// Feedrate for the move, scaled by the feedrate multiplier
|
||||
const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
|
||||
const feedRate_t scaled_fr_mm_s = motion.mms_scaled();
|
||||
|
||||
// Get the ideal segment length for the move based on settings
|
||||
const float ideal_segment_mm = (
|
||||
|
|
@ -361,7 +361,7 @@ void plan_arc(
|
|||
raw.e = start_E + per_segment_E * i
|
||||
);
|
||||
|
||||
apply_motion_limits(raw);
|
||||
motion.apply_limits(raw);
|
||||
|
||||
#if HAS_LEVELING && !PLANNER_LEVELING
|
||||
planner.apply_leveling(raw);
|
||||
|
|
@ -371,7 +371,7 @@ void plan_arc(
|
|||
const float arc_mm_remaining = flat_mm - segment_mm * i;
|
||||
hints.safe_exit_speed_sqr = _MIN(limiting_speed_sqr, 2 * limiting_accel * arc_mm_remaining);
|
||||
|
||||
if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, hints))
|
||||
if (!planner.buffer_line(raw, scaled_fr_mm_s, motion.extruder, hints))
|
||||
break;
|
||||
|
||||
hints.curve_radius = radius;
|
||||
|
|
@ -381,7 +381,7 @@ void plan_arc(
|
|||
// Ensure last segment arrives at target location.
|
||||
raw = cart;
|
||||
|
||||
apply_motion_limits(raw);
|
||||
motion.apply_limits(raw);
|
||||
|
||||
#if HAS_LEVELING && !PLANNER_LEVELING
|
||||
planner.apply_leveling(raw);
|
||||
|
|
@ -389,9 +389,9 @@ void plan_arc(
|
|||
|
||||
hints.curve_radius = 0;
|
||||
hints.safe_exit_speed_sqr = 0.0f;
|
||||
planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, hints);
|
||||
planner.buffer_line(raw, scaled_fr_mm_s, motion.extruder, hints);
|
||||
|
||||
current_position = cart;
|
||||
motion.position = cart;
|
||||
|
||||
} // plan_arc
|
||||
|
||||
|
|
@ -423,24 +423,24 @@ void plan_arc(
|
|||
* G3 X20 Y12 R14 ; CCW circle with r=14 ending at X20 Y12
|
||||
*/
|
||||
void GcodeSuite::G2_G3(const bool clockwise) {
|
||||
if (!MOTION_CONDITIONS) return;
|
||||
if (motion.gcode_motion_ignored()) return;
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_RUNNING));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_RUNNING));
|
||||
|
||||
#if ENABLED(SF_ARC_FIX)
|
||||
const bool relative_mode_backup = relative_mode;
|
||||
relative_mode = true;
|
||||
const bool relative_mode_backup = motion.relative_mode;
|
||||
motion.relative_mode = true;
|
||||
#endif
|
||||
|
||||
get_destination_from_command(); // Get X Y [Z[I[J[K...]]]] [E] F (and set cutter power)
|
||||
|
||||
TERN_(SF_ARC_FIX, relative_mode = relative_mode_backup);
|
||||
TERN_(SF_ARC_FIX, motion.relative_mode = relative_mode_backup);
|
||||
|
||||
ab_float_t arc_offset = { 0, 0 };
|
||||
if (parser.seenval('R')) {
|
||||
const float r = parser.value_linear_units();
|
||||
if (r) {
|
||||
const xy_pos_t p1 = current_position, p2 = destination;
|
||||
const xy_pos_t p1 = motion.position, p2 = motion.destination;
|
||||
if (p1 != p2) {
|
||||
const xy_pos_t d2 = (p2 - p1) * 0.5f; // XY vector to midpoint of move from current
|
||||
const float e = clockwise ^ (r < 0) ? -1 : 1, // clockwise -1/1, counterclockwise 1/-1
|
||||
|
|
@ -480,13 +480,13 @@ void GcodeSuite::G2_G3(const bool clockwise) {
|
|||
#endif
|
||||
|
||||
// Send the arc to the planner
|
||||
plan_arc(destination, arc_offset, clockwise, circles_to_do);
|
||||
plan_arc(motion.destination, arc_offset, clockwise, circles_to_do);
|
||||
reset_stepper_timeout();
|
||||
}
|
||||
else
|
||||
SERIAL_ERROR_MSG(STR_ERR_ARC_ARGS);
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, motion.set_and_report_grblstate(M_IDLE));
|
||||
}
|
||||
|
||||
#endif // ARC_SUPPORT
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
* G5: Cubic B-spline
|
||||
*/
|
||||
void GcodeSuite::G5() {
|
||||
if (!MOTION_CONDITIONS) return;
|
||||
if (motion.gcode_motion_ignored()) return;
|
||||
|
||||
#if ENABLED(CNC_WORKSPACE_PLANES)
|
||||
if (workspace_plane != PLANE_XY) {
|
||||
|
|
@ -60,8 +60,8 @@ void GcodeSuite::G5() {
|
|||
{ parser.linearval('P'), parser.linearval('Q') }
|
||||
};
|
||||
|
||||
cubic_b_spline(current_position, destination, offsets, MMS_SCALED(feedrate_mm_s), active_extruder);
|
||||
current_position = destination;
|
||||
cubic_b_spline(motion.position, motion.destination, offsets, motion.mms_scaled(), motion.extruder);
|
||||
motion.position = motion.destination;
|
||||
}
|
||||
|
||||
#endif // BEZIER_CURVE_SUPPORT
|
||||
|
|
|
|||
|
|
@ -36,14 +36,14 @@
|
|||
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||
|
||||
FORCE_INLINE void mod_probe_offset(const float offs) {
|
||||
if (TERN1(BABYSTEP_HOTEND_Z_OFFSET, active_extruder == 0)) {
|
||||
if (TERN1(BABYSTEP_HOTEND_Z_OFFSET, motion.extruder == 0)) {
|
||||
probe.offset.z += offs;
|
||||
SERIAL_ECHO_MSG(STR_PROBE_OFFSET " " STR_Z, probe.offset.z);
|
||||
}
|
||||
else {
|
||||
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
|
||||
hotend_offset[active_extruder].z -= offs;
|
||||
SERIAL_ECHO_MSG(STR_PROBE_OFFSET STR_Z ": ", hotend_offset[active_extruder].z);
|
||||
motion.active_hotend_offset().z -= offs;
|
||||
SERIAL_ECHO_MSG(STR_PROBE_OFFSET STR_Z ": ", motion.active_hotend_offset().z);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -93,15 +93,15 @@ void GcodeSuite::M290() {
|
|||
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
|
||||
{
|
||||
SERIAL_ECHOLNPGM_P(
|
||||
PSTR("Hotend "), active_extruder
|
||||
PSTR("Hotend "), motion.extruder
|
||||
#if ENABLED(BABYSTEP_XY)
|
||||
, PSTR("Offset X"), hotend_offset[active_extruder].x
|
||||
, SP_Y_STR, hotend_offset[active_extruder].y
|
||||
, PSTR("Offset X"), motion.active_hotend_offset().x
|
||||
, SP_Y_STR, motion.active_hotend_offset().y
|
||||
, SP_Z_STR
|
||||
#else
|
||||
, PSTR("Offset Z")
|
||||
#endif
|
||||
, hotend_offset[active_extruder].z
|
||||
, motion.active_hotend_offset().z
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@
|
|||
*/
|
||||
void GcodeSuite::G30() {
|
||||
|
||||
xy_pos_t probepos = current_position;
|
||||
xy_pos_t probepos = motion.position;
|
||||
|
||||
const bool seenX = parser.seenval('X');
|
||||
if (seenX) probepos.x = RAW_X_POSITION(parser.value_linear_units());
|
||||
if (seenX) probepos.x = motion.raw_x(parser.value_linear_units());
|
||||
const bool seenY = parser.seenval('Y');
|
||||
if (seenY) probepos.y = RAW_Y_POSITION(parser.value_linear_units());
|
||||
if (seenY) probepos.y = motion.raw_y(parser.value_linear_units());
|
||||
|
||||
probe.use_probing_tool();
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ void GcodeSuite::G30() {
|
|||
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
|
||||
|
||||
// Disable feedrate scaling so movement speeds are correct
|
||||
remember_feedrate_scaling_off();
|
||||
motion.remember_feedrate_scaling_off();
|
||||
|
||||
// With VERBOSE_SINGLE_PROBE home only if needed
|
||||
TERN_(VERBOSE_SINGLE_PROBE, process_subcommands_now(F("G28O")));
|
||||
|
|
@ -102,15 +102,15 @@ void GcodeSuite::G30() {
|
|||
}
|
||||
|
||||
// Restore feedrate scaling
|
||||
restore_feedrate_and_scaling();
|
||||
motion.restore_feedrate_and_scaling();
|
||||
|
||||
// Move the nozzle to the position of the probe
|
||||
do_blocking_move_to(probepos);
|
||||
motion.blocking_move(probepos);
|
||||
|
||||
if (raise_after == PROBE_PT_STOW)
|
||||
probe.move_z_after_probing();
|
||||
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHOLN(GET_EN_TEXT_F(MSG_ZPROBE_OUT));
|
||||
|
|
|
|||
|
|
@ -36,12 +36,12 @@ probe_target_t G38_move{0};
|
|||
inline void G38_single_probe(const uint8_t move_value) {
|
||||
endstops.enable(true);
|
||||
G38_move.type = move_value;
|
||||
prepare_line_to_destination();
|
||||
motion.prepare_line_to_destination();
|
||||
planner.synchronize();
|
||||
G38_move.type = 0;
|
||||
endstops.hit_on_purpose();
|
||||
set_current_from_steppers_for_axis(ALL_AXES_ENUM);
|
||||
sync_plan_position();
|
||||
motion.set_current_from_steppers_for_axis(ALL_AXES_ENUM);
|
||||
motion.sync_plan_position();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -59,8 +59,8 @@ FORCE_INLINE bool G38_run_probe() {
|
|||
// Get direction of move and retract
|
||||
xyz_float_t retract_mm;
|
||||
LOOP_NUM_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);
|
||||
const float dist = motion.destination[i] - motion.position[i];
|
||||
retract_mm[i] = ABS(dist) < G38_MINIMUM_MOVE ? 0 : motion.home_bump_mm((AxisEnum)i) * (dist > 0 ? -1 : 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -84,15 +84,15 @@ FORCE_INLINE bool G38_run_probe() {
|
|||
|
||||
#if MULTIPLE_PROBING > 1
|
||||
// Move away by the retract distance
|
||||
destination = current_position + retract_mm;
|
||||
motion.destination = motion.position + retract_mm;
|
||||
endstops.enable(false);
|
||||
prepare_line_to_destination();
|
||||
motion.prepare_line_to_destination();
|
||||
planner.synchronize();
|
||||
|
||||
REMEMBER(fr, feedrate_mm_s, feedrate_mm_s * 0.25);
|
||||
REMEMBER(fr, motion.feedrate_mm_s, motion.feedrate_mm_s * 0.25);
|
||||
|
||||
// Bump the target more slowly
|
||||
destination -= retract_mm * 2;
|
||||
motion.destination -= retract_mm * 2;
|
||||
|
||||
G38_single_probe(move_value);
|
||||
#endif
|
||||
|
|
@ -118,20 +118,20 @@ void GcodeSuite::G38(const int8_t subcode) {
|
|||
// Get X Y Z E F
|
||||
get_destination_from_command();
|
||||
|
||||
remember_feedrate_scaling_off();
|
||||
motion.remember_feedrate_scaling_off();
|
||||
|
||||
const bool error_on_fail = TERN(G38_PROBE_AWAY, !TEST(subcode, 0), subcode == 2);
|
||||
|
||||
// If any axis has enough movement, do the move
|
||||
LOOP_NUM_AXES(i)
|
||||
if (ABS(destination[i] - current_position[i]) >= G38_MINIMUM_MOVE) {
|
||||
if (!parser.seenval('F')) feedrate_mm_s = homing_feedrate((AxisEnum)i);
|
||||
if (ABS(motion.destination[i] - motion.position[i]) >= G38_MINIMUM_MOVE) {
|
||||
if (!parser.seenval('F')) motion.feedrate_mm_s = motion.homing_feedrate((AxisEnum)i);
|
||||
// If G38.2 fails throw an error
|
||||
if (!G38_run_probe() && error_on_fail) SERIAL_ERROR_MSG("Failed to reach target");
|
||||
break;
|
||||
}
|
||||
|
||||
restore_feedrate_and_scaling();
|
||||
motion.restore_feedrate_and_scaling();
|
||||
}
|
||||
|
||||
#endif // G38_PROBE_TARGET
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ void GcodeSuite::M401() {
|
|||
|
||||
probe.deploy(parser.boolval('R'));
|
||||
TERN_(PROBE_TARE, probe.tare());
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
}
|
||||
|
||||
void GcodeSuite::M401_report(const bool forReplay/*=true*/) {
|
||||
|
|
@ -75,9 +75,9 @@ void GcodeSuite::M401_report(const bool forReplay/*=true*/) {
|
|||
void GcodeSuite::M402() {
|
||||
probe.stow(parser.boolval('R'));
|
||||
#ifdef Z_AFTER_PROBING
|
||||
do_z_clearance(Z_AFTER_PROBING);
|
||||
motion.do_z_clearance(Z_AFTER_PROBING);
|
||||
#endif
|
||||
report_current_position();
|
||||
motion.report_position();
|
||||
}
|
||||
|
||||
#endif // HAS_BED_PROBE
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ void mpe_settings_init() {
|
|||
mpe_settings.parking_xpos[0] = pex[0]; // M951 L
|
||||
mpe_settings.parking_xpos[1] = pex[1]; // M951 R
|
||||
mpe_settings.grab_distance = PARKING_EXTRUDER_GRAB_DISTANCE; // M951 I
|
||||
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, -mpe_settings.grab_distance));
|
||||
TERN_(HAS_HOME_OFFSET, motion.set_home_offset(X_AXIS, -mpe_settings.grab_distance));
|
||||
mpe_settings.slow_feedrate = MMM_TO_MMS(MPE_SLOW_SPEED); // M951 J
|
||||
mpe_settings.fast_feedrate = MMM_TO_MMS(MPE_FAST_SPEED); // M951 H
|
||||
mpe_settings.travel_distance = MPE_TRAVEL_DISTANCE; // M951 D
|
||||
|
|
@ -74,7 +74,7 @@ void GcodeSuite::M951() {
|
|||
if (parser.seenval('R')) mpe_settings.parking_xpos[1] = parser.value_linear_units();
|
||||
if (parser.seenval('I')) {
|
||||
mpe_settings.grab_distance = parser.value_linear_units();
|
||||
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, -mpe_settings.grab_distance));
|
||||
TERN_(HAS_HOME_OFFSET, motion.set_home_offset(X_AXIS, -mpe_settings.grab_distance));
|
||||
}
|
||||
if (parser.seenval('J')) mpe_settings.slow_feedrate = MMM_TO_MMS(parser.value_linear_units());
|
||||
if (parser.seenval('H')) mpe_settings.fast_feedrate = MMM_TO_MMS(parser.value_linear_units());
|
||||
|
|
|
|||
|
|
@ -539,7 +539,7 @@ void GCodeQueue::get_serial_commands() {
|
|||
if (command[0] == 'M') switch (command[3]) {
|
||||
case '8': if (command[2] == '0' && command[1] == '1') { marlin.end_waiting(); } break;
|
||||
case '2': if (command[2] == '1' && command[1] == '1') marlin.kill(FPSTR(M112_KILL_STR), nullptr, true); break;
|
||||
case '0': if (command[1] == '4' && command[2] == '1') quickstop_stepper(); break;
|
||||
case '0': if (command[1] == '4' && command[2] == '1') motion.quickstop_stepper(); break;
|
||||
}
|
||||
|
||||
#if NO_TIMEOUTS > 0
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
inline bool SCARA_move_to_cal(const uint8_t delta_a, const uint8_t delta_b) {
|
||||
if (marlin.isRunning()) {
|
||||
forward_kinematics(delta_a, delta_b);
|
||||
do_blocking_move_to_xy(cartes);
|
||||
motion.blocking_move_xy(motion.cartes);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -106,13 +106,13 @@ void GcodeSuite::M104_M109(const bool isM109) {
|
|||
if (got_temp) {
|
||||
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
|
||||
thermalManager.singlenozzle_temp[target_extruder] = temp;
|
||||
if (target_extruder != active_extruder) return;
|
||||
if (target_extruder != motion.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);
|
||||
if (motion.idex_is_duplicating() && target_extruder == 0)
|
||||
thermalManager.setTargetHotend(temp ? temp + motion.duplicate_extruder_temp_offset : 0, 1);
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@
|
|||
#endif
|
||||
|
||||
#if ENABLED(SINGLENOZZLE)
|
||||
#define _ALT_P active_extruder
|
||||
#define _ALT_P motion.extruder
|
||||
#define _CNT_P EXTRUDERS
|
||||
#else
|
||||
#define _ALT_P _MIN(active_extruder, FAN_COUNT - 1)
|
||||
#define _ALT_P _MIN(motion.extruder, FAN_COUNT - 1)
|
||||
#define _CNT_P FAN_COUNT
|
||||
#endif
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ void GcodeSuite::M106() {
|
|||
}
|
||||
#endif
|
||||
|
||||
const uint16_t dspeed = parser.seen_test('A') ? thermalManager.fan_speed[active_extruder] : 255;
|
||||
const uint16_t dspeed = parser.seen_test('A') ? thermalManager.fan_speed[motion.extruder] : 255;
|
||||
|
||||
uint16_t speed = dspeed;
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ void GcodeSuite::M106() {
|
|||
|
||||
TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_BIT_SYNC_FANS));
|
||||
|
||||
if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating
|
||||
if (TERN0(DUAL_X_CARRIAGE, motion.idex_is_duplicating())) // pfan == 0 when duplicating
|
||||
thermalManager.set_fan_speed(1 - pfan, speed);
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ void GcodeSuite::M107() {
|
|||
|
||||
thermalManager.set_fan_speed(pfan, 0);
|
||||
|
||||
if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating
|
||||
if (TERN0(DUAL_X_CARRIAGE, motion.idex_is_duplicating())) // pfan == 0 when duplicating
|
||||
thermalManager.set_fan_speed(1 - pfan, 0);
|
||||
|
||||
TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_BIT_SYNC_FANS));
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
*/
|
||||
|
||||
void GcodeSuite::M306() {
|
||||
const uint8_t e = E_TERN0(parser.intval('E', active_extruder));
|
||||
const uint8_t e = E_TERN0(parser.intval('E', motion.extruder));
|
||||
if (e >= (EXTRUDERS)) {
|
||||
SERIAL_ECHOLNPGM("?(E)xtruder index out of range (0-", (EXTRUDERS) - 1, ").");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -462,6 +462,7 @@
|
|||
#endif
|
||||
#if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
|
||||
#define ABL_USES_GRID 1
|
||||
#define HAS_VARIABLE_XY_PROBE_FEEDRATE 1
|
||||
#ifndef XY_PROBE_FEEDRATE_MIN
|
||||
#define XY_PROBE_FEEDRATE_MIN 60 // Minimum mm/min value for 'G29 S<feedrate>'
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3250,7 +3250,7 @@
|
|||
#define ENDSTOPPULLUP_ZMIN_PROBE
|
||||
#endif
|
||||
#ifndef XY_PROBE_FEEDRATE
|
||||
#define XY_PROBE_FEEDRATE ((homing_feedrate_mm_m.x + homing_feedrate_mm_m.y) / 2)
|
||||
#define XY_PROBE_FEEDRATE ((motion.homing_feedrate_mm_m.x + motion.homing_feedrate_mm_m.y) / 2)
|
||||
#endif
|
||||
#ifndef NOZZLE_TO_PROBE_OFFSET
|
||||
#define NOZZLE_TO_PROBE_OFFSET { 0, 0, 0 }
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
* version was tagged.
|
||||
*/
|
||||
#ifndef STRING_DISTRIBUTION_DATE
|
||||
#define STRING_DISTRIBUTION_DATE "2026-02-09"
|
||||
#define STRING_DISTRIBUTION_DATE "2026-02-19"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -584,9 +584,9 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
|||
lcd_put_lchar('X' + uint8_t(axis));
|
||||
if (blink)
|
||||
lcd_put_u8str(value);
|
||||
else if (axis_should_home(axis))
|
||||
else if (motion.axis_should_home(axis))
|
||||
while (const char c = *value++) lcd_put_lchar(c <= '.' ? c : '?');
|
||||
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
|
||||
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !motion.axis_is_trusted(axis))
|
||||
lcd_put_u8str(TERN0(HAS_Z_AXIS, axis == Z_AXIS) ? F(" ") : F(" "));
|
||||
else
|
||||
lcd_put_u8str(value);
|
||||
|
|
@ -1077,14 +1077,14 @@ void MarlinUI::draw_status_screen() {
|
|||
if (show_e_total) {
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
char tmp[20];
|
||||
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
||||
sprintf_P(tmp, PSTR("E %ld%cm "), uint32_t(_MAX(e_move_accumulator, 0.0f)) / escale, escale == 10 ? 'c' : 'm'); // 1234567mm
|
||||
const uint8_t escale = motion.e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
||||
sprintf_P(tmp, PSTR("E %" PRIu32 "%cm "), uint32_t(_MAX(motion.e_move_accumulator, 0.0f)) / escale, escale == 10 ? 'c' : 'm'); // 1234567mm
|
||||
lcd_put_u8str(tmp);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if HAS_X_AXIS
|
||||
const xy_pos_t lpos = current_position.asLogical();
|
||||
const xy_pos_t lpos = motion.position.asLogical();
|
||||
_draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink);
|
||||
#endif
|
||||
#if HAS_Y_AXIS
|
||||
|
|
@ -1101,7 +1101,7 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
#if HAS_Z_AXIS
|
||||
lcd_moveto(LCD_WIDTH - 8, 1);
|
||||
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
|
||||
_draw_axis_value(Z_AXIS, ftostr52sp(motion.logical_z(motion.position.z)), blink);
|
||||
#if HAS_LEVELING && !HAS_HEATED_BED
|
||||
lcd_put_lchar(planner.leveling_active || blink ? '_' : ' ');
|
||||
#endif
|
||||
|
|
@ -1114,7 +1114,7 @@ void MarlinUI::draw_status_screen() {
|
|||
#if LCD_HEIGHT > 3
|
||||
|
||||
lcd_put_lchar(0, 2, LCD_STR_FEEDRATE[0]);
|
||||
lcd_put_u8str(i16tostr3rj(feedrate_percentage));
|
||||
lcd_put_u8str(i16tostr3rj(motion.feedrate_percentage));
|
||||
lcd_put_u8str(F("%"));
|
||||
|
||||
#if LCD_WIDTH >= 20
|
||||
|
|
@ -1168,7 +1168,7 @@ void MarlinUI::draw_status_screen() {
|
|||
//
|
||||
#if HAS_Z_AXIS
|
||||
lcd_moveto(LCD_WIDTH - 9, 0);
|
||||
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
|
||||
_draw_axis_value(Z_AXIS, ftostr52sp(motion.logical_z(motion.position.z)), blink);
|
||||
#endif
|
||||
|
||||
#if HAS_LEVELING && (HAS_MULTI_HOTEND || !HAS_HEATED_BED)
|
||||
|
|
@ -1188,7 +1188,7 @@ void MarlinUI::draw_status_screen() {
|
|||
#endif
|
||||
|
||||
lcd_put_lchar(LCD_WIDTH - 9, 1, LCD_STR_FEEDRATE[0]);
|
||||
lcd_put_u8str(i16tostr3rj(feedrate_percentage));
|
||||
lcd_put_u8str(i16tostr3rj(motion.feedrate_percentage));
|
||||
lcd_put_u8str(F("%"));
|
||||
|
||||
// ========== Line 3 ==========
|
||||
|
|
@ -1223,20 +1223,20 @@ void MarlinUI::draw_status_screen() {
|
|||
// X Coordinate
|
||||
//
|
||||
lcd_moveto(0, 0);
|
||||
_draw_axis_value(X_AXIS, ftostr52sp(LOGICAL_X_POSITION(current_position.x)), blink);
|
||||
_draw_axis_value(X_AXIS, ftostr52sp(motion.logical_x(motion.position.x)), blink);
|
||||
|
||||
//
|
||||
// Y Coordinate
|
||||
//
|
||||
lcd_moveto(LCD_WIDTH - 9, 0);
|
||||
_draw_axis_value(Y_AXIS, ftostr52sp(LOGICAL_Y_POSITION(current_position.y)), blink);
|
||||
_draw_axis_value(Y_AXIS, ftostr52sp(motion.logical_y(motion.position.y)), blink);
|
||||
|
||||
// ========== Line 2 ==========
|
||||
lcd_moveto(0, 1);
|
||||
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
|
||||
_draw_axis_value(Z_AXIS, ftostr52sp(motion.logical_z(motion.position.z)), blink);
|
||||
|
||||
lcd_moveto(LCD_WIDTH - 9, 1);
|
||||
_draw_axis_value(I_AXIS, ftostr52sp(LOGICAL_I_POSITION(current_position.i)), blink);
|
||||
_draw_axis_value(I_AXIS, ftostr52sp(motion.logical_i(motion.position.i)), blink);
|
||||
|
||||
// ========== Line 3 ==========
|
||||
lcd_moveto(0, 2);
|
||||
|
|
@ -1521,9 +1521,9 @@ void MarlinUI::draw_status_screen() {
|
|||
* Show X and Y positions
|
||||
*/
|
||||
_XLABEL(_PLOT_X, 0);
|
||||
lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(bedlevel.get_mesh_x(x_plot))));
|
||||
lcd_put_u8str(ftostr52(motion.logical_x(bedlevel.get_mesh_x(x_plot))));
|
||||
_YLABEL(_LCD_W_POS, 0);
|
||||
lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(bedlevel.get_mesh_y(y_plot))));
|
||||
lcd_put_u8str(ftostr52(motion.logical_y(bedlevel.get_mesh_y(y_plot))));
|
||||
|
||||
lcd_moveto(_PLOT_X, 0);
|
||||
|
||||
|
|
@ -1726,9 +1726,9 @@ void MarlinUI::draw_status_screen() {
|
|||
* Show all values at right of screen
|
||||
*/
|
||||
_XLABEL(_LCD_W_POS, 1);
|
||||
lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(bedlevel.get_mesh_x(x_plot))));
|
||||
lcd_put_u8str(ftostr52(motion.logical_x(bedlevel.get_mesh_x(x_plot))));
|
||||
_YLABEL(_LCD_W_POS, 2);
|
||||
lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(bedlevel.get_mesh_y(y_plot))));
|
||||
lcd_put_u8str(ftostr52(motion.logical_y(bedlevel.get_mesh_y(y_plot))));
|
||||
|
||||
/**
|
||||
* Show the location value
|
||||
|
|
|
|||
|
|
@ -429,9 +429,9 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
|||
lcd.write('X' + uint8_t(axis));
|
||||
if (blink)
|
||||
lcd.print(value);
|
||||
else if (axis_should_home(axis))
|
||||
else if (motion.axis_should_home(axis))
|
||||
while (const char c = *value++) lcd.write(c <= '.' ? c : '?');
|
||||
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
|
||||
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !motion.axis_is_trusted(axis))
|
||||
lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" "));
|
||||
else
|
||||
lcd_put_u8str(value);
|
||||
|
|
@ -816,7 +816,7 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
#if NUM_AXES
|
||||
lcd_moveto(0, 0);
|
||||
const xyz_pos_t lpos = current_position.asLogical();
|
||||
const xyz_pos_t lpos = motion.position.asLogical();
|
||||
_draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink);
|
||||
#if HAS_Y_AXIS
|
||||
lcd.write(' '); _draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink);
|
||||
|
|
@ -835,7 +835,7 @@ void MarlinUI::draw_status_screen() {
|
|||
//
|
||||
|
||||
lcd_moveto(0, 1);
|
||||
lcd_put_u8str(F("FR")); lcd.print(i16tostr3rj(feedrate_percentage)); lcd.write('%');
|
||||
lcd_put_u8str(F("FR")); lcd.print(i16tostr3rj(motion.feedrate_percentage)); lcd.write('%');
|
||||
ui.rotate_progress(); // UNTESTED!!!
|
||||
|
||||
//
|
||||
|
|
@ -1126,9 +1126,9 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
// Show all values
|
||||
lcd_moveto(_LCD_W_POS, 1); lcd_put_u8str(F("X:"));
|
||||
lcd.print(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&bedlevel._mesh_index_to_xpos[x_plot]))));
|
||||
lcd.print(ftostr52(motion.logical_x(pgm_read_float(&bedlevel._mesh_index_to_xpos[x_plot]))));
|
||||
lcd_moveto(_LCD_W_POS, 2); lcd_put_u8str(F("Y:"));
|
||||
lcd.print(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&bedlevel._mesh_index_to_ypos[y_plot]))));
|
||||
lcd.print(ftostr52(motion.logical_y(pgm_read_float(&bedlevel._mesh_index_to_ypos[y_plot]))));
|
||||
|
||||
// Show the location value
|
||||
lcd_moveto(_LCD_W_POS, 3); lcd_put_u8str(F("Z:"));
|
||||
|
|
|
|||
|
|
@ -311,20 +311,20 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co
|
|||
const bool draw_partial = isHeat && tall < BAR_TALL;
|
||||
if (draw_partial) {
|
||||
const uint8_t ph = STATUS_HEATERS_HEIGHT - 1 - tall;
|
||||
u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, ph, HOTEND_BITMAP(TERN(HAS_MMU, active_extruder, heater_id), false));
|
||||
u8g.drawBitmapP(hx, STATUS_HEATERS_Y + ph, bw, tall + 1, HOTEND_BITMAP(TERN(HAS_MMU, active_extruder, heater_id), true) + ph * bw);
|
||||
u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, ph, HOTEND_BITMAP(TERN(HAS_MMU, motion.extruder, heater_id), false));
|
||||
u8g.drawBitmapP(hx, STATUS_HEATERS_Y + ph, bw, tall + 1, HOTEND_BITMAP(TERN(HAS_MMU, motion.extruder, heater_id), true) + ph * bw);
|
||||
}
|
||||
#else
|
||||
constexpr bool draw_partial = false;
|
||||
#endif
|
||||
|
||||
if (!draw_partial)
|
||||
u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, STATUS_HEATERS_HEIGHT, HOTEND_BITMAP(TERN(HAS_MMU, active_extruder, heater_id), isHeat));
|
||||
u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, STATUS_HEATERS_HEIGHT, HOTEND_BITMAP(TERN(HAS_MMU, motion.extruder, heater_id), isHeat));
|
||||
|
||||
} // PAGE_CONTAINS
|
||||
|
||||
#if HAS_MULTI_EXTRUDER && NONE(SLIM_LCD_MENUS, STATUS_HOTEND_NUMBERLESS, SINGLENOZZLE)
|
||||
if (active_extruder == heater_id)
|
||||
if (motion.extruder == heater_id)
|
||||
u8g.drawBitmapP(_MAX(0, STATUS_HOTEND_X(heater_id) - 6), STATUS_HEATERS_Y + 3, 1, 5, status_active_extruder_indicator_bmp);
|
||||
#endif
|
||||
|
||||
|
|
@ -472,9 +472,9 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
|||
|
||||
if (blink)
|
||||
lcd_put_u8str(value);
|
||||
else if (axis_should_home(axis))
|
||||
else if (motion.axis_should_home(axis))
|
||||
while (const char c = *value++) lcd_put_lchar(c <= '.' ? c : '?');
|
||||
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
|
||||
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !motion.axis_is_trusted(axis))
|
||||
lcd_put_u8str(TERN0(HAS_Z_AXIS, axis == Z_AXIS) ? F(" ") : F(" "));
|
||||
else
|
||||
lcd_put_u8str(value);
|
||||
|
|
@ -573,14 +573,14 @@ void MarlinUI::draw_status_screen() {
|
|||
#endif
|
||||
|
||||
#if NUM_AXES
|
||||
const xyz_pos_t lpos = current_position.asLogical();
|
||||
const xyz_pos_t lpos = motion.position.asLogical();
|
||||
const bool is_inch = parser.using_inch_units();
|
||||
#endif
|
||||
|
||||
if (show_e_total) {
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
||||
sprintf_P(xstring, PSTR("%ld%cm"), uint32_t(_MAX(e_move_accumulator, 0.0f)) / escale, escale == 10 ? 'c' : 'm'); // 1234567mm
|
||||
const uint8_t escale = motion.e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
||||
sprintf_P(xstring, PSTR("%" PRIu32 "%cm"), uint32_t(_MAX(motion.e_move_accumulator, 0.0f)) / escale, escale == 10 ? 'c' : 'm'); // 1234567mm
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
|
|
@ -898,9 +898,9 @@ void MarlinUI::draw_status_screen() {
|
|||
set_font(FONT_STATUSMENU);
|
||||
|
||||
#if ENABLED(ULTIPANEL_FLOWPERCENT)
|
||||
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(planner.flow_percentage[active_extruder]));
|
||||
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(planner.flow_percentage[motion.extruder]));
|
||||
#else
|
||||
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage));
|
||||
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(motion.feedrate_percentage));
|
||||
#endif
|
||||
lcd_put_u8str(F("%"));
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue