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.

M1000.cpp 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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(POWER_LOSS_RECOVERY)
  24. #include "../../gcode.h"
  25. #include "../../../feature/powerloss.h"
  26. #include "../../../module/motion.h"
  27. #include "../../../lcd/ultralcd.h"
  28. #if ENABLED(EXTENSIBLE_UI)
  29. #include "../../../lcd/extui/ui_api.h"
  30. #endif
  31. #define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY)
  32. #include "../../../core/debug_out.h"
  33. void menu_job_recovery();
  34. inline void plr_error(PGM_P const prefix) {
  35. #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
  36. DEBUG_ECHO_START();
  37. serialprintPGM(prefix);
  38. DEBUG_ECHOLNPGM(" Job Recovery Data");
  39. #else
  40. UNUSED(prefix);
  41. #endif
  42. }
  43. #if HAS_LCD_MENU
  44. void lcd_power_loss_recovery_cancel();
  45. #endif
  46. /**
  47. * M1000: Resume from power-loss (undocumented)
  48. * - With 'S' go to the Resume/Cancel menu
  49. * - With no parameters, run recovery commands
  50. */
  51. void GcodeSuite::M1000() {
  52. if (recovery.valid()) {
  53. if (parser.seen('S')) {
  54. #if HAS_LCD_MENU
  55. ui.goto_screen(menu_job_recovery);
  56. #elif ENABLED(DWIN_CREALITY_LCD)
  57. recovery.dwin_flag = true;
  58. #elif ENABLED(EXTENSIBLE_UI)
  59. ExtUI::onPowerLossResume();
  60. #else
  61. SERIAL_ECHO_MSG("Resume requires LCD.");
  62. #endif
  63. }
  64. else if (parser.seen('C')) {
  65. #if HAS_LCD_MENU
  66. lcd_power_loss_recovery_cancel();
  67. #else
  68. recovery.cancel();
  69. #endif
  70. TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStopped());
  71. }
  72. else
  73. recovery.resume();
  74. }
  75. else
  76. plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid"));
  77. }
  78. #endif // POWER_LOSS_RECOVERY