Browse Source

Add M524 to abort SD printing (#12155)

pull/1/head
TheSFReader 6 years ago
committed by Scott Lahteine
parent
commit
1fb9b299d4
  1. 9
      Marlin/src/Marlin.cpp
  2. 4
      Marlin/src/gcode/gcode.cpp
  3. 5
      Marlin/src/gcode/gcode.h
  4. 7
      Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp
  5. 6
      Marlin/src/lcd/extensible_ui/ui_api.cpp
  6. 4
      Marlin/src/lcd/ultralcd.cpp
  7. 5
      Marlin/src/lcd/ultralcd.h
  8. 2
      Marlin/src/sd/cardreader.cpp
  9. 2
      Marlin/src/sd/cardreader.h

9
Marlin/src/Marlin.cpp

@ -972,11 +972,8 @@ void loop() {
#if ENABLED(SDSUPPORT)
card.checkautostart();
#endif
#if ENABLED(SDSUPPORT) && (ENABLED(ULTIPANEL) || ENABLED(EXTENSIBLE_UI))
if (abort_sd_printing) {
abort_sd_printing = false;
if (card.abort_sd_printing) {
card.stopSDPrint(
#if SD_RESORT
true
@ -992,7 +989,7 @@ void loop() {
card.removeJobRecoveryFile();
#endif
}
#endif // SDSUPPORT && (ENABLED(ULTIPANEL) || ENABLED(EXTENSIBLE_UI))
#endif // SDSUPPORT
if (commands_in_queue < BUFSIZE) get_available_commands();
advance_command_queue();

4
Marlin/src/gcode/gcode.cpp

@ -584,6 +584,10 @@ void GcodeSuite::process_parsed_command(
case 504: M504(); break; // M504: Validate EEPROM contents
#endif
#if ENABLED(SDSUPPORT)
case 524: M524(); break; // M524: Abort the current SD print job
#endif
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
case 540: M540(); break; // M540: Set abort on endstop hit for SD printing
#endif

5
Marlin/src/gcode/gcode.h

@ -202,6 +202,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 the current SD print job (started with M24)
* 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)
@ -719,6 +720,10 @@ private:
static void M504();
#endif
#if ENABLED(SDSUPPORT)
static void M524();
#endif
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
static void M540();
#endif

7
Marlin/src/gcode/sdcard/M20-M30_M32-M34_M928.cpp → Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp

@ -244,6 +244,13 @@ void GcodeSuite::M32() {
#endif // SDCARD_SORT_ALPHA && SDSORT_GCODE
/**
* M524: Abort the current SD print job (started with M24)
*/
void GcodeSuite::M524() {
if (IS_SD_PRINTING()) card.abort_sd_printing = true;
}
/**
* M928: Start SD Write
*/

6
Marlin/src/lcd/extensible_ui/ui_api.cpp

@ -37,10 +37,6 @@
#if ENABLED(SDSUPPORT)
#include "../../sd/cardreader.h"
#include "../../feature/emergency_parser.h"
bool abort_sd_printing; // =false
#else
constexpr bool abort_sd_printing = false;
#endif
#if ENABLED(PRINTCOUNTER)
@ -476,7 +472,7 @@ namespace UI {
void stopPrint() {
#if ENABLED(SDSUPPORT)
wait_for_heatup = wait_for_user = false;
abort_sd_printing = true;
card.abort_sd_printing = true;
UI::onStatusChanged(PSTR(MSG_PRINT_ABORTED));
#endif
}

4
Marlin/src/lcd/ultralcd.cpp

@ -895,11 +895,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();
}

5
Marlin/src/lcd/ultralcd.h

@ -288,10 +288,5 @@
void lcd_reselect_last_file();
#endif
#if (ENABLED(EXTENSIBLE_UI) || ENABLED(ULTIPANEL)) && ENABLED(SDSUPPORT)
extern bool abort_sd_printing;
#else
constexpr bool abort_sd_printing = false;
#endif
#endif // ULTRALCD_H

2
Marlin/src/sd/cardreader.cpp

@ -351,7 +351,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();

2
Marlin/src/sd/cardreader.h

@ -149,7 +149,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:

Loading…
Cancel
Save