My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

M80_M81.cpp 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../gcode.h"
  23. #include "../../module/temperature.h"
  24. #include "../../module/stepper.h"
  25. #include "../../module/printcounter.h" // for print_job_timer
  26. #include "../../inc/MarlinConfig.h"
  27. #if HAS_LCD_MENU
  28. #include "../../lcd/ultralcd.h"
  29. #endif
  30. #if HAS_SUICIDE
  31. #include "../../MarlinCore.h"
  32. #endif
  33. #if ENABLED(PSU_CONTROL)
  34. #if ENABLED(AUTO_POWER_CONTROL)
  35. #include "../../feature/power.h"
  36. #endif
  37. // Could be moved to a feature, but this is all the data
  38. bool powersupply_on;
  39. #if HAS_TRINAMIC_CONFIG
  40. #include "../../feature/tmc_util.h"
  41. #endif
  42. /**
  43. * M80 : Turn on the Power Supply
  44. * M80 S : Report the current state and exit
  45. */
  46. void GcodeSuite::M80() {
  47. // S: Report the current power supply state and exit
  48. if (parser.seen('S')) {
  49. serialprintPGM(powersupply_on ? PSTR("PS:1\n") : PSTR("PS:0\n"));
  50. return;
  51. }
  52. PSU_ON();
  53. /**
  54. * If you have a switch on suicide pin, this is useful
  55. * if you want to start another print with suicide feature after
  56. * a print without suicide...
  57. */
  58. #if HAS_SUICIDE
  59. OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
  60. #endif
  61. #if DISABLED(AUTO_POWER_CONTROL)
  62. delay(PSU_POWERUP_DELAY);
  63. restore_stepper_drivers();
  64. TERN_(HAS_TRINAMIC_CONFIG, delay(PSU_POWERUP_DELAY));
  65. #endif
  66. TERN_(HAS_LCD_MENU, ui.reset_status());
  67. }
  68. #endif // PSU_CONTROL
  69. /**
  70. * M81: Turn off Power, including Power Supply, if there is one.
  71. *
  72. * This code should ALWAYS be available for FULL SHUTDOWN!
  73. */
  74. void GcodeSuite::M81() {
  75. thermalManager.disable_all_heaters();
  76. print_job_timer.stop();
  77. planner.finish_and_disable();
  78. #if HAS_FAN
  79. thermalManager.zero_fan_speeds();
  80. #if ENABLED(PROBING_FANS_OFF)
  81. thermalManager.fans_paused = false;
  82. ZERO(thermalManager.saved_fan_speed);
  83. #endif
  84. #endif
  85. safe_delay(1000); // Wait 1 second before switching off
  86. #if HAS_SUICIDE
  87. suicide();
  88. #elif ENABLED(PSU_CONTROL)
  89. PSU_OFF();
  90. #endif
  91. #if HAS_LCD_MENU
  92. LCD_MESSAGEPGM_P(PSTR(MACHINE_NAME " " STR_OFF "."));
  93. #endif
  94. }