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.

M80_M81.cpp 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 "../gcode.h"
  23. #include "../../module/temperature.h"
  24. #include "../../module/planner.h" // for planner.finish_and_disable
  25. #include "../../module/printcounter.h" // for print_job_timer.stop
  26. #include "../../lcd/marlinui.h" // for LCD_MESSAGEPGM_P
  27. #include "../../inc/MarlinConfig.h"
  28. #if ENABLED(PSU_CONTROL)
  29. #include "../queue.h"
  30. #include "../../feature/power.h"
  31. #endif
  32. #if HAS_SUICIDE
  33. #include "../../MarlinCore.h"
  34. #endif
  35. #if ENABLED(PSU_CONTROL)
  36. /**
  37. * M80 : Turn on the Power Supply
  38. * M80 S : Report the current state and exit
  39. */
  40. void GcodeSuite::M80() {
  41. // S: Report the current power supply state and exit
  42. if (parser.seen('S')) {
  43. SERIAL_ECHOF(powerManager.psu_on ? F("PS:1\n") : F("PS:0\n"));
  44. return;
  45. }
  46. powerManager.power_on();
  47. /**
  48. * If you have a switch on suicide pin, this is useful
  49. * if you want to start another print with suicide feature after
  50. * a print without suicide...
  51. */
  52. #if HAS_SUICIDE
  53. OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_STATE);
  54. #endif
  55. TERN_(HAS_LCD_MENU, ui.reset_status());
  56. }
  57. #endif // PSU_CONTROL
  58. /**
  59. * M81: Turn off Power, including Power Supply, if there is one.
  60. *
  61. * This code should ALWAYS be available for FULL SHUTDOWN!
  62. */
  63. void GcodeSuite::M81() {
  64. thermalManager.disable_all_heaters();
  65. planner.finish_and_disable();
  66. print_job_timer.stop();
  67. #if HAS_FAN
  68. thermalManager.zero_fan_speeds();
  69. #if ENABLED(PROBING_FANS_OFF)
  70. thermalManager.fans_paused = false;
  71. ZERO(thermalManager.saved_fan_speed);
  72. #endif
  73. #endif
  74. safe_delay(1000); // Wait 1 second before switching off
  75. #if HAS_SUICIDE
  76. suicide();
  77. #elif ENABLED(PSU_CONTROL)
  78. powerManager.power_off_soon();
  79. #endif
  80. LCD_MESSAGEPGM_P(PSTR(MACHINE_NAME " " STR_OFF "."));
  81. }