update code base to Marlin 2.0.9.2

This commit is contained in:
Stefan Kalscheuer
2021-10-03 18:57:12 +02:00
parent b9d7ba838e
commit 7077da3591
2617 changed files with 332093 additions and 103438 deletions

64
Marlin/src/gcode/sd/M1001.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
@@ -25,10 +25,16 @@
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../module/planner.h"
#include "../../module/printcounter.h"
#include "../../sd/cardreader.h"
#ifdef SD_FINISHED_RELEASECOMMAND
#include "../queue.h"
#endif
#if EITHER(LCD_SET_PROGRESS_MANUALLY, SD_REPRINT_LAST_SELECTED_FILE)
#include "../../lcd/ultralcd.h"
#include "../../lcd/marlinui.h"
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
@@ -36,21 +42,20 @@
#endif
#if HAS_LEDS_OFF_FLAG
#include "../../MarlinCore.h" // for wait_for_user_response()
#include "../../feature/leds/printer_event_leds.h"
#endif
#if ENABLED(EXTENSIBLE_UI)
#include "../../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../lcd/e3v2/enhanced/dwin.h"
#endif
#if ENABLED(HOST_ACTION_COMMANDS)
#include "../../feature/host_actions.h"
#endif
#if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND)
#include "../../module/planner.h"
#endif
#ifndef PE_LEDS_COMPLETED_TIME
#define PE_LEDS_COMPLETED_TIME (30*60)
#endif
@@ -59,6 +64,16 @@
* M1001: Execute actions for SD print completion
*/
void GcodeSuite::M1001() {
planner.synchronize();
// SD Printing is finished when the queue reaches M1001
card.flag.sdprinting = card.flag.sdprintdone = false;
// If there's another auto#.g file to run...
if (TERN(NO_SD_AUTOSTART, false, card.autofile_check())) return;
// Purge the recovery file...
TERN_(POWER_LOSS_RECOVERY, recovery.purge());
// Report total print time
const bool long_print = print_job_timer.duration() > 60;
@@ -68,42 +83,35 @@ void GcodeSuite::M1001() {
gcode.process_subcommands_now_P(PSTR("M77"));
// Set the progress bar "done" state
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
ui.set_progress_done();
#endif
// Purge the recovery file
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.purge();
#endif
TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress_done());
// Announce SD file completion
SERIAL_ECHOLNPGM(STR_FILE_PRINTED);
{
PORT_REDIRECT(SerialMask::All);
SERIAL_ECHOLNPGM(STR_FILE_PRINTED);
}
// Update the status LED color
#if HAS_LEDS_OFF_FLAG
if (long_print) {
printerEventLEDs.onPrintCompleted();
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE));
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_PRINT_DONE), CONTINUE_STR);
#endif
wait_for_user_response(1000UL * TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE)));
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_PRINT_DONE), CONTINUE_STR));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(SEC_TO_MS(TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30))));
printerEventLEDs.onResumeAfterWait();
}
#endif
// Wait for the queue to empty (and "clean"), inject SD_FINISHED_RELEASECOMMAND
#if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND)
planner.finish_and_disable();
// Inject SD_FINISHED_RELEASECOMMAND, if any
#ifdef SD_FINISHED_RELEASECOMMAND
gcode.process_subcommands_now_P(PSTR(SD_FINISHED_RELEASECOMMAND));
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onPrintFinished());
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Print_Finished());
// Re-select the last printed file in the UI
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
ui.reselect_last_file();
#endif
TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());
}
#endif // SDSUPPORT

12
Marlin/src/gcode/sd/M20.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
@@ -31,9 +31,13 @@
* M20: List SD card to serial output
*/
void GcodeSuite::M20() {
SERIAL_ECHOLNPGM(STR_BEGIN_FILE_LIST);
card.ls();
SERIAL_ECHOLNPGM(STR_END_FILE_LIST);
if (card.flag.mounted) {
SERIAL_ECHOLNPGM(STR_BEGIN_FILE_LIST);
card.ls(TERN_(LONG_FILENAME_HOST_SUPPORT, parser.boolval('L')));
SERIAL_ECHOLNPGM(STR_END_FILE_LIST);
}
else
SERIAL_ECHO_MSG(STR_NO_MEDIA);
}
#endif // SDSUPPORT

