Browse Source

Print timer now stops when it sees the last extruder temperature being shutdown

jbrazio 9 years ago
parent
commit
986b508ff7

+ 34
- 3
Marlin/Marlin_main.cpp View File

@@ -3833,6 +3833,19 @@ inline void gcode_M104() {
3833 3833
         setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
3834 3834
     #endif
3835 3835
   }
3836
+
3837
+  // Detect if a print job has finished.
3838
+  // When the target temperature for all extruders is zero then we must have
3839
+  // finished printing.
3840
+  if( print_job_start_ms != 0 ) {
3841
+    bool all_extruders_cooling = true;
3842
+    for (int i = 0; i < EXTRUDERS; i++) if( degTargetHotend(i) > 0 ) {
3843
+      all_extruders_cooling = false;
3844
+      break;
3845
+    }
3846
+
3847
+    if( all_extruders_cooling ) print_job_stop_ms = millis();
3848
+  }
3836 3849
 }
3837 3850
 
3838 3851
 #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
@@ -3944,16 +3957,15 @@ inline void gcode_M105() {
3944 3957
  *       Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling.
3945 3958
  */
3946 3959
 inline void gcode_M109() {
3960
+  float temp;
3947 3961
   bool no_wait_for_cooling = true;
3948 3962
 
3949 3963
   if (setTargetedHotend(109)) return;
3950 3964
   if (marlin_debug_flags & DEBUG_DRYRUN) return;
3951 3965
 
3952
-  LCD_MESSAGEPGM(MSG_HEATING);
3953
-
3954 3966
   no_wait_for_cooling = code_seen('S');
3955 3967
   if (no_wait_for_cooling || code_seen('R')) {
3956
-    float temp = code_value();
3968
+    temp = code_value();
3957 3969
     setTargetHotend(temp, target_extruder);
3958 3970
     #if ENABLED(DUAL_X_CARRIAGE)
3959 3971
       if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
@@ -3961,6 +3973,9 @@ inline void gcode_M109() {
3961 3973
     #endif
3962 3974
   }
3963 3975
 
3976
+  // Only makes sense to show the heating message if we're in fact heating.
3977
+  if( temp > 0 ) LCD_MESSAGEPGM(MSG_HEATING);
3978
+
3964 3979
   #if ENABLED(AUTOTEMP)
3965 3980
     autotemp_enabled = code_seen('F');
3966 3981
     if (autotemp_enabled) autotemp_factor = code_value();
@@ -3968,6 +3983,22 @@ inline void gcode_M109() {
3968 3983
     if (code_seen('B')) autotemp_max = code_value();
3969 3984
   #endif
3970 3985
 
3986
+  // Detect if a print job has finished.
3987
+  // When the target temperature for all extruders is zero then we must have
3988
+  // finished printing.
3989
+  if( print_job_start_ms != 0 ) {
3990
+    bool all_extruders_cooling = true;
3991
+    for (int i = 0; i < EXTRUDERS; i++) if( degTargetHotend(i) > 0 ) {
3992
+      all_extruders_cooling = false;
3993
+      break;
3994
+    }
3995
+
3996
+    if( all_extruders_cooling ) {
3997
+      print_job_stop_ms = millis();
3998
+      LCD_MESSAGEPGM(WELCOME_MSG);
3999
+    }
4000
+  }
4001
+
3971 4002
   // Exit if the temperature is above target and not waiting for cooling
3972 4003
   if (no_wait_for_cooling && !isHeatingHotend(target_extruder)) return;
3973 4004
 

+ 2
- 1
Marlin/dogm_lcd_implementation.h View File

@@ -306,7 +306,8 @@ static void lcd_implementation_status_screen() {
306 306
 
307 307
     u8g.setPrintPos(80,48);
308 308
     if (print_job_start_ms != 0) {
309
-      uint16_t time = (millis() - print_job_start_ms) / 60000;
309
+      uint16_t time = ((print_job_stop_ms > print_job_start_ms)
310
+                       ? print_job_stop_ms : millis()) / 60000 - print_job_start_ms / 60000;
310 311
       lcd_print(itostr2(time/60));
311 312
       lcd_print(':');
312 313
       lcd_print(itostr2(time%60));

+ 3
- 0
Marlin/temperature.cpp View File

@@ -1111,6 +1111,9 @@ void disable_all_heaters() {
1111 1111
   for (int i = 0; i < EXTRUDERS; i++) setTargetHotend(0, i);
1112 1112
   setTargetBed(0);
1113 1113
 
1114
+  // If all heaters go down then for sure our print job has stopped
1115
+  if( print_job_start_ms != 0 ) print_job_stop_ms = millis();
1116
+
1114 1117
   #define DISABLE_HEATER(NR) { \
1115 1118
     target_temperature[NR] = 0; \
1116 1119
     soft_pwm[NR] = 0; \

+ 6
- 5
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

@@ -137,7 +137,7 @@ extern volatile uint8_t buttons;  //an extended version of the last checked butt
137 137
   #define LCD_I2C_PIN_D5  5
138 138
   #define LCD_I2C_PIN_D6  6
139 139
   #define LCD_I2C_PIN_D7  7
140
-  
140
+
141 141
   #include <Wire.h>
142 142
   #include <LCD.h>
143 143
   #include <LiquidCrystal_I2C.h>
@@ -632,7 +632,7 @@ static void lcd_implementation_status_screen() {
632 632
         else {
633 633
           if (!axis_homed[X_AXIS])
634 634
             lcd_printPGM(PSTR("?"));
635
-          else 
635
+          else
636 636
             #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
637 637
               if (!axis_known_position[X_AXIS])
638 638
                 lcd_printPGM(PSTR(" "));
@@ -649,7 +649,7 @@ static void lcd_implementation_status_screen() {
649 649
         else {
650 650
           if (!axis_homed[Y_AXIS])
651 651
             lcd_printPGM(PSTR("?"));
652
-          else 
652
+          else
653 653
             #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
654 654
               if (!axis_known_position[Y_AXIS])
655 655
                 lcd_printPGM(PSTR(" "));
@@ -669,7 +669,7 @@ static void lcd_implementation_status_screen() {
669 669
     else {
670 670
       if (!axis_homed[Z_AXIS])
671 671
         lcd_printPGM(PSTR("?"));
672
-      else 
672
+      else
673 673
         #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
674 674
           if (!axis_known_position[Z_AXIS])
675 675
             lcd_printPGM(PSTR(" "));
@@ -707,7 +707,8 @@ static void lcd_implementation_status_screen() {
707 707
     lcd.setCursor(LCD_WIDTH - 6, 2);
708 708
     lcd.print(LCD_STR_CLOCK[0]);
709 709
     if (print_job_start_ms != 0) {
710
-      uint16_t time = millis() / 60000 - print_job_start_ms / 60000;
710
+      uint16_t time = ((print_job_stop_ms > print_job_start_ms)
711
+                       ? print_job_stop_ms : millis()) / 60000 - print_job_start_ms / 60000;
711 712
       lcd.print(itostr2(time / 60));
712 713
       lcd.print(':');
713 714
       lcd.print(itostr2(time % 60));

Loading…
Cancel
Save