瀏覽代碼

🩹 MAX Thermocouple followup

Followup to #24898
Scott Lahteine 1 年之前
父節點
當前提交
726321bc84
共有 2 個檔案被更改,包括 13 行新增8 行删除
  1. 5
    2
      Marlin/src/inc/Conditionals_LCD.h
  2. 8
    6
      Marlin/src/module/temperature.cpp

+ 5
- 2
Marlin/src/inc/Conditionals_LCD.h 查看文件

1020
 #endif
1020
 #endif
1021
 
1021
 
1022
 // Helper macros for extruder and hotend arrays
1022
 // Helper macros for extruder and hotend arrays
1023
-#define EXTRUDER_LOOP() for (int8_t e = 0; e < EXTRUDERS; e++)
1024
-#define HOTEND_LOOP() for (int8_t e = 0; e < HOTENDS; e++)
1023
+#define _EXTRUDER_LOOP(E) for (int8_t E = 0; E < EXTRUDERS; E++)
1024
+#define EXTRUDER_LOOP() _EXTRUDER_LOOP(e)
1025
+#define _HOTEND_LOOP(H) for (int8_t H = 0; H < HOTENDS; H++)
1026
+#define HOTEND_LOOP() _HOTEND_LOOP(e)
1027
+
1025
 #define ARRAY_BY_EXTRUDERS(V...) ARRAY_N(EXTRUDERS, V)
1028
 #define ARRAY_BY_EXTRUDERS(V...) ARRAY_N(EXTRUDERS, V)
1026
 #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_N_1(EXTRUDERS, v1)
1029
 #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_N_1(EXTRUDERS, v1)
1027
 #define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V)
1030
 #define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V)

+ 8
- 6
Marlin/src/module/temperature.cpp 查看文件

2374
   TERN_(HAS_POWER_MONITOR,     power_monitor.capture_values());
2374
   TERN_(HAS_POWER_MONITOR,     power_monitor.capture_values());
2375
 
2375
 
2376
   #if HAS_HOTEND
2376
   #if HAS_HOTEND
2377
-    static constexpr int8_t temp_dir[] = {
2377
+    static constexpr int8_t temp_dir[HOTENDS] = {
2378
       #if TEMP_SENSOR_IS_ANY_MAX_TC(0)
2378
       #if TEMP_SENSOR_IS_ANY_MAX_TC(0)
2379
         0
2379
         0
2380
       #else
2380
       #else
2386
         #else
2386
         #else
2387
           , TEMPDIR(1)
2387
           , TEMPDIR(1)
2388
         #endif
2388
         #endif
2389
+      #endif
2390
+      #if HOTENDS > 2
2389
         #if TEMP_SENSOR_IS_ANY_MAX_TC(2)
2391
         #if TEMP_SENSOR_IS_ANY_MAX_TC(2)
2390
           , 0
2392
           , 0
2391
         #else
2393
         #else
2392
           , TEMPDIR(2)
2394
           , TEMPDIR(2)
2393
         #endif
2395
         #endif
2394
-        #if HOTENDS > 3
2395
-          #define _TEMPDIR(N) , TEMPDIR(N)
2396
-          REPEAT_S(3, HOTENDS, _TEMPDIR)
2397
-        #endif
2396
+      #endif
2397
+      #if HOTENDS > 3
2398
+        #define _TEMPDIR(N) , TEMPDIR(N)
2399
+        REPEAT_S(3, HOTENDS, _TEMPDIR)
2398
       #endif
2400
       #endif
2399
     };
2401
     };
2400
 
2402
 
2401
-    LOOP_L_N(e, COUNT(temp_dir)) {
2403
+    HOTEND_LOOP() {
2402
       const raw_adc_t r = temp_hotend[e].getraw();
2404
       const raw_adc_t r = temp_hotend[e].getraw();
2403
       const bool neg = temp_dir[e] < 0, pos = temp_dir[e] > 0;
2405
       const bool neg = temp_dir[e] < 0, pos = temp_dir[e] > 0;
2404
       if ((neg && r < temp_range[e].raw_max) || (pos && r > temp_range[e].raw_max))
2406
       if ((neg && r < temp_range[e].raw_max) || (pos && r > temp_range[e].raw_max))

Loading…
取消
儲存