Browse Source

Add HAS_HEATED_BED conditional (#10495)

Scott Lahteine 7 years ago
parent
commit
cb46cb8480
No account linked to committer's email address

+ 3
- 3
Marlin/src/HAL/HAL_STM32F1/HAL.cpp View File

80
   #if HAS_TEMP_4
80
   #if HAS_TEMP_4
81
     TEMP_4_PIN,
81
     TEMP_4_PIN,
82
   #endif
82
   #endif
83
-  #if HAS_TEMP_BED
83
+  #if HAS_HEATED_BED
84
     TEMP_BED_PIN,
84
     TEMP_BED_PIN,
85
   #endif
85
   #endif
86
   #if ENABLED(FILAMENT_WIDTH_SENSOR)
86
   #if ENABLED(FILAMENT_WIDTH_SENSOR)
104
   #if HAS_TEMP_4
104
   #if HAS_TEMP_4
105
     TEMP_4,
105
     TEMP_4,
106
   #endif
106
   #endif
107
-  #if HAS_TEMP_BED
107
+  #if HAS_HEATED_BED
108
     TEMP_BED,
108
     TEMP_BED,
109
   #endif
109
   #endif
110
   #if ENABLED(FILAMENT_WIDTH_SENSOR)
110
   #if ENABLED(FILAMENT_WIDTH_SENSOR)
211
     #if HAS_TEMP_4
211
     #if HAS_TEMP_4
212
       case TEMP_4_PIN: pin_index = TEMP_4; break;
212
       case TEMP_4_PIN: pin_index = TEMP_4; break;
213
     #endif
213
     #endif
214
-    #if HAS_TEMP_BED
214
+    #if HAS_HEATED_BED
215
       case TEMP_BED_PIN: pin_index = TEMP_BED; break;
215
       case TEMP_BED_PIN: pin_index = TEMP_BED; break;
216
     #endif
216
     #endif
217
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
217
     #if ENABLED(FILAMENT_WIDTH_SENSOR)

+ 1
- 1
Marlin/src/feature/leds/tempstat.cpp View File

37
   if (ELAPSED(millis(), next_status_led_update_ms)) {
37
   if (ELAPSED(millis(), next_status_led_update_ms)) {
38
     next_status_led_update_ms += 500; // Update every 0.5s
38
     next_status_led_update_ms += 500; // Update every 0.5s
39
     float max_temp = 0.0;
39
     float max_temp = 0.0;
40
-    #if HAS_TEMP_BED
40
+    #if HAS_HEATED_BED
41
       max_temp = MAX3(max_temp, thermalManager.degTargetBed(), thermalManager.degBed());
41
       max_temp = MAX3(max_temp, thermalManager.degTargetBed(), thermalManager.degBed());
42
     #endif
42
     #endif
43
     HOTEND_LOOP()
43
     HOTEND_LOOP()

+ 6
- 2
Marlin/src/feature/power_loss_recovery.cpp View File

67
           SERIAL_PROTOCOLPAIR("leveling: ", int(job_recovery_info.leveling));
67
           SERIAL_PROTOCOLPAIR("leveling: ", int(job_recovery_info.leveling));
68
           SERIAL_PROTOCOLLNPAIR(" fade: ", int(job_recovery_info.fade));
68
           SERIAL_PROTOCOLLNPAIR(" fade: ", int(job_recovery_info.fade));
69
         #endif
69
         #endif
70
-        SERIAL_PROTOCOLLNPAIR("target_temperature_bed: ", job_recovery_info.target_temperature_bed);
70
+        #if HAS_HEATED_BED
71
+          SERIAL_PROTOCOLLNPAIR("target_temperature_bed: ", job_recovery_info.target_temperature_bed);
72
+        #endif
71
         SERIAL_PROTOCOLLNPAIR("cmd_queue_index_r: ", job_recovery_info.cmd_queue_index_r);
73
         SERIAL_PROTOCOLLNPAIR("cmd_queue_index_r: ", job_recovery_info.cmd_queue_index_r);
72
         SERIAL_PROTOCOLLNPAIR("commands_in_queue: ", job_recovery_info.commands_in_queue);
74
         SERIAL_PROTOCOLLNPAIR("commands_in_queue: ", job_recovery_info.commands_in_queue);
73
         if (recovery)
75
         if (recovery)
196
     COPY(job_recovery_info.current_position, current_position);
198
     COPY(job_recovery_info.current_position, current_position);
197
     job_recovery_info.feedrate = feedrate_mm_s;
199
     job_recovery_info.feedrate = feedrate_mm_s;
198
     COPY(job_recovery_info.target_temperature, thermalManager.target_temperature);
200
     COPY(job_recovery_info.target_temperature, thermalManager.target_temperature);
199
-    job_recovery_info.target_temperature_bed = thermalManager.target_temperature_bed;
201
+    #if HAS_HEATED_BED
202
+      job_recovery_info.target_temperature_bed = thermalManager.target_temperature_bed;
203
+    #endif
200
     COPY(job_recovery_info.fanSpeeds, fanSpeeds);
204
     COPY(job_recovery_info.fanSpeeds, fanSpeeds);
201
 
205
 
202
     #if HAS_LEVELING
206
     #if HAS_LEVELING

+ 4
- 1
Marlin/src/feature/power_loss_recovery.h View File

41
   // Machine state
41
   // Machine state
42
   float current_position[NUM_AXIS], feedrate;
42
   float current_position[NUM_AXIS], feedrate;
43
   int16_t target_temperature[HOTENDS],
43
   int16_t target_temperature[HOTENDS],
44
-          target_temperature_bed,
45
           fanSpeeds[FAN_COUNT];
44
           fanSpeeds[FAN_COUNT];
46
 
45
 
46
+  #if HAS_HEATED_BED
47
+    int16_t target_temperature_bed;
48
+  #endif
49
+
47
   #if HAS_LEVELING
50
   #if HAS_LEVELING
48
     bool leveling;
51
     bool leveling;
49
     float fade;
52
     float fade;

+ 2
- 2
Marlin/src/gcode/bedlevel/G26.cpp View File

417
  */
417
  */
418
 inline bool turn_on_heaters() {
418
 inline bool turn_on_heaters() {
419
   millis_t next = millis() + 5000UL;
419
   millis_t next = millis() + 5000UL;
420
-  #if HAS_TEMP_BED
420
+  #if HAS_HEATED_BED
421
     #if ENABLED(ULTRA_LCD)
421
     #if ENABLED(ULTRA_LCD)
422
       if (g26_bed_temp > 25) {
422
       if (g26_bed_temp > 25) {
423
         lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99);
423
         lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99);
839
   #endif
839
   #endif
840
 
840
 
841
   if (!g26_keep_heaters_on) {
841
   if (!g26_keep_heaters_on) {
842
-    #if HAS_TEMP_BED
842
+    #if HAS_HEATED_BED
843
       thermalManager.setTargetBed(0);
843
       thermalManager.setTargetBed(0);
844
     #endif
844
     #endif
845
     thermalManager.setTargetHotend(0, 0);
845
     thermalManager.setTargetHotend(0, 0);

+ 1
- 1
Marlin/src/gcode/gcode.cpp View File

365
         case 113: M113(); break;                                  // M113: Set Host Keepalive interval
365
         case 113: M113(); break;                                  // M113: Set Host Keepalive interval
366
       #endif
366
       #endif
367
 
367
 
368
-      #if HAS_HEATER_BED && HAS_TEMP_BED
368
+      #if HAS_HEATED_BED
369
         case 140: M140(); break;                                  // M140: Set bed temperature
369
         case 140: M140(); break;                                  // M140: Set bed temperature
370
         case 190: M190(); break;                                  // M190: Wait for bed temperature to reach target
370
         case 190: M190(); break;                                  // M190: Wait for bed temperature to reach target
371
       #endif
371
       #endif

+ 1
- 1
Marlin/src/gcode/gcode.h View File

547
     #endif
547
     #endif
548
   #endif
548
   #endif
549
 
549
 
550
-  #if HAS_HEATER_BED && HAS_TEMP_BED
550
+  #if HAS_HEATED_BED
551
     static void M140();
551
     static void M140();
552
     static void M190();
552
     static void M190();
553
   #endif
553
   #endif

+ 2
- 2
Marlin/src/gcode/temperature/M140_M190.cpp View File

22
 
22
 
23
 #include "../../inc/MarlinConfig.h"
23
 #include "../../inc/MarlinConfig.h"
24
 
24
 
25
-#if HAS_HEATER_BED && HAS_TEMP_BED
25
+#if HAS_HEATED_BED
26
 
26
 
27
 #include "../gcode.h"
27
 #include "../gcode.h"
28
 #include "../../module/temperature.h"
28
 #include "../../module/temperature.h"
177
   #endif
177
   #endif
178
 }
178
 }
179
 
179
 
180
-#endif // HAS_HEATER_BED && HAS_TEMP_BED
180
+#endif // HAS_HEATED_BED

+ 5
- 3
Marlin/src/inc/Conditionals_post.h View File

764
 #define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
764
 #define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
765
 #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2)
765
 #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2)
766
 #define HAS_TEMP_CHAMBER (PIN_EXISTS(TEMP_CHAMBER) && TEMP_SENSOR_CHAMBER != 0 && TEMP_SENSOR_CHAMBER > -2)
766
 #define HAS_TEMP_CHAMBER (PIN_EXISTS(TEMP_CHAMBER) && TEMP_SENSOR_CHAMBER != 0 && TEMP_SENSOR_CHAMBER > -2)
767
-#define HAS_TEMP_SENSOR (HAS_TEMP_HOTEND || HAS_TEMP_BED || HAS_TEMP_CHAMBER)
768
 
767
 
769
 // Heaters
768
 // Heaters
770
 #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
769
 #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
774
 #define HAS_HEATER_4 (PIN_EXISTS(HEATER_4))
773
 #define HAS_HEATER_4 (PIN_EXISTS(HEATER_4))
775
 #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
774
 #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
776
 
775
 
776
+#define HAS_HEATED_BED (HAS_TEMP_BED && HAS_HEATER_BED)
777
+#define HAS_TEMP_SENSOR (HAS_TEMP_HOTEND || HAS_HEATED_BED || HAS_TEMP_CHAMBER)
778
+
777
 // Thermal protection
779
 // Thermal protection
778
-#define HAS_THERMALLY_PROTECTED_BED (ENABLED(THERMAL_PROTECTION_BED) && HAS_TEMP_BED && HAS_HEATER_BED)
780
+#define HAS_THERMALLY_PROTECTED_BED (HAS_HEATED_BED && ENABLED(THERMAL_PROTECTION_BED))
779
 #define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0)
781
 #define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0)
780
 #define WATCH_THE_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0)
782
 #define WATCH_THE_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0)
781
 
783
 
897
 /**
899
 /**
898
  * Heated bed requires settings
900
  * Heated bed requires settings
899
  */
901
  */
900
-#if HAS_HEATER_BED
902
+#if HAS_HEATED_BED
901
   #ifndef MAX_BED_POWER
903
   #ifndef MAX_BED_POWER
902
     #define MAX_BED_POWER 255
904
     #define MAX_BED_POWER 255
903
   #endif
905
   #endif

+ 4
- 4
Marlin/src/lcd/dogm/dogm_bitmaps.h View File

21
  */
21
  */
22
 
22
 
23
 /**
23
 /**
24
- * Standard Marlin Boot Screen bitmaps
24
+ * Standard Marlin Boot and Status Screen bitmaps
25
  *
25
  *
26
  * Use the Marlin Bitmap Converter to make your own:
26
  * Use the Marlin Bitmap Converter to make your own:
27
  * http://marlinfw.org/tools/u8glib/converter.html
27
  * http://marlinfw.org/tools/u8glib/converter.html
136
   // STATUS_SCREEN_HOTEND_TEXT_X(i) to modify draw locations.
136
   // STATUS_SCREEN_HOTEND_TEXT_X(i) to modify draw locations.
137
   #include "../../../_Statusscreen.h"
137
   #include "../../../_Statusscreen.h"
138
 
138
 
139
-#elif HAS_TEMP_BED
139
+#elif HAS_HEATED_BED
140
 
140
 
141
   #define STATUS_SCREEN_X        (  8 + (HOTENDS ? 0 : 64))
141
   #define STATUS_SCREEN_X        (  8 + (HOTENDS ? 0 : 64))
142
   #define STATUS_SCREENWIDTH     (120 - (HOTENDS ? 0 : 64))
142
   #define STATUS_SCREENWIDTH     (120 - (HOTENDS ? 0 : 64))
321
     };
321
     };
322
   #endif // HOTENDS
322
   #endif // HOTENDS
323
 
323
 
324
-#else // !HAS_TEMP_BED
324
+#else // !HAS_HEATED_BED
325
 
325
 
326
   #define STATUS_SCREEN_X        (  8 + (HOTENDS ? 0 : 96))
326
   #define STATUS_SCREEN_X        (  8 + (HOTENDS ? 0 : 96))
327
   #define STATUS_SCREENWIDTH     (120 - (HOTENDS ? 0 : 96))
327
   #define STATUS_SCREENWIDTH     (120 - (HOTENDS ? 0 : 96))
507
 
507
 
508
   #endif // HOTENDS
508
   #endif // HOTENDS
509
 
509
 
510
-#endif // !HAS_TEMP_BED
510
+#endif // !HAS_HEATED_BED
511
 
511
 
512
 #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY)
512
 #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY)
513
 
513
 

+ 28
- 12
Marlin/src/lcd/dogm/status_screen_DOGM.h View File

45
     UNUSED(blink);
45
     UNUSED(blink);
46
   #endif
46
   #endif
47
 
47
 
48
-  #if HAS_TEMP_BED
48
+  #if HAS_HEATED_BED
49
     const bool isBed = heater < 0;
49
     const bool isBed = heater < 0;
50
   #else
50
   #else
51
     constexpr bool isBed = false;
51
     constexpr bool isBed = false;
53
 
53
 
54
   if (PAGE_UNDER(7)) {
54
   if (PAGE_UNDER(7)) {
55
     #if HEATER_IDLE_HANDLER
55
     #if HEATER_IDLE_HANDLER
56
-      const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) :
57
-        #if HAS_TEMP_BED
58
-          thermalManager.is_bed_idle()
59
-        #else
60
-          false
56
+      const bool is_idle = (
57
+        #if HAS_HEATED_BED
58
+          isBed ? thermalManager.is_bed_idle() :
61
         #endif
59
         #endif
60
+        thermalManager.is_heater_idle(heater)
62
       );
61
       );
63
 
62
 
64
       if (blink || !is_idle)
63
       if (blink || !is_idle)
65
     #endif
64
     #endif
66
-    _draw_centered_temp((isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater)) + 0.5, x, 7); }
65
+        _draw_centered_temp(0.5 + (
66
+            #if HAS_HEATED_BED
67
+              isBed ? thermalManager.degTargetBed() :
68
+            #endif
69
+            thermalManager.degTargetHotend(heater)
70
+          ), x, 7
71
+        );
72
+  }
67
 
73
 
68
   if (PAGE_CONTAINS(21, 28))
74
   if (PAGE_CONTAINS(21, 28))
69
-    _draw_centered_temp((isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)) + 0.5, x, 28);
75
+    _draw_centered_temp(0.5 + (
76
+        #if HAS_HEATED_BED
77
+          isBed ? thermalManager.degBed() :
78
+        #endif
79
+        thermalManager.degHotend(heater)
80
+      ), x, 28
81
+    );
70
 
82
 
71
   if (PAGE_CONTAINS(17, 20)) {
83
   if (PAGE_CONTAINS(17, 20)) {
72
     const uint8_t h = isBed ? 7 : HEAT_INDICATOR_X,
84
     const uint8_t h = isBed ? 7 : HEAT_INDICATOR_X,
73
                   y = isBed ? 18 : 17;
85
                   y = isBed ? 18 : 17;
74
-    if (isBed ? thermalManager.isHeatingBed() : thermalManager.isHeatingHotend(heater)) {
86
+    if (
87
+      #if HAS_HEATED_BED
88
+        isBed ? thermalManager.isHeatingBed() :
89
+      #endif
90
+      thermalManager.isHeatingHotend(heater)
91
+    ) {
75
       u8g.setColorIndex(0); // white on black
92
       u8g.setColorIndex(0); // white on black
76
       u8g.drawBox(x + h, y, 2, 2);
93
       u8g.drawBox(x + h, y, 2, 2);
77
       u8g.setColorIndex(1); // black on white
94
       u8g.setColorIndex(1); // black on white
78
     }
95
     }
79
-    else {
96
+    else
80
       u8g.drawBox(x + h, y, 2, 2);
97
       u8g.drawBox(x + h, y, 2, 2);
81
-    }
82
   }
98
   }
83
 }
99
 }
84
 
100
 
199
     HOTEND_LOOP() _draw_heater_status(STATUS_SCREEN_HOTEND_TEXT_X(e), e, blink);
215
     HOTEND_LOOP() _draw_heater_status(STATUS_SCREEN_HOTEND_TEXT_X(e), e, blink);
200
 
216
 
201
     // Heated bed
217
     // Heated bed
202
-    #if HOTENDS < 4 && HAS_TEMP_BED
218
+    #if HOTENDS < 4 && HAS_HEATED_BED
203
       _draw_heater_status(STATUS_SCREEN_BED_TEXT_X, -1, blink);
219
       _draw_heater_status(STATUS_SCREEN_BED_TEXT_X, -1, blink);
204
     #endif
220
     #endif
205
 
221
 

+ 8
- 8
Marlin/src/lcd/dogm/status_screen_lite_ST7920.h View File

525
 static struct {
525
 static struct {
526
   bool E1_show_target  : 1;
526
   bool E1_show_target  : 1;
527
   bool E2_show_target  : 1;
527
   bool E2_show_target  : 1;
528
-  #if HAS_HEATER_BED
528
+  #if HAS_HEATED_BED
529
     bool bed_show_target : 1;
529
     bool bed_show_target : 1;
530
   #endif
530
   #endif
531
 } display_state = {
531
 } display_state = {
532
   true, true
532
   true, true
533
-  #if HAS_HEATER_BED
533
+  #if HAS_HEATED_BED
534
     , true
534
     , true
535
   #endif
535
   #endif
536
 };
536
 };
569
   display_state.E2_show_target = show_target;
569
   display_state.E2_show_target = show_target;
570
 }
570
 }
571
 
571
 
572
-#if HAS_HEATER_BED
572
+#if HAS_HEATED_BED
573
   void ST7920_Lite_Status_Screen::draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate) {
573
   void ST7920_Lite_Status_Screen::draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate) {
574
     const bool show_target = target && FAR(temp, target);
574
     const bool show_target = target && FAR(temp, target);
575
     draw_temps(2
575
     draw_temps(2
680
   #if EXTRUDERS == 2
680
   #if EXTRUDERS == 2
681
     const int16_t  extruder_2_target = thermalManager.degTargetHotend(1);
681
     const int16_t  extruder_2_target = thermalManager.degTargetHotend(1);
682
   #endif
682
   #endif
683
-  #if HAS_HEATER_BED
683
+  #if HAS_HEATED_BED
684
     const int16_t  bed_target        = thermalManager.degTargetBed();
684
     const int16_t  bed_target        = thermalManager.degTargetBed();
685
   #endif
685
   #endif
686
   static uint16_t last_checksum = 0;
686
   static uint16_t last_checksum = 0;
688
     #if EXTRUDERS == 2
688
     #if EXTRUDERS == 2
689
       ^ extruder_2_target
689
       ^ extruder_2_target
690
     #endif
690
     #endif
691
-    #if HAS_HEATER_BED
691
+    #if HAS_HEATED_BED
692
       ^ bed_target
692
       ^ bed_target
693
     #endif
693
     #endif
694
   ;
694
   ;
709
       const int16_t  extruder_2_temp   = thermalManager.degHotend(1),
709
       const int16_t  extruder_2_temp   = thermalManager.degHotend(1),
710
                      extruder_2_target = thermalManager.degTargetHotend(1);
710
                      extruder_2_target = thermalManager.degTargetHotend(1);
711
     #endif
711
     #endif
712
-    #if HAS_HEATER_BED
712
+    #if HAS_HEATED_BED
713
       const int16_t  bed_temp          = thermalManager.degBed(),
713
       const int16_t  bed_temp          = thermalManager.degBed(),
714
                      bed_target        = thermalManager.degTargetBed();
714
                      bed_target        = thermalManager.degTargetBed();
715
     #endif
715
     #endif
718
     #if EXTRUDERS == 2
718
     #if EXTRUDERS == 2
719
       draw_extruder_2_temp(extruder_2_temp, extruder_2_target, forceUpdate);
719
       draw_extruder_2_temp(extruder_2_temp, extruder_2_target, forceUpdate);
720
     #endif
720
     #endif
721
-    #if HAS_HEATER_BED
721
+    #if HAS_HEATED_BED
722
       draw_bed_temp(bed_temp, bed_target, forceUpdate);
722
       draw_bed_temp(bed_temp, bed_target, forceUpdate);
723
     #endif
723
     #endif
724
     draw_fan_speed(fan_speed);
724
     draw_fan_speed(fan_speed);
727
 
727
 
728
     // Update the fan and bed animations
728
     // Update the fan and bed animations
729
     if (fan_speed > 0) draw_fan_icon(blink);
729
     if (fan_speed > 0) draw_fan_icon(blink);
730
-    #if HAS_HEATER_BED
730
+    #if HAS_HEATED_BED
731
       if (bed_target > 0)
731
       if (bed_target > 0)
732
         draw_heat_icon(blink, true);
732
         draw_heat_icon(blink, true);
733
       else
733
       else

+ 15
- 13
Marlin/src/lcd/ultralcd.cpp View File

893
         #endif
893
         #endif
894
       ));
894
       ));
895
 
895
 
896
-      // Restore the bed temperature
897
-      sprintf_P(cmd, PSTR("M190 S%i"), job_recovery_info.target_temperature_bed);
898
-      enqueue_and_echo_command(cmd);
896
+      #if HAS_HEATED_BED
897
+        // Restore the bed temperature
898
+        sprintf_P(cmd, PSTR("M190 S%i"), job_recovery_info.target_temperature_bed);
899
+        enqueue_and_echo_command(cmd);
900
+      #endif
899
 
901
 
900
       // Restore all hotend temperatures
902
       // Restore all hotend temperatures
901
       HOTEND_LOOP() {
903
       HOTEND_LOOP() {
1431
     //
1433
     //
1432
     // Bed:
1434
     // Bed:
1433
     //
1435
     //
1434
-    #if HAS_TEMP_BED
1436
+    #if HAS_HEATED_BED
1435
       MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
1437
       MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
1436
     #endif
1438
     #endif
1437
 
1439
 
2136
                x_plot = 0,
2138
                x_plot = 0,
2137
                y_plot = 0;
2139
                y_plot = 0;
2138
 
2140
 
2139
-    #if HAS_TEMP_BED
2141
+    #if HAS_HEATED_BED
2140
       static int16_t custom_bed_temp = 50;
2142
       static int16_t custom_bed_temp = 50;
2141
     #endif
2143
     #endif
2142
 
2144
 
2146
     void _lcd_ubl_build_custom_mesh() {
2148
     void _lcd_ubl_build_custom_mesh() {
2147
       char UBL_LCD_GCODE[20];
2149
       char UBL_LCD_GCODE[20];
2148
       enqueue_and_echo_commands_P(PSTR("G28"));
2150
       enqueue_and_echo_commands_P(PSTR("G28"));
2149
-      #if HAS_TEMP_BED
2151
+      #if HAS_HEATED_BED
2150
         sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp);
2152
         sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp);
2151
         lcd_enqueue_command(UBL_LCD_GCODE);
2153
         lcd_enqueue_command(UBL_LCD_GCODE);
2152
       #endif
2154
       #endif
2167
       START_MENU();
2169
       START_MENU();
2168
       MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
2170
       MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
2169
       MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_HOTEND_TEMP, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10));
2171
       MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_HOTEND_TEMP, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10));
2170
-      #if HAS_TEMP_BED
2172
+      #if HAS_HEATED_BED
2171
         MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_BED_TEMP, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 15));
2173
         MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_BED_TEMP, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 15));
2172
       #endif
2174
       #endif
2173
       MENU_ITEM(function, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh);
2175
       MENU_ITEM(function, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh);
2226
     void _lcd_ubl_validate_custom_mesh() {
2228
     void _lcd_ubl_validate_custom_mesh() {
2227
       char UBL_LCD_GCODE[24];
2229
       char UBL_LCD_GCODE[24];
2228
       const int temp =
2230
       const int temp =
2229
-        #if HAS_TEMP_BED
2231
+        #if HAS_HEATED_BED
2230
           custom_bed_temp
2232
           custom_bed_temp
2231
         #else
2233
         #else
2232
           0
2234
           0
2249
     void _lcd_ubl_validate_mesh() {
2251
     void _lcd_ubl_validate_mesh() {
2250
       START_MENU();
2252
       START_MENU();
2251
       MENU_BACK(MSG_UBL_TOOLS);
2253
       MENU_BACK(MSG_UBL_TOOLS);
2252
-      #if HAS_TEMP_BED
2254
+      #if HAS_HEATED_BED
2253
         MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED) " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P"));
2255
         MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED) " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P"));
2254
         MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
2256
         MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
2255
       #else
2257
       #else
2353
     void _lcd_ubl_build_mesh() {
2355
     void _lcd_ubl_build_mesh() {
2354
       START_MENU();
2356
       START_MENU();
2355
       MENU_BACK(MSG_UBL_TOOLS);
2357
       MENU_BACK(MSG_UBL_TOOLS);
2356
-      #if HAS_TEMP_BED
2358
+      #if HAS_HEATED_BED
2357
         MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR(
2359
         MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR(
2358
           "G28\n"
2360
           "G28\n"
2359
           "M190 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\n"
2361
           "M190 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\n"
2746
       //
2748
       //
2747
       bool has_heat = false;
2749
       bool has_heat = false;
2748
       HOTEND_LOOP() if (thermalManager.target_temperature[HOTEND_INDEX]) { has_heat = true; break; }
2750
       HOTEND_LOOP() if (thermalManager.target_temperature[HOTEND_INDEX]) { has_heat = true; break; }
2749
-      #if HAS_TEMP_BED
2751
+      #if HAS_HEATED_BED
2750
         if (thermalManager.target_temperature_bed) has_heat = true;
2752
         if (thermalManager.target_temperature_bed) has_heat = true;
2751
       #endif
2753
       #endif
2752
       if (has_heat) MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
2754
       if (has_heat) MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
3466
     //
3468
     //
3467
     // Bed:
3469
     // Bed:
3468
     //
3470
     //
3469
-    #if HAS_TEMP_BED
3471
+    #if HAS_HEATED_BED
3470
       MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
3472
       MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
3471
     #endif
3473
     #endif
3472
 
3474
 
5117
       }
5119
       }
5118
     #endif
5120
     #endif
5119
 
5121
 
5120
-  #endif
5122
+  #endif // ULTIPANEL
5121
 
5123
 
5122
   #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
5124
   #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
5123
 
5125
 

+ 8
- 10
Marlin/src/lcd/ultralcd_impl_HD44780.h View File

476
 }
476
 }
477
 
477
 
478
 FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, const bool blink) {
478
 FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, const bool blink) {
479
-  #if TEMP_SENSOR_BED
479
+  #if HAS_HEATED_BED
480
     const bool isBed = heater < 0;
480
     const bool isBed = heater < 0;
481
+    const float t1 = (isBed ? thermalManager.degBed()       : thermalManager.degHotend(heater)),
482
+                t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
481
   #else
483
   #else
482
-    constexpr bool isBed = false;
484
+    const float t1 = thermalManager.degHotend(heater), t2 = thermalManager.degTargetHotend(heater);
483
   #endif
485
   #endif
484
 
486
 
485
-  const float t1 = (isBed ? thermalManager.degBed()       : thermalManager.degHotend(heater)),
486
-              t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
487
-
488
   if (prefix >= 0) lcd_put_wchar(prefix);
487
   if (prefix >= 0) lcd_put_wchar(prefix);
489
 
488
 
490
   lcd_put_u8str(itostr3(t1 + 0.5));
489
   lcd_put_u8str(itostr3(t1 + 0.5));
493
   #if !HEATER_IDLE_HANDLER
492
   #if !HEATER_IDLE_HANDLER
494
     UNUSED(blink);
493
     UNUSED(blink);
495
   #else
494
   #else
496
-    const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) :
497
-      #if HAS_TEMP_BED
498
-        thermalManager.is_bed_idle()
499
-      #else
500
-        false
495
+    const bool is_idle = (
496
+      #if HAS_HEATED_BED
497
+        isBed ? thermalManager.is_bed_idle() :
501
       #endif
498
       #endif
499
+      thermalManager.is_heater_idle(heater)
502
     );
500
     );
503
 
501
 
504
     if (!blink && is_idle) {
502
     if (!blink && is_idle) {

+ 1
- 1
Marlin/src/module/motion.cpp View File

1056
     }
1056
     }
1057
   #endif
1057
   #endif
1058
 
1058
 
1059
-  #if HOMING_Z_WITH_PROBE && HAS_TEMP_BED && ENABLED(WAIT_FOR_BED_HEATER)
1059
+  #if HOMING_Z_WITH_PROBE && HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)
1060
     // Wait for bed to heat back up between probing points
1060
     // Wait for bed to heat back up between probing points
1061
     if (axis == Z_AXIS && distance < 0 && thermalManager.isHeatingBed()) {
1061
     if (axis == Z_AXIS && distance < 0 && thermalManager.isHeatingBed()) {
1062
       serialprintPGM(msg_wait_for_bed_heating);
1062
       serialprintPGM(msg_wait_for_bed_heating);

+ 2
- 2
Marlin/src/module/probe.cpp View File

483
  * @return true to indicate an error
483
  * @return true to indicate an error
484
  */
484
  */
485
 
485
 
486
-#if HAS_TEMP_BED && ENABLED(WAIT_FOR_BED_HEATER)
486
+#if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)
487
   const char msg_wait_for_bed_heating[25] PROGMEM = "Wait for bed heating...\n";
487
   const char msg_wait_for_bed_heating[25] PROGMEM = "Wait for bed heating...\n";
488
 #endif
488
 #endif
489
 
489
 
492
     if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position);
492
     if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position);
493
   #endif
493
   #endif
494
 
494
 
495
-  #if HAS_TEMP_BED && ENABLED(WAIT_FOR_BED_HEATER)
495
+  #if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)
496
     // Wait for bed to heat back up between probing points
496
     // Wait for bed to heat back up between probing points
497
     if (thermalManager.isHeatingBed()) {
497
     if (thermalManager.isHeatingBed()) {
498
       serialprintPGM(msg_wait_for_bed_heating);
498
       serialprintPGM(msg_wait_for_bed_heating);

+ 1
- 1
Marlin/src/module/probe.h View File

44
   float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true);
44
   float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true);
45
   #define DEPLOY_PROBE() set_probe_deployed(true)
45
   #define DEPLOY_PROBE() set_probe_deployed(true)
46
   #define STOW_PROBE() set_probe_deployed(false)
46
   #define STOW_PROBE() set_probe_deployed(false)
47
-  #if HAS_TEMP_BED && ENABLED(WAIT_FOR_BED_HEATER)
47
+  #if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)
48
     extern const char msg_wait_for_bed_heating[25];
48
     extern const char msg_wait_for_bed_heating[25];
49
   #endif
49
   #endif
50
 #else
50
 #else

+ 114
- 100
Marlin/src/module/temperature.cpp View File

63
  * Macros to include the heater id in temp errors. The compiler's dead-code
63
  * Macros to include the heater id in temp errors. The compiler's dead-code
64
  * elimination should (hopefully) optimize out the unused strings.
64
  * elimination should (hopefully) optimize out the unused strings.
65
  */
65
  */
66
-#if HAS_TEMP_BED
66
+#if HAS_HEATED_BED
67
   #define TEMP_ERR_PSTR(MSG, E) \
67
   #define TEMP_ERR_PSTR(MSG, E) \
68
     (E) == -1 ? PSTR(MSG ## _BED) : \
68
     (E) == -1 ? PSTR(MSG ## _BED) : \
69
     (HOTENDS > 1 && (E) == 1) ? PSTR(MSG_E2 " " MSG) : \
69
     (HOTENDS > 1 && (E) == 1) ? PSTR(MSG_E2 " " MSG) : \
82
 
82
 
83
 // public:
83
 // public:
84
 
84
 
85
-float Temperature::current_temperature[HOTENDS] = { 0.0 },
86
-      Temperature::current_temperature_chamber = 0.0,
87
-      Temperature::current_temperature_bed = 0.0;
88
-
85
+float Temperature::current_temperature[HOTENDS] = { 0.0 };
89
 int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
86
 int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
90
-        Temperature::target_temperature[HOTENDS] = { 0 },
91
-        Temperature::current_temperature_chamber_raw = 0,
92
-        Temperature::current_temperature_bed_raw = 0;
87
+        Temperature::target_temperature[HOTENDS] = { 0 };
93
 
88
 
94
 #if ENABLED(AUTO_POWER_E_FANS)
89
 #if ENABLED(AUTO_POWER_E_FANS)
95
   int16_t Temperature::autofan_speed[HOTENDS] = { 0 };
90
   int16_t Temperature::autofan_speed[HOTENDS] = { 0 };
96
 #endif
91
 #endif
97
 
92
 
98
-#if HAS_HEATER_BED
99
-  int16_t Temperature::target_temperature_bed = 0;
93
+#if HAS_HEATED_BED
94
+  float Temperature::current_temperature_bed = 0.0;
95
+  int16_t Temperature::current_temperature_bed_raw = 0,
96
+          Temperature::target_temperature_bed = 0;
97
+  uint8_t Temperature::soft_pwm_amount_bed;
98
+  #ifdef BED_MINTEMP
99
+    int16_t Temperature::bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP;
100
+  #endif
101
+  #ifdef BED_MAXTEMP
102
+    int16_t Temperature::bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP;
103
+  #endif
104
+  #if WATCH_THE_BED
105
+    uint16_t Temperature::watch_target_bed_temp = 0;
106
+    millis_t Temperature::watch_bed_next_ms = 0;
107
+  #endif
108
+  #if ENABLED(PIDTEMPBED)
109
+    float Temperature::bedKp, Temperature::bedKi, Temperature::bedKd, // Initialized by settings.load()
110
+          Temperature::temp_iState_bed = { 0 },
111
+          Temperature::temp_dState_bed = { 0 },
112
+          Temperature::pTerm_bed,
113
+          Temperature::iTerm_bed,
114
+          Temperature::dTerm_bed,
115
+          Temperature::pid_error_bed;
116
+  #else
117
+    millis_t Temperature::next_bed_check_ms;
118
+  #endif
119
+  uint16_t Temperature::raw_temp_bed_value = 0;
120
+  #if HEATER_IDLE_HANDLER
121
+    millis_t Temperature::bed_idle_timeout_ms = 0;
122
+    bool Temperature::bed_idle_timeout_exceeded = false;
123
+  #endif
124
+#endif // HAS_HEATED_BED
125
+
126
+#if HAS_TEMP_CHAMBER
127
+  float Temperature::current_temperature_chamber = 0.0;
128
+  int16_t Temperature::current_temperature_chamber_raw = 0;
129
+  uint16_t Temperature::raw_temp_chamber_value = 0;
100
 #endif
130
 #endif
101
 
131
 
102
 // Initialized by settings.load()
132
 // Initialized by settings.load()
114
   #endif
144
   #endif
115
 #endif
145
 #endif
116
 
146
 
117
-// Initialized by settings.load()
118
-#if ENABLED(PIDTEMPBED)
119
-  float Temperature::bedKp, Temperature::bedKi, Temperature::bedKd;
120
-#endif
121
-
122
 #if ENABLED(BABYSTEPPING)
147
 #if ENABLED(BABYSTEPPING)
123
   volatile int Temperature::babystepsTodo[XYZ] = { 0 };
148
   volatile int Temperature::babystepsTodo[XYZ] = { 0 };
124
 #endif
149
 #endif
128
   millis_t Temperature::watch_heater_next_ms[HOTENDS] = { 0 };
153
   millis_t Temperature::watch_heater_next_ms[HOTENDS] = { 0 };
129
 #endif
154
 #endif
130
 
155
 
131
-#if WATCH_THE_BED
132
-  uint16_t Temperature::watch_target_bed_temp = 0;
133
-  millis_t Temperature::watch_bed_next_ms = 0;
134
-#endif
135
-
136
 #if ENABLED(PREVENT_COLD_EXTRUSION)
156
 #if ENABLED(PREVENT_COLD_EXTRUSION)
137
   bool Temperature::allow_cold_extrude = false;
157
   bool Temperature::allow_cold_extrude = false;
138
   int16_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
158
   int16_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
169
   bool Temperature::pid_reset[HOTENDS];
189
   bool Temperature::pid_reset[HOTENDS];
170
 #endif
190
 #endif
171
 
191
 
172
-#if ENABLED(PIDTEMPBED)
173
-  float Temperature::temp_iState_bed = { 0 },
174
-        Temperature::temp_dState_bed = { 0 },
175
-        Temperature::pTerm_bed,
176
-        Temperature::iTerm_bed,
177
-        Temperature::dTerm_bed,
178
-        Temperature::pid_error_bed;
179
-#else
180
-  millis_t Temperature::next_bed_check_ms;
181
-#endif
182
-
183
-uint16_t Temperature::raw_temp_value[MAX_EXTRUDERS] = { 0 },
184
-         Temperature::raw_temp_chamber_value = 0,
185
-         Temperature::raw_temp_bed_value = 0;
192
+uint16_t Temperature::raw_temp_value[MAX_EXTRUDERS] = { 0 };
186
 
193
 
187
 // Init min and max temp with extreme values to prevent false errors during startup
194
 // Init min and max temp with extreme values to prevent false errors during startup
188
 int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP, HEATER_3_RAW_LO_TEMP, HEATER_4_RAW_LO_TEMP),
195
 int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP, HEATER_3_RAW_LO_TEMP, HEATER_4_RAW_LO_TEMP),
198
   millis_t Temperature::preheat_end_time[HOTENDS] = { 0 };
205
   millis_t Temperature::preheat_end_time[HOTENDS] = { 0 };
199
 #endif
206
 #endif
200
 
207
 
201
-#ifdef BED_MINTEMP
202
-  int16_t Temperature::bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP;
203
-#endif
204
-
205
-#ifdef BED_MAXTEMP
206
-  int16_t Temperature::bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP;
207
-#endif
208
-
209
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
208
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
210
   int8_t Temperature::meas_shift_index;  // Index of a delayed sample in buffer
209
   int8_t Temperature::meas_shift_index;  // Index of a delayed sample in buffer
211
 #endif
210
 #endif
214
   millis_t Temperature::next_auto_fan_check_ms = 0;
213
   millis_t Temperature::next_auto_fan_check_ms = 0;
215
 #endif
214
 #endif
216
 
215
 
217
-uint8_t Temperature::soft_pwm_amount[HOTENDS],
218
-        Temperature::soft_pwm_amount_bed;
216
+uint8_t Temperature::soft_pwm_amount[HOTENDS];
219
 
217
 
220
 #if ENABLED(FAN_SOFT_PWM)
218
 #if ENABLED(FAN_SOFT_PWM)
221
   uint8_t Temperature::soft_pwm_amount_fan[FAN_COUNT],
219
   uint8_t Temperature::soft_pwm_amount_fan[FAN_COUNT],
233
 #if HEATER_IDLE_HANDLER
231
 #if HEATER_IDLE_HANDLER
234
   millis_t Temperature::heater_idle_timeout_ms[HOTENDS] = { 0 };
232
   millis_t Temperature::heater_idle_timeout_ms[HOTENDS] = { 0 };
235
   bool Temperature::heater_idle_timeout_exceeded[HOTENDS] = { false };
233
   bool Temperature::heater_idle_timeout_exceeded[HOTENDS] = { false };
236
-  #if HAS_TEMP_BED
237
-    millis_t Temperature::bed_idle_timeout_ms = 0;
238
-    bool Temperature::bed_idle_timeout_exceeded = false;
239
-  #endif
240
 #endif
234
 #endif
241
 
235
 
242
 #if ENABLED(ADC_KEYPAD)
236
 #if ENABLED(ADC_KEYPAD)
546
 
540
 
547
 Temperature::Temperature() { }
541
 Temperature::Temperature() { }
548
 
542
 
549
-int Temperature::getHeaterPower(int heater) {
550
-  return heater < 0 ? soft_pwm_amount_bed : soft_pwm_amount[heater];
543
+int Temperature::getHeaterPower(const int heater) {
544
+  return (
545
+    #if HAS_HEATED_BED
546
+      heater < 0 ? soft_pwm_amount_bed :
547
+    #endif
548
+    soft_pwm_amount[heater]
549
+  );
551
 }
550
 }
552
 
551
 
553
 #if HAS_AUTO_FAN
552
 #if HAS_AUTO_FAN
618
 void Temperature::max_temp_error(const int8_t e) {
617
 void Temperature::max_temp_error(const int8_t e) {
619
   _temp_error(e, PSTR(MSG_T_MAXTEMP), TEMP_ERR_PSTR(MSG_ERR_MAXTEMP, e));
618
   _temp_error(e, PSTR(MSG_T_MAXTEMP), TEMP_ERR_PSTR(MSG_ERR_MAXTEMP, e));
620
 }
619
 }
620
+
621
 void Temperature::min_temp_error(const int8_t e) {
621
 void Temperature::min_temp_error(const int8_t e) {
622
   _temp_error(e, PSTR(MSG_T_MINTEMP), TEMP_ERR_PSTR(MSG_ERR_MINTEMP, e));
622
   _temp_error(e, PSTR(MSG_T_MINTEMP), TEMP_ERR_PSTR(MSG_ERR_MINTEMP, e));
623
 }
623
 }
857
     }
857
     }
858
   #endif // FILAMENT_WIDTH_SENSOR
858
   #endif // FILAMENT_WIDTH_SENSOR
859
 
859
 
860
-  #if WATCH_THE_BED
861
-    // Make sure temperature is increasing
862
-    if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) {        // Time to check the bed?
863
-      if (degBed() < watch_target_bed_temp)                           // Failed to increase enough?
864
-        _temp_error(-1, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, -1));
865
-      else                                                            // Start again if the target is still far off
866
-        start_watching_bed();
867
-    }
868
-  #endif // WATCH_THE_BED
860
+  #if HAS_HEATED_BED
861
+
862
+    #if WATCH_THE_BED
863
+      // Make sure temperature is increasing
864
+      if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) {        // Time to check the bed?
865
+        if (degBed() < watch_target_bed_temp)                           // Failed to increase enough?
866
+          _temp_error(-1, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, -1));
867
+        else                                                            // Start again if the target is still far off
868
+          start_watching_bed();
869
+      }
870
+    #endif // WATCH_THE_BED
869
 
