My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

M80_M81.cpp 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 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 "../../Marlin.h"
  32. #endif
  33. #if HAS_POWER_SWITCH
  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
  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, HIGH);
  60. #endif
  61. #if DISABLED(AUTO_POWER_CONTROL)
  62. delay(100); // Wait for power to settle
  63. restore_stepper_drivers();
  64. #endif
  65. #if HAS_LCD_MENU
  66. ui.reset_status();
  67. #endif
  68. }
  69. #endif // HAS_POWER_SWITCH
  70. /**
  71. * M81: Turn off Power, including Power Supply, if there is one.
  72. *
  73. * This code should ALWAYS be available for FULL SHUTDOWN!
  74. */
  75. void GcodeSuite::M81() {
  76. thermalManager.disable_all_heaters();
  77. print_job_timer.stop();
  78. planner.finish_and_disable();
  79. #if FAN_COUNT > 0
  80. thermalManager.zero_fan_speeds();
  81. #if ENABLED(PROBING_FANS_OFF)
  82. thermalManager.fans_paused = false;
  83. ZERO(thermalManager.saved_fan_speed);
  84. #endif
  85. #endif
  86. safe_delay(1000); // Wait 1 second before switching off
  87. #if HAS_SUICIDE
  88. suicide();
  89. #elif HAS_POWER_SWITCH
  90. PSU_OFF();
  91. #endif
  92. #if HAS_LCD_MENU
  93. LCD_MESSAGEPGM_P(PSTR(MACHINE_NAME " " MSG_OFF "."));
  94. #endif
  95. }