|
@@ -4463,15 +4463,6 @@ inline void gcode_M109() {
|
4463
|
4463
|
if (code_seen('B')) autotemp_max = code_value();
|
4464
|
4464
|
#endif
|
4465
|
4465
|
|
4466
|
|
- bool wants_to_cool = isCoolingHotend(target_extruder);
|
4467
|
|
-
|
4468
|
|
- // Exit if S<lower>, continue if S<higher>, R<lower>, or R<higher>
|
4469
|
|
- if (no_wait_for_cooling && wants_to_cool) return;
|
4470
|
|
-
|
4471
|
|
- // Prevents a wait-forever situation if R is misused i.e. M109 R0
|
4472
|
|
- // Try to calculate a ballpark safe margin by halving EXTRUDE_MINTEMP
|
4473
|
|
- if (wants_to_cool && degTargetHotend(target_extruder) < (EXTRUDE_MINTEMP)/2) return;
|
4474
|
|
-
|
4475
|
4466
|
#if TEMP_RESIDENCY_TIME > 0
|
4476
|
4467
|
millis_t residency_start_ms = 0;
|
4477
|
4468
|
// Loop until the temperature has stabilized
|
|
@@ -4481,11 +4472,15 @@ inline void gcode_M109() {
|
4481
|
4472
|
#define TEMP_CONDITIONS (wants_to_cool ? isCoolingHotend(target_extruder) : isHeatingHotend(target_extruder))
|
4482
|
4473
|
#endif //TEMP_RESIDENCY_TIME > 0
|
4483
|
4474
|
|
4484
|
|
- KEEPALIVE_STATE(NOT_BUSY);
|
4485
|
|
-
|
|
4475
|
+ float theTarget = -1;
|
|
4476
|
+ bool wants_to_cool;
|
4486
|
4477
|
cancel_heatup = false;
|
4487
|
4478
|
millis_t now, next_temp_ms = 0;
|
|
4479
|
+
|
|
4480
|
+ KEEPALIVE_STATE(NOT_BUSY);
|
|
4481
|
+
|
4488
|
4482
|
do {
|
|
4483
|
+
|
4489
|
4484
|
now = millis();
|
4490
|
4485
|
if (ELAPSED(now, next_temp_ms)) { //Print temp & remaining time every 1s while waiting
|
4491
|
4486
|
next_temp_ms = now + 1000UL;
|
|
@@ -4506,12 +4501,25 @@ inline void gcode_M109() {
|
4506
|
4501
|
#endif
|
4507
|
4502
|
}
|
4508
|
4503
|
|
|
4504
|
+ // Target temperature might be changed during the loop
|
|
4505
|
+ if (theTarget != degTargetHotend(target_extruder)) {
|
|
4506
|
+ theTarget = degTargetHotend(target_extruder);
|
|
4507
|
+ wants_to_cool = isCoolingHotend(target_extruder);
|
|
4508
|
+
|
|
4509
|
+ // Exit if S<lower>, continue if S<higher>, R<lower>, or R<higher>
|
|
4510
|
+ if (no_wait_for_cooling && wants_to_cool) break;
|
|
4511
|
+
|
|
4512
|
+ // Prevent a wait-forever situation if R is misused i.e. M109 R0
|
|
4513
|
+ // Try to calculate a ballpark safe margin by halving EXTRUDE_MINTEMP
|
|
4514
|
+ if (wants_to_cool && theTarget < (EXTRUDE_MINTEMP)/2) break;
|
|
4515
|
+ }
|
|
4516
|
+
|
4509
|
4517
|
idle();
|
4510
|
4518
|
refresh_cmd_timeout(); // to prevent stepper_inactive_time from running out
|
4511
|
4519
|
|
4512
|
4520
|
#if TEMP_RESIDENCY_TIME > 0
|
4513
|
4521
|
|
4514
|
|
- float temp_diff = fabs(degTargetHotend(target_extruder) - degHotend(target_extruder));
|
|
4522
|
+ float temp_diff = fabs(theTarget - degHotend(target_extruder));
|
4515
|
4523
|
|
4516
|
4524
|
if (!residency_start_ms) {
|
4517
|
4525
|
// Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time.
|
|
@@ -4543,11 +4551,6 @@ inline void gcode_M109() {
|
4543
|
4551
|
bool no_wait_for_cooling = code_seen('S');
|
4544
|
4552
|
if (no_wait_for_cooling || code_seen('R')) setTargetBed(code_value());
|
4545
|
4553
|
|
4546
|
|
- bool wants_to_cool = isCoolingBed();
|
4547
|
|
-
|
4548
|
|
- // Exit if S<lower>, continue if S<higher>, R<lower>, or R<higher>
|
4549
|
|
- if (no_wait_for_cooling && wants_to_cool) return;
|
4550
|
|
-
|
4551
|
4554
|
#if TEMP_BED_RESIDENCY_TIME > 0
|
4552
|
4555
|
millis_t residency_start_ms = 0;
|
4553
|
4556
|
// Loop until the temperature has stabilized
|
|
@@ -4557,11 +4560,13 @@ inline void gcode_M109() {
|
4557
|
4560
|
#define TEMP_BED_CONDITIONS (wants_to_cool ? isCoolingBed() : isHeatingBed())
|
4558
|
4561
|
#endif //TEMP_BED_RESIDENCY_TIME > 0
|
4559
|
4562
|
|
|
4563
|
+ float theTarget = -1;
|
|
4564
|
+ bool wants_to_cool;
|
4560
|
4565
|
cancel_heatup = false;
|
4561
|
4566
|
millis_t now, next_temp_ms = 0;
|
4562
|
4567
|
|
4563
|
|
- // Wait for temperature to come close enough
|
4564
|
4568
|
KEEPALIVE_STATE(NOT_BUSY);
|
|
4569
|
+
|
4565
|
4570
|
do {
|
4566
|
4571
|
now = millis();
|
4567
|
4572
|
if (ELAPSED(now, next_temp_ms)) { //Print Temp Reading every 1 second while heating up.
|
|
@@ -4581,6 +4586,19 @@ inline void gcode_M109() {
|
4581
|
4586
|
#endif
|
4582
|
4587
|
}
|
4583
|
4588
|
|
|
4589
|
+ // Target temperature might be changed during the loop
|
|
4590
|
+ if (theTarget != degTargetBed()) {
|
|
4591
|
+ theTarget = degTargetBed();
|
|
4592
|
+ wants_to_cool = isCoolingBed();
|
|
4593
|
+
|
|
4594
|
+ // Exit if S<lower>, continue if S<higher>, R<lower>, or R<higher>
|
|
4595
|
+ if (no_wait_for_cooling && wants_to_cool) break;
|
|
4596
|
+
|
|
4597
|
+ // Prevent a wait-forever situation if R is misused i.e. M190 R0
|
|
4598
|
+ // Simply don't wait for cooling below 30C
|
|
4599
|
+ if (wants_to_cool && theTarget < (EXTRUDE_MINTEMP)/2) break;
|
|
4600
|
+ }
|
|
4601
|
+
|
4584
|
4602
|
idle();
|
4585
|
4603
|
refresh_cmd_timeout(); // to prevent stepper_inactive_time from running out
|
4586
|
4604
|
|