871
 
870
-  #if DISABLED(PIDTEMPBED)
871
-    if (PENDING(ms, next_bed_check_ms)
872
+    #if DISABLED(PIDTEMPBED)
873
+      if (PENDING(ms, next_bed_check_ms)
874
+        #if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING)
875
+          && paused == last_pause_state
876
+        #endif
877
+      ) return;
878
+      next_bed_check_ms = ms + BED_CHECK_INTERVAL;
872
       #if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING)
879
       #if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING)
873
-        && paused == last_pause_state
880
+        last_pause_state = paused;
874
       #endif
881
       #endif
875
-    ) return;
876
-    next_bed_check_ms = ms + BED_CHECK_INTERVAL;
877
-    #if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING)
878
-      last_pause_state = paused;
879
     #endif
882
     #endif
880
-  #endif
881
-
882
-  #if HAS_TEMP_BED
883
 
883
 
884
     #if HEATER_IDLE_HANDLER
884
     #if HEATER_IDLE_HANDLER
885
       if (!bed_idle_timeout_exceeded && bed_idle_timeout_ms && ELAPSED(ms, bed_idle_timeout_ms))
885
       if (!bed_idle_timeout_exceeded && bed_idle_timeout_ms && ELAPSED(ms, bed_idle_timeout_ms))
