Pārlūkot izejas kodu

✅ Warn about dummy thermistors

Scott Lahteine 2 gadus atpakaļ
vecāks
revīzija
ad4a8a68c2

+ 7
- 9
Marlin/src/inc/Conditionals_adv.h Parādīt failu

@@ -132,17 +132,15 @@
132 132
 #define HID_E6         6
133 133
 #define HID_E7         7
134 134
 
135
-#define ANY_TEMP_SENSOR_IS(n) (n == TEMP_SENSOR_0 || n == TEMP_SENSOR_1 || n == TEMP_SENSOR_2 || n == TEMP_SENSOR_3 \
136
-  || n == TEMP_SENSOR_4 || n == TEMP_SENSOR_5 || n == TEMP_SENSOR_6 || n == TEMP_SENSOR_7 \
137
-  || n == TEMP_SENSOR_BED \
138
-  || n == TEMP_SENSOR_PROBE \
139
-  || n == TEMP_SENSOR_CHAMBER \
140
-  || n == TEMP_SENSOR_COOLER \
141
-  || n == TEMP_SENSOR_REDUNDANT )
142
-#if ANY_TEMP_SENSOR_IS(1000)
135
+#define _SENSOR_IS(I,N) || (TEMP_SENSOR_##N == I)
136
+#define _E_SENSOR_IS(I,N) _SENSOR_IS(N,I)
137
+#define ANY_THERMISTOR_IS(N) (0 REPEAT2(HOTENDS, _E_SENSOR_IS, N) \
138
+  _SENSOR_IS(N,BED) _SENSOR_IS(N,PROBE) _SENSOR_IS(N,CHAMBER) \
139
+  _SENSOR_IS(N,COOLER) _SENSOR_IS(N,BOARD) _SENSOR_IS(N,REDUNDANT) )
140
+
141
+#if ANY_THERMISTOR_IS(1000)
143 142
   #define HAS_USER_THERMISTORS 1
144 143
 #endif
145
-#undef ANY_TEMP_SENSOR_IS
146 144
 
147 145
 #if TEMP_SENSOR_REDUNDANT
148 146
   #define _HEATER_ID(M) HID_##M

+ 7
- 63
Marlin/src/inc/SanityCheck.h Parādīt failu

@@ -2193,68 +2193,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
2193 2193
               #elif !PIN_EXISTS(TEMP_7) && !TEMP_SENSOR_7_IS_DUMMY
2194 2194
                 #error "TEMP_7_PIN not defined for this board."
2195 2195
               #endif
