My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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/printcounter.h"
  26. #if DISABLED(NO_SD_AUTOSTART)
  27. #include "../../sd/cardreader.h"
  28. #endif
  29. #ifdef SD_FINISHED_RELEASECOMMAND
  30. #include "../queue.h"
  31. #endif
  32. #if EITHER(LCD_SET_PROGRESS_MANUALLY, SD_REPRINT_LAST_SELECTED_FILE)
  33. #include "../../lcd/marlinui.h"
  34. #endif
  35. #if ENABLED(POWER_LOSS_RECOVERY)
  36. #include "../../feature/powerloss.h"
  37. #endif
  38. #if HAS_LEDS_OFF_FLAG
  39. #include "../../MarlinCore.h" // for wait_for_user_response()
  40. #include "../../feature/leds/printer_event_leds.h"
  41. #endif
  42. #if ENABLED(EXTENSIBLE_UI)
  43. #include "../../lcd/extui/ui_api.h"
  44. #endif
  45. #if ENABLED(HOST_ACTION_COMMANDS)
  46. #include "../../feature/host_actions.h"
  47. #endif
  48. #ifndef PE_LEDS_COMPLETED_TIME
  49. #define PE_LEDS_COMPLETED_TIME (30*60)
  50. #endif
  51. /**
  52. * M1001: Execute actions for SD print completion
  53. */
  54. void GcodeSuite::M1001() {
  55. // If there's another auto#.g file to run...
  56. if (TERN(NO_SD_AUTOSTART, false, card.autofile_check())) return;
  57. // Purge the recovery file...
  58. TERN_(POWER_LOSS_RECOVERY, recovery.purge());
  59. // Report total print time
  60. const bool long_print = print_job_timer.duration() > 60;
  61. if (long_print) gcode.process_subcommands_now_P(PSTR("M31"));
  62. // Stop the print job timer
  63. gcode.process_subcommands_now_P(PSTR("M77"));
  64. // Set the progress bar "done" state
  65. TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress_done());
  66. // Announce SD file completion
  67. {
  68. PORT_REDIRECT(SERIAL_ALL);
  69. SERIAL_ECHOLNPGM(STR_FILE_PRINTED);
  70. }
  71. // Update the status LED color
  72. #if HAS_LEDS_OFF_FLAG
  73. if (long_print) {
  74. printerEventLEDs.onPrintCompleted();
  75. TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE)));
  76. TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_PRINT_DONE), CONTINUE_STR));
  77. wait_for_user_response(1000UL * TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30));
  78. printerEventLEDs.onResumeAfterWait();
  79. }
  80. #endif
  81. // Inject SD_FINISHED_RELEASECOMMAND, if any
  82. #ifdef SD_FINISHED_RELEASECOMMAND
  83. gcode.process_subcommands_now_P(PSTR(SD_FINISHED_RELEASECOMMAND));
  84. #endif
  85. TERN_(EXTENSIBLE_UI, ExtUI::onPrintFinished());
  86. // Re-select the last printed file in the UI
  87. TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());
  88. }
  89. #endif // SDSUPPORT