浏览代码

Prevent bed temperature being set too high

Scott Lahteine 7 年前
父节点
当前提交
b0eae68f57
共有 2 个文件被更改,包括 25 次插入7 次删除
  1. 5
    2
      Marlin/temperature.cpp
  2. 20
    5
      Marlin/temperature.h

+ 5
- 2
Marlin/temperature.cpp 查看文件

@@ -67,8 +67,11 @@ float Temperature::current_temperature[HOTENDS] = { 0.0 },
67 67
       Temperature::current_temperature_bed = 0.0;
68 68
 int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
69 69
         Temperature::target_temperature[HOTENDS] = { 0 },
70
-        Temperature::current_temperature_bed_raw = 0,
71
-        Temperature::target_temperature_bed = 0;
70
+        Temperature::current_temperature_bed_raw = 0;
71
+
72
+#if HAS_HEATER_BED
73
+  int16_t Temperature::target_temperature_bed = 0;
74
+#endif
72 75
 
73 76
 #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
74 77
   float Temperature::redundant_temperature = 0.0;

+ 20
- 5
Marlin/temperature.h 查看文件

@@ -92,6 +92,10 @@ enum ADCSensorState {
92 92
 
93 93
 #define ACTUAL_ADC_SAMPLES max(int(MIN_ADC_ISR_LOOPS), int(SensorsReady))
94 94
 
95
+#if !HAS_HEATER_BED
96
+  constexpr int16_t target_temperature_bed = 0;
97
+#endif
98
+
95 99
 class Temperature {
96 100
 
97 101
   public:
@@ -100,8 +104,11 @@ class Temperature {
100 104
                  current_temperature_bed;
101 105
     static int16_t current_temperature_raw[HOTENDS],
102 106
                    target_temperature[HOTENDS],
103
-                   current_temperature_bed_raw,
104
-                   target_temperature_bed;
107
+                   current_temperature_bed_raw;
108
+
109
+    #if HAS_HEATER_BED
110
+      static int16_t target_temperature_bed;
111
+    #endif
105 112
 
106 113
     static volatile bool in_temp_isr;
107 114
 
@@ -382,9 +389,17 @@ class Temperature {
382 389
     }
383 390
 
384 391
     static void setTargetBed(const int16_t celsius) {
385
-      target_temperature_bed = celsius;
386
-      #if WATCH_THE_BED
387
-        start_watching_bed();
392
+      #if HAS_HEATER_BED
393
+        target_temperature_bed =
394
+          #ifdef BED_MAXTEMP
395
+            min(celsius, BED_MAXTEMP)
396
+          #else
397
+            celsius
398
+          #endif
399
+        ;
400
+        #if WATCH_THE_BED
401
+          start_watching_bed();
402
+        #endif
388 403
       #endif
389 404
     }
390 405
 

正在加载...
取消
保存