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.

M0_M1.cpp 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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/MarlinConfigPre.h"
  23. #if HAS_RESUME_CONTINUE
  24. #include "../../inc/MarlinConfig.h"
  25. #include "../gcode.h"
  26. #include "../../module/planner.h" // for synchronize()
  27. #include "../../MarlinCore.h" // for wait_for_user_response()
  28. #if HAS_MARLINUI_MENU
  29. #include "../../lcd/marlinui.h"
  30. #elif ENABLED(EXTENSIBLE_UI)
  31. #include "../../lcd/extui/ui_api.h"
  32. #elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
  33. #include "../../lcd/e3v2/proui/dwin_popup.h"
  34. #include "../../lcd/e3v2/proui/dwin.h"
  35. #endif
  36. #if ENABLED(HOST_PROMPT_SUPPORT)
  37. #include "../../feature/host_actions.h"
  38. #endif
  39. /**
  40. * M0: Unconditional stop - Wait for user button press on LCD
  41. * M1: Conditional stop - Wait for user button press on LCD
  42. */
  43. void GcodeSuite::M0_M1() {
  44. millis_t ms = 0;
  45. if (parser.seenval('P')) ms = parser.value_millis(); // Milliseconds to wait
  46. if (parser.seenval('S')) ms = parser.value_millis_from_seconds(); // Seconds to wait
  47. planner.synchronize();
  48. #if HAS_MARLINUI_MENU
  49. if (parser.string_arg)
  50. ui.set_status(parser.string_arg, true);
  51. else {
  52. LCD_MESSAGE(MSG_USERWAIT);
  53. #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
  54. ui.reset_progress_bar_timeout();
  55. #endif
  56. }
  57. #elif ENABLED(EXTENSIBLE_UI)
  58. if (parser.string_arg)
  59. ExtUI::onUserConfirmRequired(parser.string_arg); // String in an SRAM buffer
  60. else
  61. ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_USERWAIT));
  62. #elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
  63. if (parser.string_arg)
  64. DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT));
  65. else
  66. DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT));
  67. #else
  68. if (parser.string_arg) {
  69. SERIAL_ECHO_START();
  70. SERIAL_ECHOLN(parser.string_arg);
  71. }
  72. #endif
  73. TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? F("M1 Stop") : F("M0 Stop"), FPSTR(CONTINUE_STR)));
  74. TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(ms));
  75. TERN_(HAS_MARLINUI_MENU, ui.reset_status());
  76. }
  77. #endif // HAS_RESUME_CONTINUE