2196
-            #elif TEMP_SENSOR_7 != 0
2197
-              #error "TEMP_SENSOR_7 shouldn't be set with only 7 HOTENDS."
2198
-            #endif
2199
-          #elif TEMP_SENSOR_6 != 0
2200
-            #error "TEMP_SENSOR_6 shouldn't be set with only 6 HOTENDS."
2201
-          #elif TEMP_SENSOR_7 != 0
2202
-            #error "TEMP_SENSOR_7 shouldn't be set with only 6 HOTENDS."
2203
-          #endif
2204
-        #elif TEMP_SENSOR_5 != 0
2205
-          #error "TEMP_SENSOR_5 shouldn't be set with only 5 HOTENDS."
2206
-        #elif TEMP_SENSOR_6 != 0
2207
-          #error "TEMP_SENSOR_6 shouldn't be set with only 5 HOTENDS."
2208
-        #elif TEMP_SENSOR_7 != 0
2209
-          #error "TEMP_SENSOR_7 shouldn't be set with only 5 HOTENDS."
2210
-        #endif
2211
-      #elif TEMP_SENSOR_4 != 0
2212
-        #error "TEMP_SENSOR_4 shouldn't be set with only 4 HOTENDS."
2213
-      #elif TEMP_SENSOR_5 != 0
2214
-        #error "TEMP_SENSOR_5 shouldn't be set with only 4 HOTENDS."
2215
-      #elif TEMP_SENSOR_6 != 0
2216
-        #error "TEMP_SENSOR_6 shouldn't be set with only 4 HOTENDS."
2217
-      #elif TEMP_SENSOR_7 != 0
2218
-        #error "TEMP_SENSOR_7 shouldn't be set with only 4 HOTENDS."
2219
-      #endif
2220
-    #elif TEMP_SENSOR_3 != 0
2221
-      #error "TEMP_SENSOR_3 shouldn't be set with only 3 HOTENDS."
2222
-    #elif TEMP_SENSOR_4 != 0
2223
-      #error "TEMP_SENSOR_4 shouldn't be set with only 3 HOTENDS."
2224
-    #elif TEMP_SENSOR_5 != 0
2225
-      #error "TEMP_SENSOR_5 shouldn't be set with only 3 HOTENDS."
2226
-    #elif TEMP_SENSOR_6 != 0
2227
-      #error "TEMP_SENSOR_6 shouldn't be set with only 3 HOTENDS."
2228
-    #elif TEMP_SENSOR_7 != 0
2229
-      #error "TEMP_SENSOR_7 shouldn't be set with only 3 HOTENDS."
2230
-    #endif
2231
-  #elif TEMP_SENSOR_2 != 0
2232
-    #error "TEMP_SENSOR_2 shouldn't be set with only 2 HOTENDS."
2233
-  #elif TEMP_SENSOR_3 != 0
2234
-    #error "TEMP_SENSOR_3 shouldn't be set with only 2 HOTENDS."
2235
-  #elif TEMP_SENSOR_4 != 0
2236
-    #error "TEMP_SENSOR_4 shouldn't be set with only 2 HOTENDS."
2237
-  #elif TEMP_SENSOR_5 != 0
2238
-    #error "TEMP_SENSOR_5 shouldn't be set with only 2 HOTENDS."
2239
-  #elif TEMP_SENSOR_6 != 0
2240
-    #error "TEMP_SENSOR_6 shouldn't be set with only 2 HOTENDS."
2241
-  #elif TEMP_SENSOR_7 != 0
2242
-    #error "TEMP_SENSOR_7 shouldn't be set with only 2 HOTENDS."
2243
-  #endif
2244
-#elif TEMP_SENSOR_1 != 0
2245
-  #error "TEMP_SENSOR_1 shouldn't be set with only 1 HOTEND."
2246
-#elif TEMP_SENSOR_2 != 0
2247
-  #error "TEMP_SENSOR_2 shouldn't be set with only 1 HOTEND."
2248
-#elif TEMP_SENSOR_3 != 0
2249
-  #error "TEMP_SENSOR_3 shouldn't be set with only 1 HOTEND."
2250
-#elif TEMP_SENSOR_4 != 0
2251
-  #error "TEMP_SENSOR_4 shouldn't be set with only 1 HOTEND."
2252
-#elif TEMP_SENSOR_5 != 0
2253
-  #error "TEMP_SENSOR_5 shouldn't be set with only 1 HOTEND."
2254
-#elif TEMP_SENSOR_6 != 0
2255
-  #error "TEMP_SENSOR_6 shouldn't be set with only 1 HOTEND."
2256
-#elif TEMP_SENSOR_7 != 0
2257
-  #error "TEMP_SENSOR_7 shouldn't be set with only 1 HOTEND."
2196
+            #endif // HOTENDS > 7
2197
+          #endif // HOTENDS > 6
2198
+        #endif // HOTENDS > 5
2199
+      #endif // HOTENDS > 4
2200
+    #endif // HOTENDS > 3
2201
+  #endif // HOTENDS > 2
2258 2202
 #endif // HAS_MULTI_HOTEND
2259 2203
 
