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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 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 HAS_RESUME_CONTINUE
  24. #include "../gcode.h"
  25. #include "../../module/stepper.h"
  26. #if HAS_LCD_MENU
  27. #include "../../lcd/ultralcd.h"
  28. #endif
  29. #include "../../sd/cardreader.h"
  30. #if HAS_LEDS_OFF_FLAG
  31. #include "../../feature/leds/printer_event_leds.h"
  32. #endif
  33. /**
  34. * M0: Unconditional stop - Wait for user button press on LCD
  35. * M1: Conditional stop - Wait for user button press on LCD
  36. */
  37. void GcodeSuite::M0_M1() {
  38. const char * const args = parser.string_arg;
  39. millis_t ms = 0;
  40. bool hasP = false, hasS = false;
  41. if (parser.seenval('P')) {
  42. ms = parser.value_millis(); // milliseconds to wait
  43. hasP = ms > 0;
  44. }
  45. if (parser.seenval('S')) {
  46. ms = parser.value_millis_from_seconds(); // seconds to wait
  47. hasS = ms > 0;
  48. }
  49. const bool has_message = !hasP && !hasS && args && *args;
  50. planner.synchronize();
  51. #if HAS_LCD_MENU
  52. if (has_message)
  53. ui.set_status(args, true);
  54. else {
  55. LCD_MESSAGEPGM(MSG_USERWAIT);
  56. #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
  57. ui.reset_progress_bar_timeout();
  58. #endif
  59. }
  60. #else
  61. if (has_message) {
  62. SERIAL_ECHO_START();
  63. SERIAL_ECHOLN(args);
  64. }
  65. #endif
  66. KEEPALIVE_STATE(PAUSED_FOR_USER);
  67. wait_for_user = true;
  68. if (ms > 0) {
  69. ms += millis(); // wait until this time for a click
  70. while (PENDING(millis(), ms) && wait_for_user) idle();
  71. }
  72. else
  73. while (wait_for_user) idle();
  74. #if HAS_LEDS_OFF_FLAG
  75. printerEventLEDs.onResumeAfterWait();
  76. #endif
  77. #if HAS_LCD_MENU
  78. ui.reset_status();
  79. #endif
  80. wait_for_user = false;
  81. KEEPALIVE_STATE(IN_HANDLER);
  82. }
  83. #endif // HAS_RESUME_CONTINUE