920
         }
920
         }
921
       #endif
921
       #endif
922
     }
922
     }
923
-  #endif // HAS_TEMP_BED
923
+  #endif // HAS_HEATED_BED
924
 }
924
 }
925
 
925
 
926
 #define PGM_RD_W(x)   (short)pgm_read_word(&x)
926
 #define PGM_RD_W(x)   (short)pgm_read_word(&x)
968
   return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN)) + TEMP_SENSOR_AD595_OFFSET;
968
   return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN)) + TEMP_SENSOR_AD595_OFFSET;
969
 }
969
 }
970
 
970
 
971
-#if HAS_TEMP_BED
971
+#if HAS_HEATED_BED
972
   // Derived from RepRap FiveD extruder::getTemperature()
972
   // Derived from RepRap FiveD extruder::getTemperature()
973
   // For bed temperature measurement.
973
   // For bed temperature measurement.
974
   float Temperature::analog2tempBed(const int raw) {
974
   float Temperature::analog2tempBed(const int raw) {
1002
 
1002
 
1003
     #endif
1003
     #endif
1004
   }
1004
   }
1005
-#endif // HAS_TEMP_BED
1005
+#endif // HAS_HEATED_BED
1006
 
1006
 
1007
 #if HAS_TEMP_CHAMBER
