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.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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_LCD_MENU
  29. #include "../../lcd/ultralcd.h"
  30. #elif ENABLED(EXTENSIBLE_UI)
  31. #include "../../lcd/extui/ui_api.h"
  32. #endif
  33. #if ENABLED(HOST_PROMPT_SUPPORT)
  34. #include "../../feature/host_actions.h"
  35. #endif
  36. /**
  37. * M0: Unconditional stop - Wait for user button press on LCD
  38. * M1: Conditional stop - Wait for user button press on LCD
  39. */
  40. void GcodeSuite::M0_M1() {
  41. millis_t ms = 0;
  42. if (parser.seenval('P')) ms = parser.value_millis(); // Milliseconds to wait
  43. if (parser.seenval('S')) ms = parser.value_millis_from_seconds(); // Seconds to wait
  44. planner.synchronize();
  45. #if HAS_LCD_MENU
  46. if (parser.string_arg)
  47. ui.set_status(parser.string_arg, true);
  48. else {
  49. LCD_MESSAGEPGM(MSG_USERWAIT);
  50. #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
  51. ui.reset_progress_bar_timeout();
  52. #endif
  53. }
  54. #elif ENABLED(EXTENSIBLE_UI)
  55. if (parser.string_arg)
  56. ExtUI::onUserConfirmRequired(parser.string_arg); // Can this take an SRAM string??
  57. else
  58. ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT));
  59. #else
  60. if (parser.string_arg) {
  61. SERIAL_ECHO_START();
  62. SERIAL_ECHOLN(parser.string_arg);
  63. }
  64. #endif
  65. TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? PSTR("M1 Stop") : PSTR("M0 Stop"), CONTINUE_STR));
  66. wait_for_user_response(ms);
  67. TERN_(HAS_LCD_MENU, ui.reset_status());
  68. }
  69. #endif // HAS_RESUME_CONTINUE