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.

M24_M25.cpp 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../inc/MarlinConfig.h"
  23. #if ENABLED(SDSUPPORT)
  24. #include "../gcode.h"
  25. #include "../../sd/cardreader.h"
  26. #include "../../module/printcounter.h"
  27. #include "../../lcd/ultralcd.h"
  28. #if ENABLED(PARK_HEAD_ON_PAUSE)
  29. #include "../../feature/pause.h"
  30. #include "../queue.h"
  31. #endif
  32. #if ENABLED(HOST_ACTION_COMMANDS)
  33. #include "../../feature/host_actions.h"
  34. #endif
  35. #if ENABLED(POWER_LOSS_RECOVERY)
  36. #include "../../feature/powerloss.h"
  37. #endif
  38. #include "../../MarlinCore.h" // for startOrResumeJob
  39. /**
  40. * M24: Start or Resume SD Print
  41. */
  42. void GcodeSuite::M24() {
  43. #if ENABLED(POWER_LOSS_RECOVERY)
  44. if (parser.seenval('S')) card.setIndex(parser.value_long());
  45. if (parser.seenval('T')) print_job_timer.resume(parser.value_long());
  46. #endif
  47. #if ENABLED(PARK_HEAD_ON_PAUSE)
  48. if (did_pause_print) {
  49. resume_print(); // will call print_job_timer.start()
  50. return;
  51. }
  52. #endif
  53. if (card.isFileOpen()) {
  54. card.startFileprint(); // SD card will now be read for commands
  55. startOrResumeJob(); // Start (or resume) the print job timer
  56. TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
  57. }
  58. #if ENABLED(HOST_ACTION_COMMANDS)
  59. #ifdef ACTION_ON_RESUME
  60. host_action_resume();
  61. #endif
  62. TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("Resuming SD"), DISMISS_STR));
  63. #endif
  64. ui.reset_status();
  65. }
  66. /**
  67. * M25: Pause SD Print
  68. */
  69. void GcodeSuite::M25() {
  70. // Set initial pause flag to prevent more commands from landing in the queue while we try to pause
  71. #if ENABLED(SDSUPPORT)
  72. if (IS_SD_PRINTING()) card.pauseSDPrint();
  73. #endif
  74. #if ENABLED(PARK_HEAD_ON_PAUSE)
  75. M125();
  76. #else
  77. #if ENABLED(POWER_LOSS_RECOVERY)
  78. if (recovery.enabled) recovery.save(true);
  79. #endif
  80. print_job_timer.pause();
  81. ui.reset_status();
  82. #if ENABLED(HOST_ACTION_COMMANDS)
  83. TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume")));
  84. #ifdef ACTION_ON_PAUSE
  85. host_action_pause();
  86. #endif
  87. #endif
  88. #endif
  89. }
  90. #endif // SDSUPPORT