1007
 #if HAS_TEMP_CHAMBER
1008
   // Derived from RepRap FiveD extruder::getTemperature()
1008
   // Derived from RepRap FiveD extruder::getTemperature()
1052
   #endif
1052
   #endif
1053
   HOTEND_LOOP()
1053
   HOTEND_LOOP()
1054
     current_temperature[e] = Temperature::analog2temp(current_temperature_raw[e], e);
1054
     current_temperature[e] = Temperature::analog2temp(current_temperature_raw[e], e);
1055
-  #if HAS_TEMP_BED
1055
+  #if HAS_HEATED_BED
1056
     current_temperature_bed = Temperature::analog2tempBed(current_temperature_bed_raw);
1056
     current_temperature_bed = Temperature::analog2tempBed(current_temperature_bed_raw);
1057
   #endif
1057
   #endif
1058
   #if HAS_TEMP_CHAMBER
1058
   #if HAS_TEMP_CHAMBER
1149
   #if HAS_HEATER_4
1149
   #if HAS_HEATER_4
1150
     OUT_WRITE(HEATER_3_PIN, HEATER_4_INVERTING);
1150
     OUT_WRITE(HEATER_3_PIN, HEATER_4_INVERTING);
1151
   #endif
1151
   #endif
1152
-  #if HAS_HEATER_BED
1152
+  #if HAS_HEATED_BED
1153
     OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING);
