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
         setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
3833
         setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
3834
     #endif
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
 #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
3851
 #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
3944
  *       Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling.
3957
  *       Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling.
3945
  */
3958
  */
3946
 inline void gcode_M109() {
3959
 inline void gcode_M109() {
3960
+  float temp;
3947
   bool no_wait_for_cooling = true;
3961
   bool no_wait_for_cooling = true;
3948
 
3962
 
3949
   if (setTargetedHotend(109)) return;
3963
   if (setTargetedHotend(109)) return;
3950
   if (marlin_debug_flags & DEBUG_DRYRUN) return;
3964
   if (marlin_debug_flags & DEBUG_DRYRUN) return;
3951
 
3965
 
3952
-  LCD_MESSAGEPGM(MSG_HEATING);
3953
-
3954
   no_wait_for_cooling = code_seen('S');
3966
   no_wait_for_cooling = code_seen('S');
3955
   if (no_wait_for_cooling || code_seen('R')) {
3967
   if (no_wait_for_cooling || code_seen('R')) {
3956
-    float temp = code_value();
3968
+    temp = code_value();
3957
     setTargetHotend(temp, target_extruder);
3969
     setTargetHotend(temp, target_extruder);
3958
     #if ENABLED(DUAL_X_CARRIAGE)
3970
     #if ENABLED(DUAL_X_CARRIAGE)
3959
       if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
3971
       if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
3961
     #endif
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
   #if ENABLED(AUTOTEMP)
3979
   #if ENABLED(AUTOTEMP)
3965
     autotemp_enabled = code_seen('F');
3980
     autotemp_enabled = code_seen('F');
3966
     if (autotemp_enabled) autotemp_factor = code_value();
3981
     if (autotemp_enabled) autotemp_factor = code_value();
3968
     if (code_seen('B')) autotemp_max = code_value();
3983
     if (code_seen('B')) autotemp_max = code_value();
3969
   #endif
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
   // Exit if the temperature is above target and not waiting for cooling
4002
   // Exit if the temperature is above target and not waiting for cooling
3972
   if (no_wait_for_cooling && !isHeatingHotend(target_extruder)) return;
4003
   if (no_wait_for_cooling && !isHeatingHotend(target_extruder)) return;
3973
 
4004
 

+ 2
- 1
Marlin/dogm_lcd_implementation.h View File

306
 
306
 
307
     u8g.setPrintPos(80,48);
307
     u8g.setPrintPos(80,48);
308
     if (print_job_start_ms != 0) {
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
       lcd_print(itostr2(time/60));
311
       lcd_print(itostr2(time/60));
311
       lcd_print(':');
312
       lcd_print(':');
312
       lcd_print(itostr2(time%60));
313
       lcd_print(itostr2(time%60));

+ 3
- 0
Marlin/temperature.cpp View File

1111
   for (int i = 0; i < EXTRUDERS; i++) setTargetHotend(0, i);
1111
   for (int i = 0; i < EXTRUDERS; i++) setTargetHotend(0, i);
1112
   setTargetBed(0);
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
   #define DISABLE_HEATER(NR) { \
1117
   #define DISABLE_HEATER(NR) { \
1115
     target_temperature[NR] = 0; \
1118
     target_temperature[NR] = 0; \
1116
     soft_pwm[NR] = 0; \
1119
     soft_pwm[NR] = 0; \

+ 6
- 5
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

137
   #define LCD_I2C_PIN_D5  5
137
   #define LCD_I2C_PIN_D5  5
138
   #define LCD_I2C_PIN_D6  6
138
   #define LCD_I2C_PIN_D6  6
139
   #define LCD_I2C_PIN_D7  7
139
   #define LCD_I2C_PIN_D7  7
140
-  
140
+
141
   #include <Wire.h>
141
   #include <Wire.h>
142
   #include <LCD.h>
142
   #include <LCD.h>
143
   #include <LiquidCrystal_I2C.h>
143
   #include <LiquidCrystal_I2C.h>
632
         else {
632
         else {
633
           if (!axis_homed[X_AXIS])
633
           if (!axis_homed[X_AXIS])
634
             lcd_printPGM(PSTR("?"));
634
             lcd_printPGM(PSTR("?"));
635
-          else 
635
+          else
636
             #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
636
             #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
637
               if (!axis_known_position[X_AXIS])
637
               if (!axis_known_position[X_AXIS])
638
                 lcd_printPGM(PSTR(" "));
638
                 lcd_printPGM(PSTR(" "));
649
         else {
649
         else {
650
           if (!axis_homed[Y_AXIS])
650
           if (!axis_homed[Y_AXIS])
651
             lcd_printPGM(PSTR("?"));
651
             lcd_printPGM(PSTR("?"));
652
-          else 
652
+          else
653
             #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
653
             #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
654
               if (!axis_known_position[Y_AXIS])
654
               if (!axis_known_position[Y_AXIS])
655
                 lcd_printPGM(PSTR(" "));
655
                 lcd_printPGM(PSTR(" "));
669
     else {
669
     else {
670
       if (!axis_homed[Z_AXIS])
670
       if (!axis_homed[Z_AXIS])
671
         lcd_printPGM(PSTR("?"));
671
         lcd_printPGM(PSTR("?"));
672
-      else 
672
+      else
673
         #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
673
         #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
674
           if (!axis_known_position[Z_AXIS])
674
           if (!axis_known_position[Z_AXIS])
675
             lcd_printPGM(PSTR(" "));
675
             lcd_printPGM(PSTR(" "));
707
     lcd.setCursor(LCD_WIDTH - 6, 2);
707
     lcd.setCursor(LCD_WIDTH - 6, 2);
708
     lcd.print(LCD_STR_CLOCK[0]);
708
     lcd.print(LCD_STR_CLOCK[0]);
709
     if (print_job_start_ms != 0) {
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
       lcd.print(itostr2(time / 60));
712
       lcd.print(itostr2(time / 60));
712
       lcd.print(':');
713
       lcd.print(':');
713
       lcd.print(itostr2(time % 60));
714
       lcd.print(itostr2(time % 60));

Loading…
Cancel
Save