Browse Source

🩹 MAX Thermocouple followup

Followup to #24898
Scott Lahteine 1 year ago
parent
commit
726321bc84
2 changed files with 13 additions and 8 deletions
  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 View File

@@ -1020,8 +1020,11 @@
1020 1020
 #endif
1021 1021
 
1022 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 1028
 #define ARRAY_BY_EXTRUDERS(V...) ARRAY_N(EXTRUDERS, V)
1026 1029
 #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_N_1(EXTRUDERS, v1)
1027 1030
 #define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V)

+ 8
- 6
Marlin/src/module/temperature.cpp View File

@@ -2374,7 +2374,7 @@ void Temperature::updateTemperaturesFromRawValues() {
2374 2374
   TERN_(HAS_POWER_MONITOR,     power_monitor.capture_values());
2375 2375
 
2376 2376
   #if HAS_HOTEND
2377
-    static constexpr int8_t temp_dir[] = {
2377
+    static constexpr int8_t temp_dir[HOTENDS] = {
2378 2378
       #if TEMP_SENSOR_IS_ANY_MAX_TC(0)
2379 2379
         0
2380 2380
       #else
@@ -2386,19 +2386,21 @@ void Temperature::updateTemperaturesFromRawValues() {
2386 2386
         #else
2387 2387
           , TEMPDIR(1)
2388 2388
         #endif
2389
+      #endif
2390
+      #if HOTENDS > 2
2389 2391
         #if TEMP_SENSOR_IS_ANY_MAX_TC(2)
2390 2392
           , 0
2391 2393
         #else
2392 2394
           , TEMPDIR(2)
2393 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 2400
       #endif
2399 2401
     };
2400 2402
 
2401
-    LOOP_L_N(e, COUNT(temp_dir)) {
2403
+    HOTEND_LOOP() {
2402 2404
       const raw_adc_t r = temp_hotend[e].getraw();
2403 2405
       const bool neg = temp_dir[e] < 0, pos = temp_dir[e] > 0;
2404 2406
       if ((neg && r < temp_range[e].raw_max) || (pos && r > temp_range[e].raw_max))

Loading…
Cancel
Save