1153
     OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING);
1154
   #endif
1154
   #endif
1155
 
1155
 
1204
   #if HAS_TEMP_4
1204
   #if HAS_TEMP_4
1205
     HAL_ANALOG_SELECT(TEMP_4_PIN);
1205
     HAL_ANALOG_SELECT(TEMP_4_PIN);
1206
   #endif
1206
   #endif
1207
-  #if HAS_TEMP_BED
1207
+  #if HAS_HEATED_BED
1208
     HAL_ANALOG_SELECT(TEMP_BED_PIN);
1208
     HAL_ANALOG_SELECT(TEMP_BED_PIN);
1209
   #endif
1209
   #endif
1210
   #if HAS_TEMP_CHAMBER
1210
   #if HAS_TEMP_CHAMBER
1345
     #endif // HOTENDS > 2
1345
     #endif // HOTENDS > 2
1346
   #endif // HOTENDS > 1
1346
   #endif // HOTENDS > 1
1347
 
1347
 
1348
-  #if HAS_TEMP_BED
1348
+  #if HAS_HEATED_BED
1349
     #ifdef BED_MINTEMP
1349
     #ifdef BED_MINTEMP
1350
       while (analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) {
1350
       while (analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) {
1351
         #if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP
1351
         #if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP
1364
         #endif
1364
         #endif
1365
       }
1365
       }
1366
     #endif // BED_MAXTEMP
1366
     #endif // BED_MAXTEMP
1367
-  #endif // HAS_TEMP_BED
1367
+  #endif // HAS_HEATED_BED
1368
 
1368
 
