update code base to Marlin 2.0.9.2
This commit is contained in:
91
Marlin/src/gcode/temp/M140_M190.cpp
Executable file → Normal file
91
Marlin/src/gcode/temp/M140_M190.cpp
Executable file → Normal file
@@ -16,7 +16,7 @@
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -32,57 +32,64 @@
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/temperature.h"
|
||||
#include "../../module/motion.h"
|
||||
#include "../../lcd/ultralcd.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
|
||||
#include "../../lcd/marlinui.h"
|
||||
|
||||
/**
|
||||
* M140: Set bed temperature
|
||||
*/
|
||||
void GcodeSuite::M140() {
|
||||
if (DEBUGGING(DRYRUN)) return;
|
||||
if (parser.seenval('S')) thermalManager.setTargetBed(parser.value_celsius());
|
||||
|
||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||
/**
|
||||
* Stop the timer at the end of print. Both hotend and bed target
|
||||
* temperatures need to be set below mintemp. Order of M140 and M104
|
||||
* at the end of the print does not matter.
|
||||
*/
|
||||
thermalManager.check_timer_autostart(false, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* M190: Sxxx Wait for bed current temp to reach target temp. Waits only when heating
|
||||
* Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
|
||||
* M140 - Set Bed Temperature target and return immediately
|
||||
* M190 - Set Bed Temperature target and wait
|
||||
*
|
||||
* With PRINTJOB_TIMER_AUTOSTART also start the job timer on heating.
|
||||
* I<index> : Preset index (if material presets are defined)
|
||||
* S<target> : The target temperature in current units
|
||||
*
|
||||
* Parameters
|
||||
* I<index> : Preset index (if material presets are defined)
|
||||
* S<target> : The target temperature in current units. Wait for heating only.
|
||||
*
|
||||
* M190 Parameters
|
||||
* R<target> : The target temperature in current units. Wait for heating and cooling.
|
||||
*
|
||||
* Examples
|
||||
* M140 S60 : Set target to 60° and return right away.
|
||||
* M190 R40 : Set target to 40°. Wait until the bed gets close to 40°.
|
||||
*
|
||||
* With PRINTJOB_TIMER_AUTOSTART turning on heaters will start the print job timer
|
||||
* (used by printingIsActive, etc.) and turning off heaters will stop the timer.
|
||||
*/
|
||||
void GcodeSuite::M190() {
|
||||
void GcodeSuite::M140_M190(const bool isM190) {
|
||||
|
||||
if (DEBUGGING(DRYRUN)) return;
|
||||
|
||||
const bool no_wait_for_cooling = parser.seenval('S');
|
||||
if (no_wait_for_cooling || parser.seenval('R')) {
|
||||
thermalManager.setTargetBed(parser.value_celsius());
|
||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||
thermalManager.check_timer_autostart(true, false);
|
||||
#endif
|
||||
bool got_temp = false;
|
||||
celsius_t temp = 0;
|
||||
|
||||
// Accept 'I' if temperature presets are defined
|
||||
#if PREHEAT_COUNT
|
||||
got_temp = parser.seenval('I');
|
||||
if (got_temp) {
|
||||
const uint8_t index = parser.value_byte();
|
||||
temp = ui.material_preset[_MIN(index, PREHEAT_COUNT - 1)].bed_temp;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the temperature from 'S' or 'R'
|
||||
bool no_wait_for_cooling = false;
|
||||
if (!got_temp) {
|
||||
no_wait_for_cooling = parser.seenval('S');
|
||||
got_temp = no_wait_for_cooling || (isM190 && parser.seenval('R'));
|
||||
if (got_temp) temp = parser.value_celsius();
|
||||
}
|
||||
else return;
|
||||
|
||||
if (!got_temp) return;
|
||||
|
||||
thermalManager.setTargetBed(temp);
|
||||
|
||||
ui.set_status_P(thermalManager.isHeatingBed() ? GET_TEXT(MSG_BED_HEATING) : GET_TEXT(MSG_BED_COOLING));
|
||||
|
||||
thermalManager.wait_for_bed(no_wait_for_cooling);
|
||||
// with PRINTJOB_TIMER_AUTOSTART, M190 can start the timer, and M140 can stop it
|
||||
TERN_(PRINTJOB_TIMER_AUTOSTART, thermalManager.auto_job_check_timer(isM190, !isM190));
|
||||
|
||||
if (isM190)
|
||||
thermalManager.wait_for_bed(no_wait_for_cooling);
|
||||
}
|
||||
|
||||
#endif // HAS_HEATED_BED
|
||||
|
Reference in New Issue
Block a user