Fix issues

Check printer limits
Fix crash when pausing / paused
This commit is contained in:
3d-gussner 2023-11-08 16:05:24 +01:00
parent 43692b416b
commit 4dc87acf20
1 changed files with 36 additions and 14 deletions

View File

@ -558,8 +558,8 @@ void crashdet_stop_and_save_print()
void crashdet_restore_print_and_continue() void crashdet_restore_print_and_continue()
{ {
restore_print_from_ram_and_continue(default_retraction); //XYZ = orig, E +1mm unretract restore_print_from_ram_and_continue(default_retraction); //XYZ = orig, E +1mm unretract
// babystep_apply(); //babystep_apply();
} }
void crashdet_fmt_error(char* buf, uint8_t mask) void crashdet_fmt_error(char* buf, uint8_t mask)
@ -633,8 +633,8 @@ void crashdet_detected(uint8_t mask)
void crashdet_recover() void crashdet_recover()
{ {
crashdet_restore_print_and_continue(); if (!isPrintPaused) crashdet_restore_print_and_continue();
if (lcd_crash_detect_enabled()) tmc2130_sg_stop_on_crash = true; if (lcd_crash_detect_enabled()) tmc2130_sg_stop_on_crash = true;
} }
void crashdet_cancel() void crashdet_cancel()
@ -7696,7 +7696,7 @@ Sigma_Exit:
- `X` - X position to park at (otherwise X_PAUSE_POS 50) these are saved until change or reset. - `X` - X position to park at (otherwise X_PAUSE_POS 50) these are saved until change or reset.
- `Y` - Y position to park at (otherwise Y_PAUSE_POS 190 these are saved until change or reset. - `Y` - Y position to park at (otherwise Y_PAUSE_POS 190 these are saved until change or reset.
- `Z` - Z raise before park (otherwise Z_PAUSE_LIFT 20) these are saved until change or reset. - `Z` - Z raise before park (otherwise Z_PAUSE_LIFT 20) these are saved until change or reset.
- `S` - Set values [S0 = set to default values | S1 = sset values only without pausing] - `S` - Set values [S0 = set to default values | S1 = set values only without pausing]
*/ */
/*! /*!
### M25 - Pause SD print <a href="https://reprap.org/wiki/G-code#M25:_Pause_SD_print">M25: Pause SD print</a> ### M25 - Pause SD print <a href="https://reprap.org/wiki/G-code#M25:_Pause_SD_print">M25: Pause SD print</a>
@ -7705,18 +7705,40 @@ Sigma_Exit:
case 125: case 125:
case 601: case 601:
{ {
if (code_seen('X')) pause_position[1] = code_value(); if (code_seen('X')) {
if (code_seen('Y')) pause_position[2] = code_value(); //Check that the X pause position is within printer limits
if (code_seen('Z')) pause_position[3] = code_value(); if ((code_value() >= X_MIN_POS) && (code_value() <= X_MAX_POS-1)) {
pause_position[X_AXIS] = code_value();
} else pause_position[X_AXIS] = X_PAUSE_POS;
}
if (code_seen('Y')) {
//Check that the Y pause position is within printer limits
if ((code_value() >= Y_MIN_POS) && (code_value() <= Y_MAX_POS-1)) {
pause_position[Y_AXIS] = code_value();
} else pause_position[Y_AXIS] = Y_PAUSE_POS;
}
if (code_seen('Z')) {
//Check that the Z pause lift is within printer limits
if (code_value() <=Z_MAX_POS) {
pause_position[Z_AXIS] = code_value();
} else pause_position[Z_AXIS] = Z_PAUSE_LIFT;
}
if (code_seen('S')) { if (code_seen('S')) {
if ( code_value_uint8() == 0 ) { if ( code_value_uint8() == 0 ) {
pause_position[1] = X_PAUSE_POS; pause_position[X_AXIS] = X_PAUSE_POS;
pause_position[2] = Y_PAUSE_POS; pause_position[Y_AXIS] = Y_PAUSE_POS;
pause_position[3] = Z_PAUSE_LIFT; pause_position[Z_AXIS] = Z_PAUSE_LIFT;
} else { } else {
break; break;
} }
} }
/* SERIAL_ECHOPGM("X:");
SERIAL_ECHOLN(pause_position[X_AXIS]);
SERIAL_ECHOPGM("Y:");
SERIAL_ECHOLN(pause_position[Y_AXIS]);
SERIAL_ECHOPGM("Z:");
SERIAL_ECHOLN(pause_position[Z_AXIS]);
*/
if (!isPrintPaused) { if (!isPrintPaused) {
st_synchronize(); st_synchronize();
ClearToSend(); //send OK even before the command finishes executing because we want to make sure it is not skipped because of cmdqueue_pop_front(); ClearToSend(); //send OK even before the command finishes executing because we want to make sure it is not skipped because of cmdqueue_pop_front();
@ -10441,12 +10463,12 @@ void long_pause() //long pause print
setTargetHotend(0); setTargetHotend(0);
// Lift z // Lift z
raise_z(pause_position[3]); raise_z(pause_position[Z_AXIS]);
// Move XY to side // Move XY to side
if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) { if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) {
current_position[X_AXIS] = pause_position[1]; current_position[X_AXIS] = pause_position[X_AXIS];
current_position[Y_AXIS] = pause_position[2]; current_position[Y_AXIS] = pause_position[Y_AXIS];
plan_buffer_line_curposXYZE(50); plan_buffer_line_curposXYZE(50);
} }