1369
   #if ENABLED(PROBING_HEATERS_OFF)
1369
   #if ENABLED(PROBING_HEATERS_OFF)
1370
     paused = false;
1370
     paused = false;
1483
     #if HEATER_IDLE_HANDLER
1483
     #if HEATER_IDLE_HANDLER
1484
       // If the heater idle timeout expires, restart
1484
       // If the heater idle timeout expires, restart
1485
       if ((heater_id >= 0 && heater_idle_timeout_exceeded[heater_id])
1485
       if ((heater_id >= 0 && heater_idle_timeout_exceeded[heater_id])
1486
-        #if HAS_TEMP_BED
1486
+        #if HAS_HEATED_BED
1487
           || (heater_id < 0 && bed_idle_timeout_exceeded)
1487
           || (heater_id < 0 && bed_idle_timeout_exceeded)
1488
         #endif
1488
         #endif
1489
       ) {
1489
       ) {
1529
   #endif
1529
   #endif
1530
 
1530
 
1531
   HOTEND_LOOP() setTargetHotend(0, e);
1531
   HOTEND_LOOP() setTargetHotend(0, e);
1532
-  setTargetBed(0);
1532
+
1533
+  #if HAS_HEATED_BED
1534
+    setTargetBed(0);
1535
+  #endif
1533
 
1536
 
1534
   // Unpause and reset everything
1537
   // Unpause and reset everything
1535
   #if ENABLED(PROBING_HEATERS_OFF)
1538
   #if ENABLED(PROBING_HEATERS_OFF)
1561
     #endif // HOTENDS > 1
1564
     #endif // HOTENDS > 1
1562
   #endif
1565
   #endif
1563
 
1566
 
1564
-  #if HAS_TEMP_BED
1567
+  #if HAS_HEATED_BED
1565
     target_temperature_bed = 0;
1568
     target_temperature_bed = 0;
1566
     soft_pwm_amount_bed = 0;
1569
     soft_pwm_amount_bed = 0;
1567
-    #if HAS_HEATER_BED
1570
+    #if HAS_HEATED_BED
1568
       WRITE_HEATER_BED(LOW);
1571
       WRITE_HEATER_BED(LOW);
1569
     #endif
1572
     #endif
1570
   #endif
1573
   #endif
1577
       paused = p;
1580
       paused = p;
1578
       if (p) {
1581
       if (p) {
1579
         HOTEND_LOOP() start_heater_idle_timer(e, 0); // timeout immediately
1582
         HOTEND_LOOP() start_heater_idle_timer(e, 0); // timeout immediately
1580
-        #if HAS_TEMP_BED
1583
+        #if HAS_HEATED_BED
1581
           start_bed_idle_timer(0); // timeout immediately
1584
           start_bed_idle_timer(0); // timeout immediately
1582
         #endif
1585
         #endif
1583
       }
1586
       }
1584
       else {
1587
       else {
1585
         HOTEND_LOOP() reset_heater_idle_timer(e);
1588
         HOTEND_LOOP() reset_heater_idle_timer(e);
1586
-        #if HAS_TEMP_BED
1589
+        #if HAS_HEATED_BED
1587
           reset_bed_idle_timer();
1590
           reset_bed_idle_timer();
1588
         #endif
1591
         #endif
1589
       }
1592
       }
1687
       #endif
1690
       #endif
1688
     #endif
1691
     #endif
1689
   #endif
1692
   #endif
1690
-  current_temperature_bed_raw = raw_temp_bed_value;
1691
-  current_temperature_chamber_raw = raw_temp_chamber_value;
1693
+
1694
+  #if HAS_HEATED_BED
1695
+    current_temperature_bed_raw = raw_temp_bed_value;
1696
+  #endif
1697
+  #if HAS_TEMP_CHAMBER
1698
+    current_temperature_chamber_raw = raw_temp_chamber_value;
1699
+  #endif
1692
   temp_meas_ready = true;
1700
   temp_meas_ready = true;
1693
 }
1701
 }
1694
 
1702
 
1759
       #endif // HOTENDS > 3
1767
       #endif // HOTENDS > 3
1760
     #endif // HOTENDS > 2
1768
     #endif // HOTENDS > 2
1761
   #endif // HOTENDS > 1
1769
   #endif // HOTENDS > 1
1762
-  #if HAS_HEATER_BED
1770
+  #if HAS_HEATED_BED
1763
     ISR_STATICS(BED);
1771
     ISR_STATICS(BED);
1764
   #endif
1772
   #endif
1765
 
1773
 
1800
         #endif // HOTENDS > 2
1808
         #endif // HOTENDS > 2
1801
       #endif // HOTENDS > 1
1809
       #endif // HOTENDS > 1
1802
 
1810
 
1803
-      #if HAS_HEATER_BED
1811
+      #if HAS_HEATED_BED
1804
         soft_pwm_count_BED = (soft_pwm_count_BED & pwm_mask) + soft_pwm_amount_bed;
1812
         soft_pwm_count_BED = (soft_pwm_count_BED & pwm_mask) + soft_pwm_amount_bed;
1805
         WRITE_HEATER_BED(soft_pwm_count_BED > pwm_mask ? HIGH : LOW);
1813
         WRITE_HEATER_BED(soft_pwm_count_BED > pwm_mask ? HIGH : LOW);
1806
       #endif
1814
       #endif
1835
         #endif // HOTENDS > 2
1843
         #endif // HOTENDS > 2
1836
       #endif // HOTENDS > 1
1844
       #endif // HOTENDS > 1
1837
 
1845
 
1838
-      #if HAS_HEATER_BED
1846
+      #if HAS_HEATED_BED
1839
         if (soft_pwm_count_BED <= pwm_count_tmp) WRITE_HEATER_BED(LOW);
1847
         if (soft_pwm_count_BED <= pwm_count_tmp) WRITE_HEATER_BED(LOW);
1840
       #endif
1848
       #endif
1841
 
1849
 
1916
           #endif // HOTENDS > 3
1924
           #endif // HOTENDS > 3
1917
         #endif // HOTENDS > 2
1925
         #endif // HOTENDS > 2
1918
       #endif // HOTENDS > 1
1926
       #endif // HOTENDS > 1
1919
-      #if HAS_HEATER_BED
1927
+      #if HAS_HEATED_BED
1920
         _SLOW_PWM_ROUTINE(BED, soft_pwm_amount_bed); // BED
1928
         _SLOW_PWM_ROUTINE(BED, soft_pwm_amount_bed); // BED
1921
       #endif
1929
       #endif
1922
 
1930
 
1935
         #endif // HOTENDS > 3
1943
         #endif // HOTENDS > 3
1936
       #endif // HOTENDS > 2
1944
       #endif // HOTENDS > 2
1937
     #endif // HOTENDS > 1
1945
     #endif // HOTENDS > 1
1938
-    #if HAS_HEATER_BED
1946
+    #if HAS_HEATED_BED
1939
       PWM_OFF_ROUTINE(BED); // BED
1947
       PWM_OFF_ROUTINE(BED); // BED
1940
     #endif
1948
     #endif
1941
 
1949
 
1995
           #endif // HOTENDS > 3
2003
           #endif // HOTENDS > 3
1996
         #endif // HOTENDS > 2
2004
         #endif // HOTENDS > 2
1997
       #endif // HOTENDS > 1
2005
       #endif // HOTENDS > 1
1998
-      #if HAS_HEATER_BED
2006
+      #if HAS_HEATED_BED
1999
         if (state_timer_heater_BED > 0) state_timer_heater_BED--;
2007
         if (state_timer_heater_BED > 0) state_timer_heater_BED--;
2000
       #endif
2008
       #endif
2001
     } // ((pwm_count >> SOFT_PWM_SCALE) & 0x3F) == 0
2009
     } // ((pwm_count >> SOFT_PWM_SCALE) & 0x3F) == 0
2044
         break;
2052
         break;
2045
     #endif
2053
     #endif
2046
 
2054
 
2047
-    #if HAS_TEMP_BED
2055
+    #if HAS_HEATED_BED
2048
       case PrepareTemp_BED:
2056
       case PrepareTemp_BED:
2049
         HAL_START_ADC(TEMP_BED_PIN);
2057
         HAL_START_ADC(TEMP_BED_PIN);
2050
         break;
2058
         break;
2147
     #endif
2155
     #endif
2148
 
2156
 
2149
     ZERO(raw_temp_value);
2157
     ZERO(raw_temp_value);
2150
-    raw_temp_bed_value = 0;
2151
-    raw_temp_chamber_value = 0;
2158
+
2159
+    #if HAS_HEATED_BED
2160
+      raw_temp_bed_value = 0;
2161
+    #endif
2162
+
2163
+    #if HAS_TEMP_CHAMBER
2164
+      raw_temp_chamber_value = 0;
2165
+    #endif
2152
 
2166
 
2153
     #define TEMPDIR(N) ((HEATER_##N##_RAW_LO_TEMP) > (HEATER_##N##_RAW_HI_TEMP) ? -1 : 1)
2167
     #define TEMPDIR(N) ((HEATER_##N##_RAW_LO_TEMP) > (HEATER_##N##_RAW_HI_TEMP) ? -1 : 1)
2154
 
2168
 
2194
       #endif
2208
       #endif
2195
     }
2209
     }
2196
 
2210
 
2197
-    #if HAS_TEMP_BED
2211
+    #if HAS_HEATED_BED
2198
       #if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
2212
       #if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
2199
         #define GEBED <=
2213
         #define GEBED <=
2200
       #else
2214
       #else
2262
     #endif
2276
     #endif
2263
     , const int8_t e=-3
2277
     , const int8_t e=-3