2260 2204
 /**
@@ -3292,7 +3236,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
3292 3236
 #if HAS_MOTOR_CURRENT_I2C
3293 3237
   #if BOTH(DIGIPOT_MCP4018, DIGIPOT_MCP4451)
3294 3238
     #error "Enable only one of DIGIPOT_MCP4018 or DIGIPOT_MCP4451."
3295
-#elif !MB(MKS_SBASE, AZTEEG_X5_GT, AZTEEG_X5_MINI, AZTEEG_X5_MINI_WIFI) \
3239
+  #elif !MB(MKS_SBASE, AZTEEG_X5_GT, AZTEEG_X5_MINI, AZTEEG_X5_MINI_WIFI) \
3296 3240
     && (!defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) || !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1))
3297 3241
       #error "DIGIPOT_MCP4018/4451 requires DIGIPOTS_I2C_SDA_* pins to be defined."
3298 3242
   #endif

+ 3
- 0
Marlin/src/inc/Warnings.cpp Parādīt failu

@@ -51,6 +51,9 @@
51 51
 #if HAS_COOLER && DISABLED(THERMAL_PROTECTION_COOLER)
52 52
   #warning "Safety Alert! Enable THERMAL_PROTECTION_COOLER for the final build!"
53 53
 #endif
54
+#if ANY_THERMISTOR_IS(998) || ANY_THERMISTOR_IS(999)
55
+  #warning "Warning! Don't use dummy thermistors (998/999) for final build!"
56
+#endif
54 57
 
55 58
 #if NONE(HAS_RESUME_CONTINUE, HOST_PROMPT_SUPPORT)
56 59
   #warning "Your Configuration provides no method to acquire user feedback!"

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

@@ -2207,22 +2207,22 @@ void Temperature::init() {
2207 2207
 
2208 2208
   // Thermistor activation by MCU pin
2209 2209
   #if PIN_EXISTS(TEMP_0_TR_ENABLE)
2210
-    OUT_WRITE(TEMP_0_TR_ENABLE_PIN,
2210
+    OUT_WRITE(TEMP_0_TR_ENABLE_PIN, (
2211 2211
       #if TEMP_SENSOR_IS_ANY_MAX_TC(0)
2212
-        1
2212
+        HIGH
2213 2213
       #else
2214
-        0
2214
+        LOW
2215 2215
       #endif
2216
-    );
2216
+    ));
2217 2217
   #endif
2218 2218
   #if PIN_EXISTS(TEMP_1_TR_ENABLE)
2219
-    OUT_WRITE(TEMP_1_TR_ENABLE_PIN,
2219
+    OUT_WRITE(TEMP_1_TR_ENABLE_PIN, (
2220 2220
       #if TEMP_SENSOR_IS_ANY_MAX_TC(1)
2221
-        1
2221
+        HIGH
2222 2222
       #else
2223
-        0
2223
+        LOW
2224 2224
       #endif
2225
-    );
2225
+    ));
2226 2226
   #endif
2227 2227
 
2228 2228
   #if HAS_HEATER_0

+ 0
- 12
Marlin/src/module/thermistor/thermistors.h Parādīt failu

@@ -42,18 +42,6 @@
42 42
 #define OV_SCALE(N) (N)
43 43
 #define OV(N) int16_t(OV_SCALE(N) * (OVERSAMPLENR) * (THERMISTOR_TABLE_SCALE))
44 44
 
45
-#define TEMP_SENSOR_IS(n,H) (n == TEMP_SENSOR_##H)
46
-#define ANY_THERMISTOR_IS(n) ( TEMP_SENSOR_IS(n, 0) || TEMP_SENSOR_IS(n, 1) \
47
-                            || TEMP_SENSOR_IS(n, 2) || TEMP_SENSOR_IS(n, 3) \
48
-                            || TEMP_SENSOR_IS(n, 4) || TEMP_SENSOR_IS(n, 5) \
49
-                            || TEMP_SENSOR_IS(n, 6) || TEMP_SENSOR_IS(n, 7) \
50
-                            || TEMP_SENSOR_IS(n, BED) \
51
-                            || TEMP_SENSOR_IS(n, CHAMBER) \
52
-                            || TEMP_SENSOR_IS(n, COOLER) \
53
-                            || TEMP_SENSOR_IS(n, PROBE) \
54
-                            || TEMP_SENSOR_IS(n, BOARD) \
55
-                            || TEMP_SENSOR_IS(n, REDUNDANT) )
56
-
57 45
 typedef struct { int16_t value; celsius_t celsius; } temp_entry_t;
58 46
 
59 47
 // Pt1000 and Pt100 handling

Notiek ielāde…
Atcelt
Saglabāt