My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

M24_M25.cpp 2.9KB

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