2264
   ) {
2278
   ) {
2265
-    #if !(HAS_TEMP_BED && HAS_TEMP_HOTEND && HAS_TEMP_CHAMBER) && HOTENDS <= 1
2279
+    #if !(HAS_HEATED_BED && HAS_TEMP_HOTEND && HAS_TEMP_CHAMBER) && HOTENDS <= 1
2266
       UNUSED(e);
2280
       UNUSED(e);
2267
     #endif
2281
     #endif
2268
 
2282
 
2269
     SERIAL_PROTOCOLCHAR_P(port, ' ');
2283
     SERIAL_PROTOCOLCHAR_P(port, ' ');
2270
     SERIAL_PROTOCOLCHAR_P(port,
2284
     SERIAL_PROTOCOLCHAR_P(port,
2271
-      #if HAS_TEMP_CHAMBER && HAS_TEMP_BED && HAS_TEMP_HOTEND
2285
+      #if HAS_TEMP_CHAMBER && HAS_HEATED_BED && HAS_TEMP_HOTEND
2272
         e == -2 ? 'C' : e == -1 ? 'B' : 'T'
2286
         e == -2 ? 'C' : e == -1 ? 'B' : 'T'
2273
-      #elif HAS_TEMP_BED && HAS_TEMP_HOTEND
2287
+      #elif HAS_HEATED_BED && HAS_TEMP_HOTEND
2274
         e == -1 ? 'B' : 'T'
2288
         e == -1 ? 'B' : 'T'
2275
       #elif HAS_TEMP_HOTEND
2289
       #elif HAS_TEMP_HOTEND
2276
         'T'
2290
         'T'
2306
         #endif
2320
         #endif
2307
       );
2321
       );
2308
     #endif
2322
     #endif
2309
-    #if HAS_TEMP_BED
2323
+    #if HAS_HEATED_BED
2310
       print_heater_state(degBed(), degTargetBed()
2324
       print_heater_state(degBed(), degTargetBed()
2311
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2325
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2312
           , rawBedTemp()
2326
           , rawBedTemp()
2338
     #endif
2352
     #endif
2339
     SERIAL_PROTOCOLPGM_P(port, " @:");
2353
     SERIAL_PROTOCOLPGM_P(port, " @:");
2340
     SERIAL_PROTOCOL_P(port, getHeaterPower(gcode.target_extruder));
2354
     SERIAL_PROTOCOL_P(port, getHeaterPower(gcode.target_extruder));
2341
-    #if HAS_TEMP_BED
2355
+    #if HAS_HEATED_BED
2342
       SERIAL_PROTOCOLPGM_P(port, " B@:");
2356
       SERIAL_PROTOCOLPGM_P(port, " B@:");
2343
       SERIAL_PROTOCOL_P(port, getHeaterPower(-1));
2357
       SERIAL_PROTOCOL_P(port, getHeaterPower(-1));
2344
     #endif
2358
     #endif

+ 97
- 93
Marlin/src/module/temperature.h View File

70
     PrepareTemp_4,
70
     PrepareTemp_4,
71
     MeasureTemp_4,
71
     MeasureTemp_4,
72
   #endif
72
   #endif
73
-  #if HAS_TEMP_BED
73
+  #if HAS_HEATED_BED
74
     PrepareTemp_BED,
74
     PrepareTemp_BED,
75
     MeasureTemp_BED,
75
     MeasureTemp_BED,
76
   #endif
76
   #endif
108
   #define unscalePID_d(d) ( (d) * PID_dT )
108
   #define unscalePID_d(d) ( (d) * PID_dT )
109
 #endif
109
 #endif
110
 
110
 
111
-#if !HAS_HEATER_BED
112
-  constexpr int16_t target_temperature_bed = 0;
113
-#endif
114
-
115
 class Temperature {
111
 class Temperature {
116
 
112
 
117
   public:
113
   public:
118
 
114
 
119
-    static float current_temperature[HOTENDS],
120
-                 current_temperature_chamber,
121
-                 current_temperature_bed;
115
+    static volatile bool in_temp_isr;
116
+
117
+    static float current_temperature[HOTENDS];
122
     static int16_t current_temperature_raw[HOTENDS],
118
     static int16_t current_temperature_raw[HOTENDS],
123
-                   target_temperature[HOTENDS],
124
-                   current_temperature_chamber_raw,
125
-                   current_temperature_bed_raw;
119
+                   target_temperature[HOTENDS];
120
+    static uint8_t soft_pwm_amount[HOTENDS];
126
 
121
 
127
     #if ENABLED(AUTO_POWER_E_FANS)
122
     #if ENABLED(AUTO_POWER_E_FANS)
128
       static int16_t autofan_speed[HOTENDS];
123
       static int16_t autofan_speed[HOTENDS];
129
     #endif
124
     #endif
130
 
125
 
131
-    #if HAS_HEATER_BED
132
-      static int16_t target_temperature_bed;
133
-    #endif
134
-
135
-    static volatile bool in_temp_isr;
136
-
137
-    static uint8_t soft_pwm_amount[HOTENDS],
138
-                   soft_pwm_amount_bed;
139
-
140
     #if ENABLED(FAN_SOFT_PWM)
126
     #if ENABLED(FAN_SOFT_PWM)
141
       static uint8_t soft_pwm_amount_fan[FAN_COUNT],
127
       static uint8_t soft_pwm_amount_fan[FAN_COUNT],
142
                      soft_pwm_count_fan[FAN_COUNT];
128
                      soft_pwm_count_fan[FAN_COUNT];
164
 
150
 
165
     #endif
151
     #endif
166
 
152
 
167
-    #if ENABLED(PIDTEMPBED)
168
-      static float bedKp, bedKi, bedKd;
169
-    #endif
170
-
171
-    #if ENABLED(BABYSTEPPING)
172
-      static volatile int babystepsTodo[3];
153
+    #if HAS_HEATED_BED
154
+      static float current_temperature_bed;
155
+      static int16_t current_temperature_bed_raw, target_temperature_bed;
156
+      static uint8_t soft_pwm_amount_bed;
157
+      #if ENABLED(PIDTEMPBED)
158
+        static float bedKp, bedKi, bedKd;
159
+      #endif
173
     #endif
160
     #endif
174
 
161
 
175
-    #if WATCH_HOTENDS
176
-      static uint16_t watch_target_temp[HOTENDS];
177
-      static millis_t watch_heater_next_ms[HOTENDS];
162
+    #if HAS_TEMP_CHAMBER
163
+      static float current_temperature_chamber;
164
+      static int16_t current_temperature_chamber_raw;
178
     #endif
165
     #endif
179
 
166
 
180
-    #if WATCH_THE_BED
181
-      static uint16_t watch_target_bed_temp;
182
-      static millis_t watch_bed_next_ms;
167
+    #if ENABLED(BABYSTEPPING)
168
+      static volatile int babystepsTodo[3];
183
     #endif
169
     #endif
184
 
170
 
185
     #if ENABLED(PREVENT_COLD_EXTRUSION)
171
     #if ENABLED(PREVENT_COLD_EXTRUSION)
209
   private:
195
   private:
210
 
196
 
211
     #if EARLY_WATCHDOG
197
     #if EARLY_WATCHDOG
212
-      // If temperature controller is running
213
-      static bool inited;
198
+      static bool inited;   // If temperature controller is running
199
+    #endif
200
+
201
+    static volatile bool temp_meas_ready;
202
+    static uint16_t raw_temp_value[MAX_EXTRUDERS];
203
+
204
+    #if WATCH_HOTENDS
205
+      static uint16_t watch_target_temp[HOTENDS];
206
+      static millis_t watch_heater_next_ms[HOTENDS];
214
     #endif
207
     #endif
215
 
208
 
216
     #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
209
     #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
218
       static float redundant_temperature;
211
       static float redundant_temperature;
219
     #endif
212
     #endif
220
 
213
 
221
-    static volatile bool temp_meas_ready;
222
-
223
     #if ENABLED(PIDTEMP)
214
     #if ENABLED(PIDTEMP)
224
       static float temp_iState[HOTENDS],
215
       static float temp_iState[HOTENDS],
225
                    temp_dState[HOTENDS],
216
                    temp_dState[HOTENDS],
238
       static bool pid_reset[HOTENDS];
229
       static bool pid_reset[HOTENDS];
239
     #endif
230
     #endif
240
 
231
 
241
-    #if ENABLED(PIDTEMPBED)
242
-      static float temp_iState_bed,
243
-                   temp_dState_bed,
244
-                   pTerm_bed,
245
-                   iTerm_bed,
246
-                   dTerm_bed,
247
-                   pid_error_bed;
248
-    #else
249
-      static millis_t next_bed_check_ms;
250
-    #endif
251
-
252
-    static uint16_t raw_temp_value[MAX_EXTRUDERS],
253
-                    raw_temp_chamber_value,
254
-                    raw_temp_bed_value;
255
-
256
     // Init min and max temp with extreme values to prevent false errors during startup
232
     // Init min and max temp with extreme values to prevent false errors during startup
257
     static int16_t minttemp_raw[HOTENDS],
233
     static int16_t minttemp_raw[HOTENDS],
258
                    maxttemp_raw[HOTENDS],
234
                    maxttemp_raw[HOTENDS],
259
                    minttemp[HOTENDS],
235
                    minttemp[HOTENDS],
260
                    maxttemp[HOTENDS];
236
                    maxttemp[HOTENDS];
261
 
237
 
262
-    #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
263
-      static uint8_t consecutive_low_temperature_error[HOTENDS];
238
+    #if HAS_HEATED_BED
239
+      static uint16_t raw_temp_bed_value;
240
+      #if WATCH_THE_BED
241
+        static uint16_t watch_target_bed_temp;
242
+        static millis_t watch_bed_next_ms;
243
+      #endif
244
+      #if ENABLED(PIDTEMPBED)
245
+        static float temp_iState_bed,
246
+                     temp_dState_bed,
247
+                     pTerm_bed,
248
+                     iTerm_bed,
249
+                     dTerm_bed,
250
+                     pid_error_bed;
251
+      #else
252
+        static millis_t next_bed_check_ms;
253
+      #endif
254
+      #if HEATER_IDLE_HANDLER
255
+        static millis_t bed_idle_timeout_ms;
256
+        static bool bed_idle_timeout_exceeded;
257
+      #endif
258
+      #ifdef BED_MINTEMP
259
+        static int16_t bed_minttemp_raw;
260
+      #endif
261
+      #ifdef BED_MAXTEMP
262
+        static int16_t bed_maxttemp_raw;
263
+      #endif
264
     #endif
264
     #endif
265
 
265
 
266
-    #ifdef MILLISECONDS_PREHEAT_TIME
267
-      static millis_t preheat_end_time[HOTENDS];
266
+    #if HAS_TEMP_CHAMBER
267
+      static uint16_t raw_temp_chamber_value;
268
     #endif
268
     #endif
269
 
269
 
270
-    #ifdef BED_MINTEMP
271
-      static int16_t bed_minttemp_raw;
270
+
271
+    #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
272
+      static uint8_t consecutive_low_temperature_error[HOTENDS];
272
     #endif
273
     #endif
273
 
274
 
274
-    #ifdef BED_MAXTEMP
275
-      static int16_t bed_maxttemp_raw;
275
+    #ifdef MILLISECONDS_PREHEAT_TIME
276
+      static millis_t preheat_end_time[HOTENDS];
276
     #endif
277
     #endif
277
 
278
 
278
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
279
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
294
     #if HEATER_IDLE_HANDLER
295
     #if HEATER_IDLE_HANDLER
295
       static millis_t heater_idle_timeout_ms[HOTENDS];
296
       static millis_t heater_idle_timeout_ms[HOTENDS];
296
       static bool heater_idle_timeout_exceeded[HOTENDS];
297
       static bool heater_idle_timeout_exceeded[HOTENDS];
297
-      #if HAS_TEMP_BED
298
-        static millis_t bed_idle_timeout_ms;
299
-        static bool bed_idle_timeout_exceeded;
300
-      #endif
301
     #endif
298
     #endif
302
 
299
 
303
   public:
300
   public:
319
      */
316
      */
320
     static float analog2temp(const int raw, const uint8_t e);
317
     static float analog2temp(const int raw, const uint8_t e);
321
 
318
 
322
-    #if HAS_TEMP_BED
319
+    #if HAS_HEATED_BED
323
       static float analog2tempBed(const int raw);
320
       static float analog2tempBed(const int raw);
324
     #endif
321
     #endif
325
     #if HAS_TEMP_CHAMBER
322
     #if HAS_TEMP_CHAMBER
378
       #endif
375
       #endif
379
       return current_temperature[HOTEND_INDEX];
376
       return current_temperature[HOTEND_INDEX];
380
     }
377
     }
381
-    FORCE_INLINE static float degBed() { return current_temperature_bed; }
382
-    FORCE_INLINE static float degChamber() { return current_temperature_chamber; }
383
 
378
 
384
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
379
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
385
       FORCE_INLINE static int16_t rawHotendTemp(const uint8_t e) {
380
       FORCE_INLINE static int16_t rawHotendTemp(const uint8_t e) {
388
         #endif
383
         #endif
389
         return current_temperature_raw[HOTEND_INDEX];
384
         return current_temperature_raw[HOTEND_INDEX];
390
       }
385
       }
391
-      FORCE_INLINE static int16_t rawBedTemp() { return current_temperature_bed_raw; }
392
-      FORCE_INLINE static int16_t rawChamberTemp() { return current_temperature_chamber_raw; }
393
     #endif
386
     #endif
394
 
387
 
395
     FORCE_INLINE static int16_t degTargetHotend(const uint8_t e) {
388
     FORCE_INLINE static int16_t degTargetHotend(const uint8_t e) {
399
       return target_temperature[HOTEND_INDEX];
392
       return target_temperature[HOTEND_INDEX];
400
     }
393
     }
401
 
394
 
402
-    FORCE_INLINE static int16_t degTargetBed() { return target_temperature_bed; }
403
-
404
     #if WATCH_HOTENDS
395
     #if WATCH_HOTENDS
405
       static void start_watching_heater(const uint8_t e = 0);
396
       static void start_watching_heater(const uint8_t e = 0);
406
     #endif
397
     #endif
407
 
398
 
408
-    #if WATCH_THE_BED
409
-      static void start_watching_bed();
410
-    #endif
411
-
412
     static void setTargetHotend(const int16_t celsius, const uint8_t e) {
399
     static void setTargetHotend(const int16_t celsius, const uint8_t e) {
413
       #if HOTENDS == 1
400
       #if HOTENDS == 1
414
         UNUSED(e);
401
         UNUSED(e);
428
       #endif
415
       #endif
429
     }
416
     }
430
 
417
 
431
-    static void setTargetBed(const int16_t celsius) {
432
-      #if HAS_HEATER_BED
418
+    FORCE_INLINE static bool isHeatingHotend(const uint8_t e) {
419
+      #if HOTENDS == 1
420
+        UNUSED(e);
421
+      #endif
422
+      return target_temperature[HOTEND_INDEX] > current_temperature[HOTEND_INDEX];
423
+    }
424
+
425
+    FORCE_INLINE static bool isCoolingHotend(const uint8_t e) {
426
+      #if HOTENDS == 1
427
+        UNUSED(e);
428
+      #endif
429
+      return target_temperature[HOTEND_INDEX] < current_temperature[HOTEND_INDEX];
430
+    }
431
+
432
+    #if HAS_HEATED_BED
433
+      #if ENABLED(SHOW_TEMP_ADC_VALUES)
434
+        FORCE_INLINE static int16_t rawBedTemp()  { return current_temperature_bed_raw; }
435
+      #endif
436
+      FORCE_INLINE static float degBed()          { return current_temperature_bed; }
437
+      FORCE_INLINE static int16_t degTargetBed()  { return target_temperature_bed; }
438
+      FORCE_INLINE static bool isHeatingBed()     { return target_temperature_bed > current_temperature_bed; }
439
+      FORCE_INLINE static bool isCoolingBed()     { return target_temperature_bed < current_temperature_bed; }
440
+
441
+      static void setTargetBed(const int16_t celsius) {
433
         #if ENABLED(AUTO_POWER_CONTROL)
442
         #if ENABLED(AUTO_POWER_CONTROL)
434
           powerManager.power_on();
443
           powerManager.power_on();
435
         #endif
444
         #endif
443
         #if WATCH_THE_BED
452
         #if WATCH_THE_BED
444
           start_watching_bed();
453
           start_watching_bed();
445
         #endif
454
         #endif
446
-      #endif
447
-    }
455
+      }
448
 
456
 
449
-    FORCE_INLINE static bool isHeatingHotend(const uint8_t e) {
450
-      #if HOTENDS == 1
451
-        UNUSED(e);
457
+      #if WATCH_THE_BED
458
+        static void start_watching_bed();
452
       #endif
459
       #endif
453
-      return target_temperature[HOTEND_INDEX] > current_temperature[HOTEND_INDEX];
454
-    }
455
-    FORCE_INLINE static bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; }
460
+    #endif
456
 
461
 
457
-    FORCE_INLINE static bool isCoolingHotend(const uint8_t e) {
458
-      #if HOTENDS == 1
459
-        UNUSED(e);
462
+    #if HAS_TEMP_CHAMBER
463
+      #if ENABLED(SHOW_TEMP_ADC_VALUES)
464
+        FORCE_INLINE static int16_t rawChamberTemp() { return current_temperature_chamber_raw; }
460
       #endif
465
       #endif
461
-      return target_temperature[HOTEND_INDEX] < current_temperature[HOTEND_INDEX];
462
-    }
463
-    FORCE_INLINE static bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; }
466
+      FORCE_INLINE static float degChamber() { return current_temperature_chamber; }
467
+    #endif
464
 
468
 
465
     FORCE_INLINE static bool wait_for_heating(const uint8_t e) {
469
     FORCE_INLINE static bool wait_for_heating(const uint8_t e) {
466
       return degTargetHotend(e) > TEMP_HYSTERESIS && abs(degHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS;
470
       return degTargetHotend(e) > TEMP_HYSTERESIS && abs(degHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS;
469
     /**
473
     /**
470
      * The software PWM power for a heater
474
      * The software PWM power for a heater
471
      */
475
      */
472
-    static int getHeaterPower(int heater);
476
+    static int getHeaterPower(const int heater);
473
 
477
 
474
     /**
478
     /**
475
      * Switch off all heaters, set all target temperatures to 0
479
      * Switch off all heaters, set all target temperatures to 0
562
         return heater_idle_timeout_exceeded[HOTEND_INDEX];
566
         return heater_idle_timeout_exceeded[HOTEND_INDEX];
563
       }
567
       }
564
 
568
 
565
-      #if HAS_TEMP_BED
569
+      #if HAS_HEATED_BED
566
         static void start_bed_idle_timer(const millis_t timeout_ms) {
570
         static void start_bed_idle_timer(const millis_t timeout_ms) {
567
           bed_idle_timeout_ms = millis() + timeout_ms;
571
           bed_idle_timeout_ms = millis() + timeout_ms;
568
           bed_idle_timeout_exceeded = false;
572
           bed_idle_timeout_exceeded = false;
627
 
631
 
628
     #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED
632
     #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED
629
 
633
 
630
-      typedef enum TRState : char { TRInactive, TRFirstHeating, TRStable, TRRunaway } TRstate;
634
+      enum TRState : char { TRInactive, TRFirstHeating, TRStable, TRRunaway };
631
 
635
 
632
       static void thermal_runaway_protection(TRState * const state, millis_t * const timer, const float &current, const float &target, const int8_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc);
636
       static void thermal_runaway_protection(TRState * const state, millis_t * const timer, const float &current, const float &target, const int8_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc);
633
 
637
 

Loading…
Cancel
Save