Browse Source

Merge pull request #4573 from thinkyhead/rc_mintemp_bed_later

Throw MINTEMP BED error only if heating
Scott Lahteine 8 years ago
parent
commit
f4ac8c15e3
2 changed files with 22 additions and 15 deletions
  1. 20
    13
      Marlin/temperature.cpp
  2. 2
    2
      Marlin/temperature.h

+ 20
- 13
Marlin/temperature.cpp View File

@@ -517,17 +517,25 @@ void Temperature::_temp_error(int e, const char* serial_msg, const char* lcd_msg
517 517
   #endif
518 518
 }
519 519
 
520
-void Temperature::max_temp_error(uint8_t e) {
521
-  #if HOTENDS == 1
522
-    UNUSED(e);
520
+void Temperature::max_temp_error(int8_t e) {
521
+  #if HAS_TEMP_BED
522
+    _temp_error(e, PSTR(MSG_T_MAXTEMP), e >= 0 ? PSTR(MSG_ERR_MAXTEMP) : PSTR(MSG_ERR_MAXTEMP_BED));
523
+  #else
524
+    _temp_error(HOTEND_INDEX, PSTR(MSG_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP));
525
+    #if HOTENDS == 1
526
+      UNUSED(e);
527
+    #endif
523 528
   #endif
524
-  _temp_error(HOTEND_INDEX, PSTR(MSG_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP));
525 529
 }
526
-void Temperature::min_temp_error(uint8_t e) {
527
-  #if HOTENDS == 1
528
-    UNUSED(e);
530
+void Temperature::min_temp_error(int8_t e) {
531
+  #if HAS_TEMP_BED
532
+    _temp_error(e, PSTR(MSG_T_MINTEMP), e >= 0 ? PSTR(MSG_ERR_MINTEMP) : PSTR(MSG_ERR_MINTEMP_BED));
533
+  #else
534
+    _temp_error(HOTEND_INDEX, PSTR(MSG_T_MINTEMP), PSTR(MSG_ERR_MINTEMP));
535
+    #if HOTENDS == 1
536
+      UNUSED(e);
537
+    #endif
529 538
   #endif
530
-  _temp_error(HOTEND_INDEX, PSTR(MSG_T_MINTEMP), PSTR(MSG_ERR_MINTEMP));
531 539
 }
532 540
 
533 541
 float Temperature::get_pid_output(int e) {
@@ -675,9 +683,8 @@ void Temperature::manage_heater() {
675 683
   updateTemperaturesFromRawValues(); // also resets the watchdog
676 684
 
677 685
   #if ENABLED(HEATER_0_USES_MAX6675)
678
-    float ct = current_temperature[0];
679
-    if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0);
680
-    if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
686
+    if (current_temperature[0] > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0);
687
+    if (current_temperature[0] < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
681 688
   #endif
682 689
 
683 690
   #if (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0) || (ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0) || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN
@@ -1815,8 +1822,8 @@ void Temperature::isr() {
1815 1822
       #else
1816 1823
         #define GEBED >=
1817 1824
       #endif
1818
-      if (current_temperature_bed_raw GEBED bed_maxttemp_raw) _temp_error(-1, PSTR(MSG_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP_BED));
1819
-      if (bed_minttemp_raw GEBED current_temperature_bed_raw) _temp_error(-1, PSTR(MSG_T_MINTEMP), PSTR(MSG_ERR_MINTEMP_BED));
1825
+      if (current_temperature_bed_raw GEBED bed_maxttemp_raw) max_temp_error(-1);
1826
+      if (bed_minttemp_raw GEBED current_temperature_bed_raw && target_temperature_bed > 0.0f) min_temp_error(-1);
1820 1827
     #endif
1821 1828
 
1822 1829
   } // temp_count >= OVERSAMPLENR

+ 2
- 2
Marlin/temperature.h View File

@@ -437,8 +437,8 @@ class Temperature {
437 437
     #endif
438 438
 
439 439
     static void _temp_error(int e, const char* serial_msg, const char* lcd_msg);
440
-    static void min_temp_error(uint8_t e);
441
-    static void max_temp_error(uint8_t e);
440
+    static void min_temp_error(int8_t e);
441
+    static void max_temp_error(int8_t e);
442 442
 
443 443
     #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED
444 444
 

Loading…
Cancel
Save