My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

M24_M25.cpp 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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/power_loss_recovery.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. #if ENABLED(POWER_LOSS_RECOVERY)
  57. recovery.prepare();
  58. #endif
  59. }
  60. #if ENABLED(HOST_ACTION_COMMANDS)
  61. #ifdef ACTION_ON_RESUME
  62. host_action_resume();
  63. #endif
  64. #if ENABLED(HOST_PROMPT_SUPPORT)
  65. host_prompt_open(PROMPT_INFO, PSTR("Resuming SD"), DISMISS_STR);
  66. #endif
  67. #endif
  68. ui.reset_status();
  69. }
  70. /**
  71. * M25: Pause SD Print
  72. */
  73. void GcodeSuite::M25() {
  74. // Set initial pause flag to prevent more commands from landing in the queue while we try to pause
  75. #if ENABLED(SDSUPPORT)
  76. if (IS_SD_PRINTING()) card.pauseSDPrint();
  77. #endif
  78. #if ENABLED(PARK_HEAD_ON_PAUSE)
  79. M125();
  80. #else
  81. #if ENABLED(POWER_LOSS_RECOVERY)
  82. if (recovery.enabled) recovery.save(true);
  83. #endif
  84. print_job_timer.pause();
  85. ui.reset_status();
  86. #if ENABLED(HOST_ACTION_COMMANDS)
  87. #if ENABLED(HOST_PROMPT_SUPPORT)
  88. host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume"));
  89. #endif
  90. #ifdef ACTION_ON_PAUSE
  91. host_action_pause();
  92. #endif
  93. #endif
  94. #endif
  95. }
  96. #endif // SDSUPPORT