Cooler (for Laser) - M143, M193 (#21255)
This commit is contained in:
		@@ -32,19 +32,8 @@
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../module/temperature.h"
 | 
			
		||||
#include "../../module/motion.h"
 | 
			
		||||
#include "../../lcd/marlinui.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
 | 
			
		||||
  #include "../../module/printcounter.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if ENABLED(PRINTER_EVENT_LEDS)
 | 
			
		||||
  #include "../../feature/leds/leds.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "../../MarlinCore.h" // for wait_for_heatup, idle, startOrResumeJob
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M140: Set bed temperature
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -32,20 +32,8 @@
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../module/temperature.h"
 | 
			
		||||
 | 
			
		||||
#include "../../module/motion.h"
 | 
			
		||||
#include "../../lcd/marlinui.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
 | 
			
		||||
  #include "../../module/printcounter.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if ENABLED(PRINTER_EVENT_LEDS)
 | 
			
		||||
  #include "../../feature/leds/leds.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "../../MarlinCore.h" // for wait_for_heatup, idle, startOrResumeJob
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M141: Set chamber temperature
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										67
									
								
								Marlin/src/gcode/temp/M143_M193.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								Marlin/src/gcode/temp/M143_M193.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Marlin 3D Printer Firmware
 | 
			
		||||
 * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | 
			
		||||
 *
 | 
			
		||||
 * Based on Sprinter and grbl.
 | 
			
		||||
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * gcode/temp/M143_M193.cpp
 | 
			
		||||
 *
 | 
			
		||||
 * Laser Cooler target temperature control
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
#if HAS_COOLER
 | 
			
		||||
 | 
			
		||||
#include "../../feature/cooler.h"
 | 
			
		||||
extern Cooler cooler;
 | 
			
		||||
 | 
			
		||||
#include "../gcode.h"
 | 
			
		||||
#include "../../module/temperature.h"
 | 
			
		||||
#include "../../lcd/marlinui.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M143: Set cooler temperature
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M143() {
 | 
			
		||||
  if (DEBUGGING(DRYRUN)) return;
 | 
			
		||||
  if (parser.seenval('S')) {
 | 
			
		||||
    thermalManager.setTargetCooler(parser.value_celsius());
 | 
			
		||||
    parser.value_celsius() ? cooler.enable() : cooler.disable();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M193: Sxxx Wait for laser current temp to reach target temp. Waits only when cooling.
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::M193() {
 | 
			
		||||
  if (DEBUGGING(DRYRUN)) return;
 | 
			
		||||
 | 
			
		||||
  if (parser.seenval('S')) {
 | 
			
		||||
    cooler.enable();
 | 
			
		||||
    thermalManager.setTargetCooler(parser.value_celsius());
 | 
			
		||||
    if (thermalManager.isLaserCooling()) {
 | 
			
		||||
      ui.set_status_P(GET_TEXT(MSG_LASER_COOLING));
 | 
			
		||||
      thermalManager.wait_for_cooler(true);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // HAS_COOLER
 | 
			
		||||
		Reference in New Issue
	
	Block a user