Browse Source

Temp-related cosmetic changes

Scott Lahteine 7 years ago
parent
commit
8a0a5cfccc
2 changed files with 21 additions and 42 deletions
  1. 4
    4
      Marlin/Marlin_main.cpp
  2. 17
    38
      Marlin/temperature.cpp

+ 4
- 4
Marlin/Marlin_main.cpp View File

@@ -6684,7 +6684,8 @@ inline void gcode_M104() {
6684 6684
       }
6685 6685
     #endif
6686 6686
 
6687
-    if (code_value_temp_abs() > thermalManager.degHotend(target_extruder)) lcd_status_printf_P(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING);
6687
+    if (code_value_temp_abs() > thermalManager.degHotend(target_extruder))
6688
+      lcd_status_printf_P(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING);
6688 6689
   }
6689 6690
 
6690 6691
   #if ENABLED(AUTOTEMP)
@@ -8290,7 +8291,7 @@ inline void gcode_M226() {
8290 8291
       // Report current state
8291 8292
       SERIAL_ECHO_START;
8292 8293
       SERIAL_ECHOPAIR("Cold extrudes are ", (thermalManager.allow_cold_extrude ? "en" : "dis"));
8293
-      SERIAL_ECHOPAIR("abled (min temp ", int(thermalManager.extrude_min_temp + 0.5));
8294
+      SERIAL_ECHOPAIR("abled (min temp ", thermalManager.extrude_min_temp);
8294 8295
       SERIAL_ECHOLNPGM("C)");
8295 8296
     }
8296 8297
   }
@@ -11909,9 +11910,8 @@ void prepare_move_to_destination() {
11909 11910
       #if HAS_TEMP_BED
11910 11911
         max_temp = MAX3(max_temp, thermalManager.degTargetBed(), thermalManager.degBed());
11911 11912
       #endif
11912
-      HOTEND_LOOP() {
11913
+      HOTEND_LOOP()
11913 11914
         max_temp = MAX3(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e));
11914
-      }
11915 11915
       bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led;
11916 11916
       if (new_led != red_led) {
11917 11917
         red_led = new_led;

+ 17
- 38
Marlin/temperature.cpp View File

@@ -695,66 +695,47 @@ void Temperature::manage_heater() {
695 695
   updateTemperaturesFromRawValues(); // also resets the watchdog
696 696
 
697 697
   #if ENABLED(HEATER_0_USES_MAX6675)
698
-    if (current_temperature[0] > min(HEATER_0_MAXTEMP, MAX6675_TMAX - 1)) max_temp_error(0);
699
-    if (current_temperature[0] < max(HEATER_0_MINTEMP, MAX6675_TMIN + 0.01)) min_temp_error(0);
698
+    if (current_temperature[0] > min(HEATER_0_MAXTEMP, MAX6675_TMAX - 1.0)) max_temp_error(0);
699
+    if (current_temperature[0] < max(HEATER_0_MINTEMP, MAX6675_TMIN + .01)) min_temp_error(0);
700 700
   #endif
701 701
 
702 702
   #if WATCH_HOTENDS || WATCH_THE_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN
703 703
     millis_t ms = millis();
704 704
   #endif
705 705
 
706
-  // Loop through all hotends
707 706
   HOTEND_LOOP() {
708 707
 
709 708
     #if ENABLED(THERMAL_PROTECTION_HOTENDS)
709
+      // Check for thermal runaway
710 710
       thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
711 711
     #endif
712 712
 
713
-    float pid_output = get_pid_output(e);
713
+    soft_pwm_amount[e] = (current_temperature[e] > minttemp[e] || is_preheating(e)) && current_temperature[e] < maxttemp[e] ? (int)get_pid_output(e) >> 1 : 0;
714 714
 
715
-    // Check if temperature is within the correct range
716
-    soft_pwm_amount[e] = (current_temperature[e] > minttemp[e] || is_preheating(e)) && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
717
-
718
-    // Check if the temperature is failing to increase
719 715
     #if WATCH_HOTENDS
720
-
721
-      // Is it time to check this extruder's heater?
722
-      if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) {
723
-        // Has it failed to increase enough?
724
-        if (degHotend(e) < watch_target_temp[e]) {
725
-          // Stop!
716
+      // Make sure temperature is increasing
717
+      if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) { // Time to check this extruder?
718
+        if (degHotend(e) < watch_target_temp[e])                             // Failed to increase enough?
726 719
           _temp_error(e, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
727
-        }
728
-        else {
729
-          // Start again if the target is still far off
720
+        else                                                                 // Start again if the target is still far off
730 721
           start_watching_heater(e);
731
-        }
732 722
       }
723
+    #endif
733 724
 
734
-    #endif // THERMAL_PROTECTION_HOTENDS
735
-
736
-    // Check if the temperature is failing to increase
737 725
     #if WATCH_THE_BED
738
-
739
-      // Is it time to check the bed?
740
-      if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) {
741
-        // Has it failed to increase enough?
742
-        if (degBed() < watch_target_bed_temp) {
743
-          // Stop!
726
+      // Make sure temperature is increasing
727
+      if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) {        // Time to check the bed?
728
+        if (degBed() < watch_target_bed_temp)                           // Failed to increase enough?
744 729
           _temp_error(-1, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
745
-        }
746
-        else {
747
-          // Start again if the target is still far off
730
+        else                                                            // Start again if the target is still far off
748 731
           start_watching_bed();
749
-        }
750 732
       }
751
-
752
-    #endif // THERMAL_PROTECTION_HOTENDS
733
+    #endif
753 734
 
754 735
     #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
755
-      if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
736
+      // Make sure measured temperatures are close together
737
+      if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF)
756 738
         _temp_error(0, PSTR(MSG_REDUNDANCY), PSTR(MSG_ERR_REDUNDANT_TEMP));
757
-      }
758 739
     #endif
759 740
 
760 741
   } // HOTEND_LOOP
@@ -792,9 +773,7 @@ void Temperature::manage_heater() {
792 773
     #endif
793 774
 
794 775
     #if ENABLED(PIDTEMPBED)
795
-      float pid_output = get_pid_output_bed();
796
-
797
-      soft_pwm_amount_bed = WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP) ? (int)pid_output >> 1 : 0;
776
+      soft_pwm_amount_bed = WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP) ? (int)get_pid_output_bed() >> 1 : 0;
798 777
 
799 778
     #elif ENABLED(BED_LIMIT_SWITCHING)
800 779
       // Check if temperature is within the correct band

Loading…
Cancel
Save