My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

M1001.cpp 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../inc/MarlinConfig.h"
  23. #if ENABLED(SDSUPPORT)
  24. #include "../gcode.h"
  25. #include "../../module/planner.h"
  26. #include "../../module/printcounter.h"
  27. #if DISABLED(NO_SD_AUTOSTART)
  28. #include "../../sd/cardreader.h"
  29. #endif
  30. #ifdef SD_FINISHED_RELEASECOMMAND
  31. #include "../queue.h"
  32. #endif
  33. #if EITHER(LCD_SET_PROGRESS_MANUALLY, SD_REPRINT_LAST_SELECTED_FILE)
  34. #include "../../lcd/marlinui.h"
  35. #endif
  36. #if ENABLED(POWER_LOSS_RECOVERY)
  37. #include "../../feature/powerloss.h"
  38. #endif
  39. #if HAS_LEDS_OFF_FLAG
  40. #include "../../MarlinCore.h" // for wait_for_user_response()
  41. #include "../../feature/leds/printer_event_leds.h"
  42. #endif
  43. #if ENABLED(EXTENSIBLE_UI)
  44. #include "../../lcd/extui/ui_api.h"
  45. #endif
  46. #if ENABLED(HOST_ACTION_COMMANDS)
  47. #include "../../feature/host_actions.h"
  48. #endif
  49. #ifndef PE_LEDS_COMPLETED_TIME
  50. #define PE_LEDS_COMPLETED_TIME (30*60)
  51. #endif
  52. /**
  53. * M1001: Execute actions for SD print completion
  54. */
  55. void GcodeSuite::M1001() {
  56. planner.synchronize();
  57. // SD Printing is finished when the queue reaches M1001
  58. card.flag.sdprinting = card.flag.sdprintdone = false;
  59. // If there's another auto#.g file to run...
  60. if (TERN(NO_SD_AUTOSTART, false, card.autofile_check())) return;
  61. // Purge the recovery file...
  62. TERN_(POWER_LOSS_RECOVERY, recovery.purge());
  63. // Report total print time
  64. const bool long_print = print_job_timer.duration() > 60;
  65. if (long_print) gcode.process_subcommands_now_P(PSTR("M31"));
  66. // Stop the print job timer
  67. gcode.process_subcommands_now_P(PSTR("M77"));
  68. // Set the progress bar "done" state
  69. TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress_done());
  70. // Announce SD file completion
  71. {
  72. PORT_REDIRECT(SerialMask::All);
  73. SERIAL_ECHOLNPGM(STR_FILE_PRINTED);
  74. }
  75. // Update the status LED color
  76. #if HAS_LEDS_OFF_FLAG
  77. if (long_print) {
  78. printerEventLEDs.onPrintCompleted();
  79. TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE)));
  80. TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_PRINT_DONE), CONTINUE_STR));
  81. wait_for_user_response(SEC_TO_MS(TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30)));
  82. printerEventLEDs.onResumeAfterWait();
  83. }
  84. #endif
  85. // Inject SD_FINISHED_RELEASECOMMAND, if any
  86. #ifdef SD_FINISHED_RELEASECOMMAND
  87. gcode.process_subcommands_now_P(PSTR(SD_FINISHED_RELEASECOMMAND));
  88. #endif
  89. TERN_(EXTENSIBLE_UI, ExtUI::onPrintFinished());
  90. // Re-select the last printed file in the UI
  91. TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());
  92. }
  93. #endif // SDSUPPORT