Pārlūkot izejas kodu

Add HAS_HEATED_BED conditional (#10495)

Scott Lahteine 6 gadus atpakaļ
vecāks
revīzija
cb46cb8480
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam

+ 3
- 3
Marlin/src/HAL/HAL_STM32F1/HAL.cpp Parādīt failu

@@ -80,7 +80,7 @@ uint8 adc_pins[] = {
80 80
   #if HAS_TEMP_4
81 81
     TEMP_4_PIN,
82 82
   #endif
83
-  #if HAS_TEMP_BED
83
+  #if HAS_HEATED_BED
84 84
     TEMP_BED_PIN,
85 85
   #endif
86 86
   #if ENABLED(FILAMENT_WIDTH_SENSOR)
@@ -104,7 +104,7 @@ enum TEMP_PINS : char {
104 104
   #if HAS_TEMP_4
105 105
     TEMP_4,
106 106
   #endif
107
-  #if HAS_TEMP_BED
107
+  #if HAS_HEATED_BED
108 108
     TEMP_BED,
109 109
   #endif
110 110
   #if ENABLED(FILAMENT_WIDTH_SENSOR)
@@ -211,7 +211,7 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
211 211
     #if HAS_TEMP_4
212 212
       case TEMP_4_PIN: pin_index = TEMP_4; break;
213 213
     #endif
214
-    #if HAS_TEMP_BED
214
+    #if HAS_HEATED_BED
215 215
       case TEMP_BED_PIN: pin_index = TEMP_BED; break;
216 216
     #endif
217 217
     #if ENABLED(FILAMENT_WIDTH_SENSOR)

+ 1
- 1
Marlin/src/feature/leds/tempstat.cpp Parādīt failu

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

+ 6
- 2
Marlin/src/feature/power_loss_recovery.cpp Parādīt failu

@@ -67,7 +67,9 @@ static char sd_filename[MAXPATHNAMELENGTH];
67 67
           SERIAL_PROTOCOLPAIR("leveling: ", int(job_recovery_info.leveling));
68 68
           SERIAL_PROTOCOLLNPAIR(" fade: ", int(job_recovery_info.fade));
69 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 73
         SERIAL_PROTOCOLLNPAIR("cmd_queue_index_r: ", job_recovery_info.cmd_queue_index_r);
72 74
         SERIAL_PROTOCOLLNPAIR("commands_in_queue: ", job_recovery_info.commands_in_queue);
73 75
         if (recovery)
@@ -196,7 +198,9 @@ void save_job_recovery_info() {
196 198
     COPY(job_recovery_info.current_position, current_position);
197 199
     job_recovery_info.feedrate = feedrate_mm_s;
198 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 204
     COPY(job_recovery_info.fanSpeeds, fanSpeeds);
201 205
 
202 206
     #if HAS_LEVELING

+ 4
- 1
Marlin/src/feature/power_loss_recovery.h Parādīt failu

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

+ 2
- 2
Marlin/src/gcode/bedlevel/G26.cpp Parādīt failu

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

+ 1
- 1
Marlin/src/gcode/gcode.cpp Parādīt failu

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

+ 1
- 1
Marlin/src/gcode/gcode.h Parādīt failu

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

+ 2
- 2
Marlin/src/gcode/temperature/M140_M190.cpp Parādīt failu

@@ -22,7 +22,7 @@
22 22
 
23 23
 #include "../../inc/MarlinConfig.h"
24 24
 
25
-#if HAS_HEATER_BED && HAS_TEMP_BED
25
+#if HAS_HEATED_BED
26 26
 
27 27
 #include "../gcode.h"
28 28
 #include "../../module/temperature.h"
@@ -177,4 +177,4 @@ void GcodeSuite::M190() {
177 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 Parādīt failu

@@ -764,7 +764,6 @@
764 764
 #define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
765 765
 #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2)
766 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 768
 // Heaters
770 769
 #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
@@ -774,8 +773,11 @@
774 773
 #define HAS_HEATER_4 (PIN_EXISTS(HEATER_4))
775 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 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 781
 #define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0)
780 782
 #define WATCH_THE_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0)
781 783
 
@@ -897,7 +899,7 @@
897 899
 /**
898 900
  * Heated bed requires settings
899 901
  */
900
-#if HAS_HEATER_BED
902
+#if HAS_HEATED_BED
901 903
   #ifndef MAX_BED_POWER
902 904
     #define MAX_BED_POWER 255
903 905
   #endif

+ 4
- 4
Marlin/src/lcd/dogm/dogm_bitmaps.h Parādīt failu

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

+ 28
- 12
Marlin/src/lcd/dogm/status_screen_DOGM.h Parādīt failu

@@ -45,7 +45,7 @@ FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, cons
45 45
     UNUSED(blink);
46 46
   #endif
47 47
 
48
-  #if HAS_TEMP_BED
48
+  #if HAS_HEATED_BED
49 49
     const bool isBed = heater < 0;
50 50
   #else
51 51
     constexpr bool isBed = false;
@@ -53,32 +53,48 @@ FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, cons
53 53
 
54 54
   if (PAGE_UNDER(7)) {
55 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 59
         #endif
60
+        thermalManager.is_heater_idle(heater)
62 61
       );
63 62
 
64 63
       if (blink || !is_idle)
65 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 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 83
   if (PAGE_CONTAINS(17, 20)) {
72 84
     const uint8_t h = isBed ? 7 : HEAT_INDICATOR_X,
73 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 92
       u8g.setColorIndex(0); // white on black
76 93
       u8g.drawBox(x + h, y, 2, 2);
77 94
       u8g.setColorIndex(1); // black on white
78 95
     }
79
-    else {
96
+    else
80 97
       u8g.drawBox(x + h, y, 2, 2);
81
-    }
82 98
   }
83 99
 }
84 100
 
@@ -199,7 +215,7 @@ static void lcd_implementation_status_screen() {
199 215
     HOTEND_LOOP() _draw_heater_status(STATUS_SCREEN_HOTEND_TEXT_X(e), e, blink);
200 216
 
201 217
     // Heated bed
202
-    #if HOTENDS < 4 && HAS_TEMP_BED
218
+    #if HOTENDS < 4 && HAS_HEATED_BED
203 219
       _draw_heater_status(STATUS_SCREEN_BED_TEXT_X, -1, blink);
204 220
     #endif
205 221
 

+ 8
- 8
Marlin/src/lcd/dogm/status_screen_lite_ST7920.h Parādīt failu

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

+ 15
- 13
Marlin/src/lcd/ultralcd.cpp Parādīt failu

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

+ 8
- 10
Marlin/src/lcd/ultralcd_impl_HD44780.h Parādīt failu

@@ -476,15 +476,14 @@ FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr,
476 476
 }
477 477
 
478 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 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 483
   #else
482
-    constexpr bool isBed = false;
484
+    const float t1 = thermalManager.degHotend(heater), t2 = thermalManager.degTargetHotend(heater);
483 485
   #endif
484 486
 
485
-  const float t1 = (isBed ? thermalManager.degBed()       : thermalManager.degHotend(heater)),
486
-              t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
487
-
488 487
   if (prefix >= 0) lcd_put_wchar(prefix);
489 488
 
490 489
   lcd_put_u8str(itostr3(t1 + 0.5));
@@ -493,12 +492,11 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co
493 492
   #if !HEATER_IDLE_HANDLER
494 493
     UNUSED(blink);
495 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 498
       #endif
499
+      thermalManager.is_heater_idle(heater)
502 500
     );
503 501
 
504 502
     if (!blink && is_idle) {

+ 1
- 1
Marlin/src/module/motion.cpp Parādīt failu

@@ -1056,7 +1056,7 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
1056 1056
     }
1057 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 1060
     // Wait for bed to heat back up between probing points
1061 1061
     if (axis == Z_AXIS && distance < 0 && thermalManager.isHeatingBed()) {
1062 1062
       serialprintPGM(msg_wait_for_bed_heating);

+ 2
- 2
Marlin/src/module/probe.cpp Parādīt failu

@@ -483,7 +483,7 @@ bool set_probe_deployed(const bool deploy) {
483 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 487
   const char msg_wait_for_bed_heating[25] PROGMEM = "Wait for bed heating...\n";
488 488
 #endif
489 489
 
@@ -492,7 +492,7 @@ static bool do_probe_move(const float z, const float fr_mm_m) {
492 492
     if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position);
493 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 496
     // Wait for bed to heat back up between probing points
497 497
     if (thermalManager.isHeatingBed()) {
498 498
       serialprintPGM(msg_wait_for_bed_heating);

+ 1
- 1
Marlin/src/module/probe.h Parādīt failu

@@ -44,7 +44,7 @@
44 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 45
   #define DEPLOY_PROBE() set_probe_deployed(true)
46 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 48
     extern const char msg_wait_for_bed_heating[25];
49 49
   #endif
50 50
 #else

+ 114
- 100
Marlin/src/module/temperature.cpp Parādīt failu

@@ -63,7 +63,7 @@ Temperature thermalManager;
63 63
  * Macros to include the heater id in temp errors. The compiler's dead-code
64 64
  * elimination should (hopefully) optimize out the unused strings.
65 65
  */
66
-#if HAS_TEMP_BED
66
+#if HAS_HEATED_BED
67 67
   #define TEMP_ERR_PSTR(MSG, E) \
68 68
     (E) == -1 ? PSTR(MSG ## _BED) : \
69 69
     (HOTENDS > 1 && (E) == 1) ? PSTR(MSG_E2 " " MSG) : \
@@ -82,21 +82,51 @@ Temperature thermalManager;
82 82
 
83 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 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 89
 #if ENABLED(AUTO_POWER_E_FANS)
95 90
   int16_t Temperature::autofan_speed[HOTENDS] = { 0 };
96 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 130
 #endif
101 131
 
102 132
 // Initialized by settings.load()
@@ -114,11 +144,6 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
114 144
   #endif
115 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 147
 #if ENABLED(BABYSTEPPING)
123 148
   volatile int Temperature::babystepsTodo[XYZ] = { 0 };
124 149
 #endif
@@ -128,11 +153,6 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
128 153
   millis_t Temperature::watch_heater_next_ms[HOTENDS] = { 0 };
129 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 156
 #if ENABLED(PREVENT_COLD_EXTRUSION)
137 157
   bool Temperature::allow_cold_extrude = false;
138 158
   int16_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
@@ -169,20 +189,7 @@ volatile bool Temperature::temp_meas_ready = false;
169 189
   bool Temperature::pid_reset[HOTENDS];
170 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 194
 // Init min and max temp with extreme values to prevent false errors during startup
188 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,14 +205,6 @@ int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TE
198 205
   millis_t Temperature::preheat_end_time[HOTENDS] = { 0 };
199 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 208
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
210 209
   int8_t Temperature::meas_shift_index;  // Index of a delayed sample in buffer
211 210
 #endif
@@ -214,8 +213,7 @@ int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TE
214 213
   millis_t Temperature::next_auto_fan_check_ms = 0;
215 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 218
 #if ENABLED(FAN_SOFT_PWM)
221 219
   uint8_t Temperature::soft_pwm_amount_fan[FAN_COUNT],
@@ -233,10 +231,6 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
233 231
 #if HEATER_IDLE_HANDLER
234 232
   millis_t Temperature::heater_idle_timeout_ms[HOTENDS] = { 0 };
235 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 234
 #endif
241 235
 
242 236
 #if ENABLED(ADC_KEYPAD)
@@ -546,8 +540,13 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
546 540
 
547 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 552
 #if HAS_AUTO_FAN
@@ -618,6 +617,7 @@ void Temperature::_temp_error(const int8_t e, const char * const serial_msg, con
618 617
 void Temperature::max_temp_error(const int8_t e) {
619 618
   _temp_error(e, PSTR(MSG_T_MAXTEMP), TEMP_ERR_PSTR(MSG_ERR_MAXTEMP, e));
620 619
 }
620
+
621 621
 void Temperature::min_temp_error(const int8_t e) {
622 622
   _temp_error(e, PSTR(MSG_T_MINTEMP), TEMP_ERR_PSTR(MSG_ERR_MINTEMP, e));
623 623
 }
@@ -857,29 +857,29 @@ void Temperature::manage_heater() {
857 857
     }
858 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 879
       #if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING)
873
-        && paused == last_pause_state
880
+        last_pause_state = paused;
874 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 882
     #endif
880
-  #endif
881
-
882
-  #if HAS_TEMP_BED
883 883
 
884 884
     #if HEATER_IDLE_HANDLER
885 885
       if (!bed_idle_timeout_exceeded && bed_idle_timeout_ms && ELAPSED(ms, bed_idle_timeout_ms))
@@ -920,7 +920,7 @@ void Temperature::manage_heater() {
920 920
         }
921 921
       #endif
922 922
     }
923
-  #endif // HAS_TEMP_BED
923
+  #endif // HAS_HEATED_BED
924 924
 }
925 925
 
926 926
 #define PGM_RD_W(x)   (short)pgm_read_word(&x)
@@ -968,7 +968,7 @@ float Temperature::analog2temp(const int raw, const uint8_t e) {
968 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 972
   // Derived from RepRap FiveD extruder::getTemperature()
973 973
   // For bed temperature measurement.
974 974
   float Temperature::analog2tempBed(const int raw) {
@@ -1002,7 +1002,7 @@ float Temperature::analog2temp(const int raw, const uint8_t e) {
1002 1002
 
1003 1003
     #endif
1004 1004
   }
1005
-#endif // HAS_TEMP_BED
1005
+#endif // HAS_HEATED_BED
1006 1006
 
1007 1007
 #if HAS_TEMP_CHAMBER
1008 1008
   // Derived from RepRap FiveD extruder::getTemperature()
@@ -1052,7 +1052,7 @@ void Temperature::updateTemperaturesFromRawValues() {
1052 1052
   #endif
1053 1053
   HOTEND_LOOP()
1054 1054
     current_temperature[e] = Temperature::analog2temp(current_temperature_raw[e], e);
1055
-  #if HAS_TEMP_BED
1055
+  #if HAS_HEATED_BED
1056 1056
     current_temperature_bed = Temperature::analog2tempBed(current_temperature_bed_raw);
1057 1057
   #endif
1058 1058
   #if HAS_TEMP_CHAMBER
@@ -1149,7 +1149,7 @@ void Temperature::init() {
1149 1149
   #if HAS_HEATER_4
1150 1150
     OUT_WRITE(HEATER_3_PIN, HEATER_4_INVERTING);
1151 1151
   #endif
1152
-  #if HAS_HEATER_BED
1152
+  #if HAS_HEATED_BED
1153 1153
     OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING);
1154 1154
   #endif
1155 1155
 
@@ -1204,7 +1204,7 @@ void Temperature::init() {
1204 1204
   #if HAS_TEMP_4
1205 1205
     HAL_ANALOG_SELECT(TEMP_4_PIN);
1206 1206
   #endif
1207
-  #if HAS_TEMP_BED
1207
+  #if HAS_HEATED_BED
1208 1208
     HAL_ANALOG_SELECT(TEMP_BED_PIN);
1209 1209
   #endif
1210 1210
   #if HAS_TEMP_CHAMBER
@@ -1345,7 +1345,7 @@ void Temperature::init() {
1345 1345
     #endif // HOTENDS > 2
1346 1346
   #endif // HOTENDS > 1
1347 1347
 
1348
-  #if HAS_TEMP_BED
1348
+  #if HAS_HEATED_BED
1349 1349
     #ifdef BED_MINTEMP
1350 1350
       while (analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) {
1351 1351
         #if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP
@@ -1364,7 +1364,7 @@ void Temperature::init() {
1364 1364
         #endif
1365 1365
       }
1366 1366
     #endif // BED_MAXTEMP
1367
-  #endif // HAS_TEMP_BED
1367
+  #endif // HAS_HEATED_BED
1368 1368
 
1369 1369
   #if ENABLED(PROBING_HEATERS_OFF)
1370 1370
     paused = false;
@@ -1483,7 +1483,7 @@ void Temperature::init() {
1483 1483
     #if HEATER_IDLE_HANDLER
1484 1484
       // If the heater idle timeout expires, restart
1485 1485
       if ((heater_id >= 0 && heater_idle_timeout_exceeded[heater_id])
1486
-        #if HAS_TEMP_BED
1486
+        #if HAS_HEATED_BED
1487 1487
           || (heater_id < 0 && bed_idle_timeout_exceeded)
1488 1488
         #endif
1489 1489
       ) {
@@ -1529,7 +1529,10 @@ void Temperature::disable_all_heaters() {
1529 1529
   #endif
1530 1530
 
1531 1531
   HOTEND_LOOP() setTargetHotend(0, e);
1532
-  setTargetBed(0);
1532
+
1533
+  #if HAS_HEATED_BED
1534
+    setTargetBed(0);
1535
+  #endif
1533 1536
 
1534 1537
   // Unpause and reset everything
1535 1538
   #if ENABLED(PROBING_HEATERS_OFF)
@@ -1561,10 +1564,10 @@ void Temperature::disable_all_heaters() {
1561 1564
     #endif // HOTENDS > 1
1562 1565
   #endif
1563 1566
 
1564
-  #if HAS_TEMP_BED
1567
+  #if HAS_HEATED_BED
1565 1568
     target_temperature_bed = 0;
1566 1569
     soft_pwm_amount_bed = 0;
1567
-    #if HAS_HEATER_BED
1570
+    #if HAS_HEATED_BED
1568 1571
       WRITE_HEATER_BED(LOW);
1569 1572
     #endif
1570 1573
   #endif
@@ -1577,13 +1580,13 @@ void Temperature::disable_all_heaters() {
1577 1580
       paused = p;
1578 1581
       if (p) {
1579 1582
         HOTEND_LOOP() start_heater_idle_timer(e, 0); // timeout immediately
1580
-        #if HAS_TEMP_BED
1583
+        #if HAS_HEATED_BED
1581 1584
           start_bed_idle_timer(0); // timeout immediately
1582 1585
         #endif
1583 1586
       }
1584 1587
       else {
1585 1588
         HOTEND_LOOP() reset_heater_idle_timer(e);
1586
-        #if HAS_TEMP_BED
1589
+        #if HAS_HEATED_BED
1587 1590
           reset_bed_idle_timer();
1588 1591
         #endif
1589 1592
       }
@@ -1687,8 +1690,13 @@ void Temperature::set_current_temp_raw() {
1687 1690
       #endif
1688 1691
     #endif
1689 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 1700
   temp_meas_ready = true;
1693 1701
 }
1694 1702
 
@@ -1759,7 +1767,7 @@ void Temperature::isr() {
1759 1767
       #endif // HOTENDS > 3
1760 1768
     #endif // HOTENDS > 2
1761 1769
   #endif // HOTENDS > 1
1762
-  #if HAS_HEATER_BED
1770
+  #if HAS_HEATED_BED
1763 1771
     ISR_STATICS(BED);
1764 1772
   #endif
1765 1773
 
@@ -1800,7 +1808,7 @@ void Temperature::isr() {
1800 1808
         #endif // HOTENDS > 2
1801 1809
       #endif // HOTENDS > 1
1802 1810
 
1803
-      #if HAS_HEATER_BED
1811
+      #if HAS_HEATED_BED
1804 1812
         soft_pwm_count_BED = (soft_pwm_count_BED & pwm_mask) + soft_pwm_amount_bed;
1805 1813
         WRITE_HEATER_BED(soft_pwm_count_BED > pwm_mask ? HIGH : LOW);
1806 1814
       #endif
@@ -1835,7 +1843,7 @@ void Temperature::isr() {
1835 1843
         #endif // HOTENDS > 2
1836 1844
       #endif // HOTENDS > 1
1837 1845
 
1838
-      #if HAS_HEATER_BED
1846
+      #if HAS_HEATED_BED
1839 1847
         if (soft_pwm_count_BED <= pwm_count_tmp) WRITE_HEATER_BED(LOW);
1840 1848
       #endif
1841 1849
 
@@ -1916,7 +1924,7 @@ void Temperature::isr() {
1916 1924
           #endif // HOTENDS > 3
1917 1925
         #endif // HOTENDS > 2
1918 1926
       #endif // HOTENDS > 1
1919
-      #if HAS_HEATER_BED
1927
+      #if HAS_HEATED_BED
1920 1928
         _SLOW_PWM_ROUTINE(BED, soft_pwm_amount_bed); // BED
1921 1929
       #endif
1922 1930
 
@@ -1935,7 +1943,7 @@ void Temperature::isr() {
1935 1943
         #endif // HOTENDS > 3
1936 1944
       #endif // HOTENDS > 2
1937 1945
     #endif // HOTENDS > 1
1938
-    #if HAS_HEATER_BED
1946
+    #if HAS_HEATED_BED
1939 1947
       PWM_OFF_ROUTINE(BED); // BED
1940 1948
     #endif
1941 1949
 
@@ -1995,7 +2003,7 @@ void Temperature::isr() {
1995 2003
           #endif // HOTENDS > 3
1996 2004
         #endif // HOTENDS > 2
1997 2005
       #endif // HOTENDS > 1
1998
-      #if HAS_HEATER_BED
2006
+      #if HAS_HEATED_BED
1999 2007
         if (state_timer_heater_BED > 0) state_timer_heater_BED--;
2000 2008
       #endif
2001 2009
     } // ((pwm_count >> SOFT_PWM_SCALE) & 0x3F) == 0
@@ -2044,7 +2052,7 @@ void Temperature::isr() {
2044 2052
         break;
2045 2053
     #endif
2046 2054
 
2047
-    #if HAS_TEMP_BED
2055
+    #if HAS_HEATED_BED
2048 2056
       case PrepareTemp_BED:
2049 2057
         HAL_START_ADC(TEMP_BED_PIN);
2050 2058
         break;
@@ -2147,8 +2155,14 @@ void Temperature::isr() {
2147 2155
     #endif
2148 2156
 
2149 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 2167
     #define TEMPDIR(N) ((HEATER_##N##_RAW_LO_TEMP) > (HEATER_##N##_RAW_HI_TEMP) ? -1 : 1)
2154 2168
 
@@ -2194,7 +2208,7 @@ void Temperature::isr() {
2194 2208
       #endif
2195 2209
     }
2196 2210
 
2197
-    #if HAS_TEMP_BED
2211
+    #if HAS_HEATED_BED
2198 2212
       #if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
2199 2213
         #define GEBED <=
2200 2214
       #else
@@ -2262,15 +2276,15 @@ void Temperature::isr() {
2262 2276
     #endif
2263 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 2280
       UNUSED(e);
2267 2281
     #endif
2268 2282
 
2269 2283
     SERIAL_PROTOCOLCHAR_P(port, ' ');
2270 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 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 2288
         e == -1 ? 'B' : 'T'
2275 2289
       #elif HAS_TEMP_HOTEND
2276 2290
         'T'
@@ -2306,7 +2320,7 @@ void Temperature::isr() {
2306 2320
         #endif
2307 2321
       );
2308 2322
     #endif
2309
-    #if HAS_TEMP_BED
2323
+    #if HAS_HEATED_BED
2310 2324
       print_heater_state(degBed(), degTargetBed()
2311 2325
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2312 2326
           , rawBedTemp()
@@ -2338,7 +2352,7 @@ void Temperature::isr() {
2338 2352
     #endif
2339 2353
     SERIAL_PROTOCOLPGM_P(port, " @:");
2340 2354
     SERIAL_PROTOCOL_P(port, getHeaterPower(gcode.target_extruder));
2341
-    #if HAS_TEMP_BED
2355
+    #if HAS_HEATED_BED
2342 2356
       SERIAL_PROTOCOLPGM_P(port, " B@:");
2343 2357
       SERIAL_PROTOCOL_P(port, getHeaterPower(-1));
2344 2358
     #endif

+ 97
- 93
Marlin/src/module/temperature.h Parādīt failu

@@ -70,7 +70,7 @@ enum ADCSensorState : char {
70 70
     PrepareTemp_4,
71 71
     MeasureTemp_4,
72 72
   #endif
73
-  #if HAS_TEMP_BED
73
+  #if HAS_HEATED_BED
74 74
     PrepareTemp_BED,
75 75
     MeasureTemp_BED,
76 76
   #endif
@@ -108,35 +108,21 @@ enum ADCSensorState : char {
108 108
   #define unscalePID_d(d) ( (d) * PID_dT )
109 109
 #endif
110 110
 
111
-#if !HAS_HEATER_BED
112
-  constexpr int16_t target_temperature_bed = 0;
113
-#endif
114
-
115 111
 class Temperature {
116 112
 
117 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 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 122
     #if ENABLED(AUTO_POWER_E_FANS)
128 123
       static int16_t autofan_speed[HOTENDS];
129 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 126
     #if ENABLED(FAN_SOFT_PWM)
141 127
       static uint8_t soft_pwm_amount_fan[FAN_COUNT],
142 128
                      soft_pwm_count_fan[FAN_COUNT];
@@ -164,22 +150,22 @@ class Temperature {
164 150
 
165 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 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 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 169
     #endif
184 170
 
185 171
     #if ENABLED(PREVENT_COLD_EXTRUSION)
@@ -209,8 +195,15 @@ class Temperature {
209 195
   private:
210 196
 
211 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 207
     #endif
215 208
 
216 209
     #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
@@ -218,8 +211,6 @@ class Temperature {
218 211
       static float redundant_temperature;
219 212
     #endif
220 213
 
221
-    static volatile bool temp_meas_ready;
222
-
223 214
     #if ENABLED(PIDTEMP)
224 215
       static float temp_iState[HOTENDS],
225 216
                    temp_dState[HOTENDS],
@@ -238,41 +229,51 @@ class Temperature {
238 229
       static bool pid_reset[HOTENDS];
239 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 232
     // Init min and max temp with extreme values to prevent false errors during startup
257 233
     static int16_t minttemp_raw[HOTENDS],
258 234
                    maxttemp_raw[HOTENDS],
259 235
                    minttemp[HOTENDS],
260 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 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 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 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 277
     #endif
277 278
 
278 279
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
@@ -294,10 +295,6 @@ class Temperature {
294 295
     #if HEATER_IDLE_HANDLER
295 296
       static millis_t heater_idle_timeout_ms[HOTENDS];
296 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 298
     #endif
302 299
 
303 300
   public:
@@ -319,7 +316,7 @@ class Temperature {
319 316
      */
320 317
     static float analog2temp(const int raw, const uint8_t e);
321 318
 
322
-    #if HAS_TEMP_BED
319
+    #if HAS_HEATED_BED
323 320
       static float analog2tempBed(const int raw);
324 321
     #endif
325 322
     #if HAS_TEMP_CHAMBER
@@ -378,8 +375,6 @@ class Temperature {
378 375
       #endif
379 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 379
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
385 380
       FORCE_INLINE static int16_t rawHotendTemp(const uint8_t e) {
@@ -388,8 +383,6 @@ class Temperature {
388 383
         #endif
389 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 386
     #endif
394 387
 
395 388
     FORCE_INLINE static int16_t degTargetHotend(const uint8_t e) {
@@ -399,16 +392,10 @@ class Temperature {
399 392
       return target_temperature[HOTEND_INDEX];
400 393
     }
401 394
 
402
-    FORCE_INLINE static int16_t degTargetBed() { return target_temperature_bed; }
403
-
404 395
     #if WATCH_HOTENDS
405 396
       static void start_watching_heater(const uint8_t e = 0);
406 397
     #endif
407 398
 
408
-    #if WATCH_THE_BED
409
-      static void start_watching_bed();
410
-    #endif
411
-
412 399
     static void setTargetHotend(const int16_t celsius, const uint8_t e) {
413 400
       #if HOTENDS == 1
414 401
         UNUSED(e);
@@ -428,8 +415,30 @@ class Temperature {
428 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 442
         #if ENABLED(AUTO_POWER_CONTROL)
434 443
           powerManager.power_on();
435 444
         #endif
@@ -443,24 +452,19 @@ class Temperature {
443 452
         #if WATCH_THE_BED
444 453
           start_watching_bed();
445 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 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 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 469
     FORCE_INLINE static bool wait_for_heating(const uint8_t e) {
466 470
       return degTargetHotend(e) > TEMP_HYSTERESIS && abs(degHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS;
@@ -469,7 +473,7 @@ class Temperature {
469 473
     /**
470 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 479
      * Switch off all heaters, set all target temperatures to 0
@@ -562,7 +566,7 @@ class Temperature {
562 566
         return heater_idle_timeout_exceeded[HOTEND_INDEX];
563 567
       }
564 568
 
565
-      #if HAS_TEMP_BED
569
+      #if HAS_HEATED_BED
566 570
         static void start_bed_idle_timer(const millis_t timeout_ms) {
567 571
           bed_idle_timeout_ms = millis() + timeout_ms;
568 572
           bed_idle_timeout_exceeded = false;
@@ -627,7 +631,7 @@ class Temperature {
627 631
 
628 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 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
 

Notiek ielāde…
Atcelt
Saglabāt