My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

M1000.cpp 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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/marlinui.h"
  28. #if ENABLED(EXTENSIBLE_UI)
  29. #include "../../../lcd/extui/ui_api.h"
  30. #elif ENABLED(DWIN_CREALITY_LCD)
  31. #include "../../../lcd/e3v2/creality/dwin.h"
  32. #elif ENABLED(DWIN_LCD_PROUI)
  33. #include "../../../lcd/e3v2/proui/dwin.h"
  34. #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
  35. #include "../../../lcd/e3v2/jyersui/dwin.h" // Temporary fix until it can be better implemented
  36. #endif
  37. #define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY)
  38. #include "../../../core/debug_out.h"
  39. void menu_job_recovery();
  40. inline void plr_error(FSTR_P const prefix) {
  41. #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
  42. DEBUG_ECHO_START();
  43. DEBUG_ECHOF(prefix);
  44. DEBUG_ECHOLNPGM(" Job Recovery Data");
  45. #else
  46. UNUSED(prefix);
  47. #endif
  48. }
  49. #if HAS_MARLINUI_MENU
  50. void lcd_power_loss_recovery_cancel();
  51. #endif
  52. /**
  53. * M1000: Resume from power-loss (undocumented)
  54. * - With 'S' go to the Resume/Cancel menu
  55. * - With no parameters, run recovery commands
  56. */
  57. void GcodeSuite::M1000() {
  58. if (recovery.valid()) {
  59. if (parser.seen_test('S')) {
  60. #if HAS_MARLINUI_MENU
  61. ui.goto_screen(menu_job_recovery);
  62. #elif HAS_DWIN_E3V2_BASIC
  63. recovery.dwin_flag = true;
  64. #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) // Temporary fix until it can be better implemented
  65. CrealityDWIN.Popup_Handler(Resume);
  66. #elif ENABLED(EXTENSIBLE_UI)
  67. ExtUI::onPowerLossResume();
  68. #else
  69. SERIAL_ECHO_MSG("Resume requires LCD.");
  70. #endif
  71. }
  72. else if (parser.seen_test('C')) {
  73. #if HAS_MARLINUI_MENU
  74. lcd_power_loss_recovery_cancel();
  75. #else
  76. recovery.cancel();
  77. #endif
  78. TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStopped());
  79. }
  80. else
  81. recovery.resume();
  82. }
  83. else
  84. plr_error(recovery.info.valid_head ? F("No") : F("Invalid"));
  85. }
  86. #endif // POWER_LOSS_RECOVERY