8
Marlin/src/gcode/sd/M21_M22.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
@@ -26,6 +26,7 @@
#include "../gcode.h"
#include "../../sd/cardreader.h"
#include "../../lcd/marlinui.h"
/**
* M21: Init SD Card
@@ -35,6 +36,9 @@ void GcodeSuite::M21() { card.mount(); }
/**
* M22: Release SD Card
*/
void GcodeSuite::M22() { card.release(); }
void GcodeSuite::M22() {
if (!IS_SD_PRINTING()) card.release();
IF_ENABLED(TFT_COLOR_UI, ui.refresh(LCDVIEW_CALL_REDRAW_NEXT));
}
#endif // SDSUPPORT

8
Marlin/src/gcode/sd/M23.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
@@ -26,7 +26,7 @@
#include "../gcode.h"
#include "../../sd/cardreader.h"
#include "../../lcd/ultralcd.h"
#include "../../lcd/marlinui.h"
/**
* M23: Open a file
@@ -38,9 +38,7 @@ void GcodeSuite::M23() {
for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
card.openFileRead(parser.string_arg);
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
ui.set_progress(0);
#endif
TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(0));
}
#endif // SDSUPPORT

49
Marlin/src/gcode/sd/M24_M25.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
@@ -27,11 +27,10 @@
#include "../gcode.h"
#include "../../sd/cardreader.h"
#include "../../module/printcounter.h"
#include "../../lcd/ultralcd.h"
#include "../../lcd/marlinui.h"
#if ENABLED(PARK_HEAD_ON_PAUSE)
#include "../../feature/pause.h"
#include "../queue.h"
#endif
#if ENABLED(HOST_ACTION_COMMANDS)
@@ -42,6 +41,10 @@
#include "../../feature/powerloss.h"
#endif
#if ENABLED(DGUS_LCD_UI_MKS)
#include "../../lcd/extui/dgus/DGUSDisplayDef.h"
#endif
#include "../../MarlinCore.h" // for startOrResumeJob
/**
@@ -49,6 +52,11 @@
*/
void GcodeSuite::M24() {
#if ENABLED(DGUS_LCD_UI_MKS)
if ((print_job_timer.isPaused() || print_job_timer.isRunning()) && !parser.seen("ST"))
MKS_resume_print_move();
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
if (parser.seenval('S')) card.setIndex(parser.value_long());
if (parser.seenval('T')) print_job_timer.resume(parser.value_long());
@@ -62,20 +70,16 @@ void GcodeSuite::M24() {
#endif
if (card.isFileOpen()) {
card.startFileprint(); // SD card will now be read for commands
card.startOrResumeFilePrinting(); // SD card will now be read for commands
startOrResumeJob(); // Start (or resume) the print job timer
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.prepare();
#endif
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
}
#if ENABLED(HOST_ACTION_COMMANDS)
#ifdef ACTION_ON_RESUME
host_action_resume();
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_open(PROMPT_INFO, PSTR("Resuming SD"), DISMISS_STR);
#endif
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("Resuming SD"), DISMISS_STR));
#endif
ui.reset_status();
@@ -83,31 +87,36 @@ void GcodeSuite::M24() {
/**
* M25: Pause SD Print
*
* With PARK_HEAD_ON_PAUSE:
* Invoke M125 to store the current position and move to the park
* position. M24 will move the head back before resuming the print.
*/
void GcodeSuite::M25() {
// Set initial pause flag to prevent more commands from landing in the queue while we try to pause
#if ENABLED(SDSUPPORT)
if (IS_SD_PRINTING()) card.pauseSDPrint();
#endif
#if ENABLED(PARK_HEAD_ON_PAUSE)
M125();
#else
#if ENABLED(POWER_LOSS_RECOVERY)
// Set initial pause flag to prevent more commands from landing in the queue while we try to pause
#if ENABLED(SDSUPPORT)
if (IS_SD_PRINTING()) card.pauseSDPrint();
#endif
#if ENABLED(POWER_LOSS_RECOVERY) && DISABLED(DGUS_LCD_UI_MKS)
if (recovery.enabled) recovery.save(true);
#endif
print_job_timer.pause();
ui.reset_status();
TERN_(DGUS_LCD_UI_MKS, MKS_pause_print_move());
IF_DISABLED(DWIN_CREALITY_LCD, ui.reset_status());
#if ENABLED(HOST_ACTION_COMMANDS)
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume"));
#endif
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume")));
#ifdef ACTION_ON_PAUSE
host_action_pause();
#endif

2
Marlin/src/gcode/sd/M26.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/

16
Marlin/src/gcode/sd/M27.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
@@ -33,18 +33,20 @@
* OR, with 'C' get the current filename.
*/
void GcodeSuite::M27() {
if (parser.seen('C')) {
if (parser.seen_test('C')) {
SERIAL_ECHOPGM("Current file: ");
card.printFilename();
card.printSelectedFilename();
return;
}
#if ENABLED(AUTO_REPORT_SD_STATUS)
else if (parser.seenval('S'))
card.set_auto_report_interval(parser.value_byte());
if (parser.seenval('S')) {
card.auto_reporter.set_interval(parser.value_byte());
return;
}
#endif
else
card.report_status();
card.report_status();
}
#endif // SDSUPPORT

8
Marlin/src/gcode/sd/M28_M29.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
@@ -27,7 +27,7 @@
#include "../gcode.h"
#include "../../sd/cardreader.h"
#if NUM_SERIAL > 1
#if HAS_MULTI_SERIAL
#include "../queue.h"
#endif
@@ -49,9 +49,7 @@ void GcodeSuite::M28() {
// Binary transfer mode
if ((card.flag.binary_mode = binary_mode)) {
SERIAL_ECHO_MSG("Switching to Binary Protocol");
#if NUM_SERIAL > 1
card.transfer_port_index = queue.port[queue.index_r];
#endif
TERN_(HAS_MULTI_SERIAL, card.transfer_port_index = queue.ring_buffer.command_port().index);
}
else
card.openFileWrite(p);

2
Marlin/src/gcode/sd/M30.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/

9
Marlin/src/gcode/sd/M32.cpp Executable file → Normal file
View File

@@ -16,13 +16,13 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#if HAS_MEDIA_SUBCALLS
#include "../gcode.h"
#include "../../sd/cardreader.h"
@@ -38,7 +38,6 @@
* M32 !PATH/TO/FILE.GCO# ; Start FILE.GCO
* M32 P !PATH/TO/FILE.GCO# ; Start FILE.GCO as a procedure
* M32 S60 !PATH/TO/FILE.GCO# ; Start FILE.GCO at byte 60
*
*/
void GcodeSuite::M32() {
if (IS_SD_PRINTING()) planner.synchronize();
@@ -50,11 +49,11 @@ void GcodeSuite::M32() {
if (parser.seenval('S')) card.setIndex(parser.value_long());
card.startFileprint();
card.startOrResumeFilePrinting();
// Procedure calls count as normal print time.
if (!call_procedure) startOrResumeJob();
}
}
#endif // SDSUPPORT
#endif // HAS_MEDIA_SUBCALLS

2
Marlin/src/gcode/sd/M33.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/

2
Marlin/src/gcode/sd/M34.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/

6
Marlin/src/gcode/sd/M524.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
@@ -33,7 +33,9 @@
void GcodeSuite::M524() {
if (IS_SD_PRINTING())
card.flag.abort_sd_printing = true;
card.abortFilePrintSoon();
else if (card.isMounted())
card.closefile();
}

View File

@@ -0,0 +1,51 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(GCODE_REPEAT_MARKERS)
#include "../gcode.h"
#include "../../feature/repeat.h"
/**
* M808: Set / Goto a repeat marker
*
* L<count> - Set a repeat marker with 'count' repetitions. If omitted, infinity.
*
* Examples:
*
* M808 L ; Set a loop marker with a count of infinity
* M808 L2 ; Set a loop marker with a count of 2
* M808 ; Decrement and loop if not zero.
*/
void GcodeSuite::M808() {
// Handled early and ignored here in the queue.
// Allowed to go into the queue for logging purposes.
// M808 K sent from the host to cancel all loops
if (parser.seen_test('K')) repeat.cancel();
}
#endif // GCODE_REPEAT_MARKERS

2
Marlin/src/gcode/sd/M928.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/