mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-26 05:17:17 +00:00
Add M524 to abort SD printing (#11386)
This commit is contained in:
parent
cee63a1688
commit
6110a54635
@ -206,6 +206,7 @@
|
||||
* M501 - Restore parameters from EEPROM. (Requires EEPROM_SETTINGS)
|
||||
* M502 - Revert to the default "factory settings". ** Does not write them to EEPROM! **
|
||||
* M503 - Print the current settings (in memory): "M503 S<verbose>". S0 specifies compact output.
|
||||
* M524 - Abort SD card print job started with M24 (Requires SDSUPPORT)
|
||||
* M540 - Enable/disable SD card abort on endstop hit: "M540 S<state>". (Requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
||||
* M600 - Pause for filament change: "M600 X<pos> Y<pos> Z<raise> E<first_retract> L<later_retract>". (Requires ADVANCED_PAUSE_FEATURE)
|
||||
* M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (Requires ADVANCED_PAUSE_FEATURE)
|
||||
@ -10838,6 +10839,17 @@ inline void gcode_M502() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
/**
|
||||
* M524: Abort the current SD print job (started with M24)
|
||||
*/
|
||||
inline void gcode_M524() {
|
||||
if (IS_SD_PRINTING()) card.abort_sd_printing = true;
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
||||
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
||||
|
||||
/**
|
||||
@ -13017,6 +13029,10 @@ void process_parsed_command() {
|
||||
case 504: gcode_M504(); break; // M504: Validate EEPROM
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
case 524: gcode_M524(); break; // M524: Abort SD print job
|
||||
#endif
|
||||
|
||||
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
||||
case 540: gcode_M540(); break; // M540: Set Abort on Endstop Hit for SD Printing
|
||||
#endif
|
||||
@ -15296,27 +15312,24 @@ void loop() {
|
||||
|
||||
card.checkautostart();
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
if (abort_sd_printing) {
|
||||
abort_sd_printing = false;
|
||||
card.stopSDPrint(
|
||||
#if SD_RESORT
|
||||
true
|
||||
#endif
|
||||
);
|
||||
clear_command_queue();
|
||||
quickstop_stepper();
|
||||
print_job_timer.stop();
|
||||
thermalManager.disable_all_heaters();
|
||||
#if FAN_COUNT > 0
|
||||
for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
|
||||
if (card.abort_sd_printing) {
|
||||
card.stopSDPrint(
|
||||
#if SD_RESORT
|
||||
true
|
||||
#endif
|
||||
wait_for_heatup = false;
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
card.removeJobRecoveryFile();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
);
|
||||
clear_command_queue();
|
||||
quickstop_stepper();
|
||||
print_job_timer.stop();
|
||||
thermalManager.disable_all_heaters();
|
||||
#if FAN_COUNT > 0
|
||||
for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
|
||||
#endif
|
||||
wait_for_heatup = false;
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
card.removeJobRecoveryFile();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
||||
|
@ -315,7 +315,7 @@ void CardReader::stopSDPrint(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
did_pause_print = 0;
|
||||
#endif
|
||||
sdprinting = false;
|
||||
sdprinting = abort_sd_printing = false;
|
||||
if (isFileOpen()) file.close();
|
||||
#if SD_RESORT
|
||||
if (re_sort) presort();
|
||||
|
@ -117,7 +117,7 @@ public:
|
||||
FORCE_INLINE char* longest_filename() { return longFilename[0] ? longFilename : filename; }
|
||||
|
||||
public:
|
||||
bool saving, logging, sdprinting, cardOK, filenameIsDir;
|
||||
bool saving, logging, sdprinting, cardOK, filenameIsDir, abort_sd_printing;
|
||||
char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH];
|
||||
int8_t autostart_index;
|
||||
private:
|
||||
|
@ -854,11 +854,9 @@ void lcd_quick_feedback(const bool clear_buttons) {
|
||||
lcd_reset_status();
|
||||
}
|
||||
|
||||
bool abort_sd_printing; // =false
|
||||
|
||||
void lcd_sdcard_stop() {
|
||||
wait_for_heatup = wait_for_user = false;
|
||||
abort_sd_printing = true;
|
||||
card.abort_sd_printing = true;
|
||||
lcd_setstatusPGM(PSTR(MSG_PRINT_ABORTED), -1);
|
||||
lcd_return_to_status();
|
||||
}
|
||||
|
@ -262,10 +262,4 @@
|
||||
void lcd_reselect_last_file();
|
||||
#endif
|
||||
|
||||
#if ENABLED(ULTIPANEL) && ENABLED(SDSUPPORT)
|
||||
extern bool abort_sd_printing;
|
||||
#else
|
||||
constexpr bool abort_sd_printing = false;
|
||||
#endif
|
||||
|
||||
#endif // ULTRALCD_H
|
||||
|
Loading…
Reference in New Issue
Block a user