Quellcode durchsuchen

Implementation changes to support 5 extruders

Scott Lahteine vor 7 Jahren
Ursprung
Commit
832064e4f2
6 geänderte Dateien mit 389 neuen und 259 gelöschten Zeilen
  1. 25
    9
      Marlin/Marlin_main.cpp
  2. 80
    74
      Marlin/configuration_store.cpp
  3. 28
    5
      Marlin/planner.cpp
  4. 129
    78
      Marlin/temperature.cpp
  5. 1
    1
      Marlin/temperature.h
  6. 126
    92
      Marlin/ultralcd.cpp

+ 25
- 9
Marlin/Marlin_main.cpp Datei anzeigen

@@ -10707,9 +10707,12 @@ void prepare_move_to_destination() {
10707 10707
               || E2_ENABLE_READ == E_ENABLE_ON
10708 10708
               #if E_STEPPERS > 3
10709 10709
                 || E3_ENABLE_READ == E_ENABLE_ON
10710
-              #endif
10711
-            #endif
10712
-          #endif
10710
+                #if E_STEPPERS > 4
10711
+                  || E4_ENABLE_READ == E_ENABLE_ON
10712
+                #endif // E_STEPPERS > 4
10713
+              #endif // E_STEPPERS > 3
10714
+            #endif // E_STEPPERS > 2
10715
+          #endif // E_STEPPERS > 1
10713 10716
       ) {
10714 10717
         lastMotorOn = ms; //... set time to NOW so the fan will turn on
10715 10718
       }
@@ -10930,6 +10933,7 @@ void enable_all_steppers() {
10930 10933
   enable_e1();
10931 10934
   enable_e2();
10932 10935
   enable_e3();
10936
+  enable_e4();
10933 10937
 }
10934 10938
 
10935 10939
 void disable_e_steppers() {
@@ -10937,6 +10941,7 @@ void disable_e_steppers() {
10937 10941
   disable_e1();
10938 10942
   disable_e2();
10939 10943
   disable_e3();
10944
+  disable_e4();
10940 10945
 }
10941 10946
 
10942 10947
 void disable_all_steppers() {
@@ -11135,9 +11140,15 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
11135 11140
                   oldstatus = E3_ENABLE_READ;
11136 11141
                   enable_e3();
11137 11142
                   break;
11138
-              #endif
11139
-            #endif
11140
-          #endif
11143
+                #if E_STEPPERS > 4
11144
+                  case 4:
11145
+                    oldstatus = E4_ENABLE_READ;
11146
+                    enable_e4();
11147
+                    break;
11148
+                #endif // E_STEPPERS > 4
11149
+              #endif // E_STEPPERS > 3
11150
+            #endif // E_STEPPERS > 2
11151
+          #endif // E_STEPPERS > 1
11141 11152
         }
11142 11153
       #endif // !SWITCHING_EXTRUDER
11143 11154
 
@@ -11168,9 +11179,14 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
11168 11179
                 case 3:
11169 11180
                   E3_ENABLE_WRITE(oldstatus);
11170 11181
                   break;
11171
-              #endif
11172
-            #endif
11173
-          #endif
11182
+                #if E_STEPPERS > 4
11183
+                  case 4:
11184
+                    E4_ENABLE_WRITE(oldstatus);
11185
+                    break;
11186
+                #endif // E_STEPPERS > 4
11187
+              #endif // E_STEPPERS > 3
11188
+            #endif // E_STEPPERS > 2
11189
+          #endif // E_STEPPERS > 1
11174 11190
         }
11175 11191
       #endif // !SWITCHING_EXTRUDER
11176 11192
     }

+ 80
- 74
Marlin/configuration_store.cpp Datei anzeigen

@@ -36,7 +36,7 @@
36 36
  *
37 37
  */
38 38
 
39
-#define EEPROM_VERSION "V31"
39
+#define EEPROM_VERSION "V32"
40 40
 
41 41
 // Change EEPROM version if these are changed:
42 42
 #define EEPROM_OFFSET 100
@@ -44,45 +44,45 @@
44 44
 /**
45 45
  * V31 EEPROM Layout:
46 46
  *
47
- *  100  Version                                   (char x4)
48
- *  104  EEPROM Checksum                           (uint16_t)
47
+ *  100  Version                                    (char x4)
48
+ *  104  EEPROM Checksum                            (uint16_t)
49 49
  *
50 50
  *  106            E_STEPPERS (uint8_t)
51
- *  107  M92 XYZE  planner.axis_steps_per_mm (float x4 ... x7)
52
- *  123  M203 XYZE planner.max_feedrate_mm_s (float x4 ... x7)
53
- *  139  M201 XYZE planner.max_acceleration_mm_per_s2 (uint32_t x4 ... x7)
54
- *  155  M204 P    planner.acceleration (float)
55
- *  159  M204 R    planner.retract_acceleration (float)
56
- *  163  M204 T    planner.travel_acceleration (float)
57
- *  167  M205 S    planner.min_feedrate_mm_s (float)
51
+ *  107  M92 XYZE  planner.axis_steps_per_mm        (float x4 ... x8)
52
+ *  123  M203 XYZE planner.max_feedrate_mm_s        (float x4 ... x8)
53
+ *  139  M201 XYZE planner.max_acceleration_mm_per_s2 (uint32_t x4 ... x8)
54
+ *  155  M204 P    planner.acceleration             (float)
55
+ *  159  M204 R    planner.retract_acceleration     (float)
56
+ *  163  M204 T    planner.travel_acceleration      (float)
57
+ *  167  M205 S    planner.min_feedrate_mm_s        (float)
58 58
  *  171  M205 T    planner.min_travel_feedrate_mm_s (float)
59
- *  175  M205 B    planner.min_segment_time (ulong)
60
- *  179  M205 X    planner.max_jerk[X_AXIS] (float)
61
- *  183  M205 Y    planner.max_jerk[Y_AXIS] (float)
62
- *  187  M205 Z    planner.max_jerk[Z_AXIS] (float)
63
- *  191  M205 E    planner.max_jerk[E_AXIS] (float)
64
- *  195  M206 XYZ  home_offset (float x3)
65
- *  207  M218 XYZ  hotend_offset (float x3 per additional hotend)
59
+ *  175  M205 B    planner.min_segment_time         (ulong)
60
+ *  179  M205 X    planner.max_jerk[X_AXIS]         (float)
61
+ *  183  M205 Y    planner.max_jerk[Y_AXIS]         (float)
62
+ *  187  M205 Z    planner.max_jerk[Z_AXIS]         (float)
63
+ *  191  M205 E    planner.max_jerk[E_AXIS]         (float)
64
+ *  195  M206 XYZ  home_offset                      (float x3)
65
+ *  207  M218 XYZ  hotend_offset                    (float x3 per additional hotend)
66 66
  *
67
- * Mesh bed leveling:
68
- *  219  M420 S    from mbl.status (bool)
69
- *  220            mbl.z_offset (float)
70
- *  224            GRID_MAX_POINTS_X (uint8 as set in firmware)
71
- *  225            GRID_MAX_POINTS_Y (uint8 as set in firmware)
72
- *  226 G29 S3 XYZ z_values[][] (float x9, by default, up to float x 81) +288
67
+ * Mesh bed leveling:                               43 bytes
68
+ *  219  M420 S    from mbl.status                  (bool)
69
+ *  220            mbl.z_offset                     (float)
70
+ *  224            GRID_MAX_POINTS_X                (uint8_t)
71
+ *  225            GRID_MAX_POINTS_Y                (uint8_t)
72
+ *  226 G29 S3 XYZ z_values[][]                     (float x9, up to float x 81) +288
73 73
  *
74
- * AUTO BED LEVELING
75
- *  262  M851      zprobe_zoffset (float)
74
+ * AUTO BED LEVELING                                4 bytes
75
+ *  262  M851      zprobe_zoffset                   (float)
76 76
  *
77
- * ABL_PLANAR (or placeholder):                    36 bytes
78
- *  266            planner.bed_level_matrix        (matrix_3x3 = float x9)
77
+ * ABL_PLANAR (or placeholder):                     36 bytes
78
+ *  266            planner.bed_level_matrix         (matrix_3x3 = float x9)
79 79
  *
80
- * AUTO_BED_LEVELING_BILINEAR (or placeholder):    47 bytes
81
- *  302            GRID_MAX_POINTS_X               (uint8_t)
82
- *  303            GRID_MAX_POINTS_Y               (uint8_t)
83
- *  304            bilinear_grid_spacing           (int x2)   from G29: (B-F)/X, (R-L)/Y
84
- *  308  G29 L F   bilinear_start                  (int x2)
85
- *  312            bed_level_grid[][]              (float x9, up to float x256) +988
80
+ * AUTO_BED_LEVELING_BILINEAR (or placeholder):     47 bytes
81
+ *  302            GRID_MAX_POINTS_X                (uint8_t)
82
+ *  303            GRID_MAX_POINTS_Y                (uint8_t)
83
+ *  304            bilinear_grid_spacing            (int x2)
84
+ *  308  G29 L F   bilinear_start                   (int x2)
85
+ *  312            bed_level_grid[][]               (float x9, up to float x256) +988
86 86
  *
87 87
  * DELTA (if deltabot):                             48 bytes
88 88
  *  348  M666 XYZ  endstop_adj                      (float x3)
@@ -96,56 +96,57 @@
96 96
  *  388  M665 J    delta_tower_angle_trim[B]        (float)
97 97
  *  392  M665 K    delta_tower_angle_trim[C]        (float)
98 98
  *
99
- * Z_DUAL_ENDSTOPS (if not deltabot):              48 bytes
100
- *  348  M666 Z    z_endstop_adj                   (float)
101
- *  ---            dummy data                      (float x11)
99
+ * Z_DUAL_ENDSTOPS (if not deltabot):               48 bytes
100
+ *  348  M666 Z    z_endstop_adj                    (float)
101
+ *  ---            dummy data                       (float x11)
102 102
  *
103
- * ULTIPANEL:                                      6 bytes
104
- *  396  M145 S0 H lcd_preheat_hotend_temp         (int x2)
105
- *  400  M145 S0 B lcd_preheat_bed_temp            (int x2)
106
- *  404  M145 S0 F lcd_preheat_fan_speed           (int x2)
103
+ * ULTIPANEL:                                       6 bytes
104
+ *  396  M145 S0 H lcd_preheat_hotend_temp          (int x2)
105
+ *  400  M145 S0 B lcd_preheat_bed_temp             (int x2)
106
+ *  404  M145 S0 F lcd_preheat_fan_speed            (int x2)
107 107
  *
108
- * PIDTEMP:                                        66 bytes
109
- *  408  M301 E0 PIDC  Kp[0], Ki[0], Kd[0], Kc[0]  (float x4)
110
- *  424  M301 E1 PIDC  Kp[1], Ki[1], Kd[1], Kc[1]  (float x4)
111
- *  440  M301 E2 PIDC  Kp[2], Ki[2], Kd[2], Kc[2]  (float x4)
112
- *  456  M301 E3 PIDC  Kp[3], Ki[3], Kd[3], Kc[3]  (float x4)
113
- *  472  M301 L        lpq_len                     (int)
108
+ * PIDTEMP:                                         66 bytes
109
+ *  408  M301 E0 PIDC  Kp[0], Ki[0], Kd[0], Kc[0]   (float x4)
110
+ *  424  M301 E1 PIDC  Kp[1], Ki[1], Kd[1], Kc[1]   (float x4)
111
+ *  440  M301 E2 PIDC  Kp[2], Ki[2], Kd[2], Kc[2]   (float x4)
112
+ *  456  M301 E3 PIDC  Kp[3], Ki[3], Kd[3], Kc[3]   (float x4)
113
+ *  472  M301 E4 PIDC  Kp[3], Ki[3], Kd[3], Kc[3]   (float x4)
114
+ *  488  M301 L        lpq_len                      (int)
114 115
  *
115 116
  * PIDTEMPBED:                                      12 bytes
116
- *  474  M304 PID  thermalManager.bedKp, .bedKi, .bedKd (float x3)
117
+ *  490  M304 PID  thermalManager.bedKp, .bedKi, .bedKd (float x3)
117 118
  *
118 119
  * DOGLCD:                                          2 bytes
119
- *  486  M250 C    lcd_contrast                     (int)
120
+ *  502  M250 C    lcd_contrast                     (int)
120 121
  *
121 122
  * FWRETRACT:                                       29 bytes
122
- *  488  M209 S    autoretract_enabled              (bool)
123
- *  489  M207 S    retract_length                   (float)
124
- *  493  M207 W    retract_length_swap              (float)
125
- *  497  M207 F    retract_feedrate_mm_s            (float)
126
- *  501  M207 Z    retract_zlift                    (float)
127
- *  505  M208 S    retract_recover_length           (float)
128
- *  509  M208 W    retract_recover_length_swap      (float)
129
- *  513  M208 F    retract_recover_feedrate_mm_s    (float)
123
+ *  504  M209 S    autoretract_enabled              (bool)
124
+ *  505  M207 S    retract_length                   (float)
125
+ *  509  M207 W    retract_length_swap              (float)
126
+ *  513  M207 F    retract_feedrate_mm_s            (float)
127
+ *  517  M207 Z    retract_zlift                    (float)
128
+ *  521  M208 S    retract_recover_length           (float)
129
+ *  525  M208 W    retract_recover_length_swap      (float)
130
+ *  529  M208 F    retract_recover_feedrate_mm_s    (float)
130 131
  *
131
- * Volumetric Extrusion:                            17 bytes
132
- *  517  M200 D    volumetric_enabled               (bool)
133
- *  518  M200 T D  filament_size                    (float x4) (T0..3)
132
+ * Volumetric Extrusion:                            21 bytes
133
+ *  533  M200 D    volumetric_enabled               (bool)
134
+ *  534  M200 T D  filament_size                    (float x5) (T0..3)
134 135
  *
135 136
  * TMC2130 Stepper Current:                         20 bytes
136
- *  534  M906 X    stepperX current                 (uint16_t)
137
- *  536  M906 Y    stepperY current                 (uint16_t)
138
- *  538  M906 Z    stepperZ current                 (uint16_t)
139
- *  540  M906 X2   stepperX2 current                (uint16_t)
140
- *  542  M906 Y2   stepperY2 current                (uint16_t)
141
- *  544  M906 Z2   stepperZ2 current                (uint16_t)
142
- *  546  M906 E0   stepperE0 current                (uint16_t)
143
- *  548  M906 E1   stepperE1 current                (uint16_t)
144
- *  550  M906 E2   stepperE2 current                (uint16_t)
145
- *  552  M906 E3   stepperE3 current                (uint16_t)
137
+ *  554  M906 X    stepperX current                 (uint16_t)
138
+ *  556  M906 Y    stepperY current                 (uint16_t)
139
+ *  558  M906 Z    stepperZ current                 (uint16_t)
140
+ *  560  M906 X2   stepperX2 current                (uint16_t)
141
+ *  562  M906 Y2   stepperY2 current                (uint16_t)
142
+ *  564  M906 Z2   stepperZ2 current                (uint16_t)
143
+ *  566  M906 E0   stepperE0 current                (uint16_t)
144
+ *  568  M906 E1   stepperE1 current                (uint16_t)
145
+ *  570  M906 E2   stepperE2 current                (uint16_t)
146
+ *  572  M906 E3   stepperE3 current                (uint16_t)
146 147
  *
147
- *  554                                Minimum end-point
148
- * 1875 (554 + 36 + 9 + 288 + 988)     Maximum end-point
148
+ *  574                                Minimum end-point
149
+ * 1895 (574 + 36 + 9 + 288 + 988)     Maximum end-point
149 150
  *
150 151
  */
151 152
 #include "Marlin.h"
@@ -1433,9 +1434,14 @@ void Config_ResetDefault() {
1433 1434
           CONFIG_ECHO_START;
1434 1435
           SERIAL_ECHOPAIR("  M200 T3 D", filament_size[3]);
1435 1436
           SERIAL_EOL;
1436
-        #endif
1437
-      #endif
1438
-    #endif
1437
+          #if EXTRUDERS > 4
1438
+            CONFIG_ECHO_START;
1439
+            SERIAL_ECHOPAIR("  M200 T4 D", filament_size[4]);
1440
+            SERIAL_EOL;
1441
+          #endif // EXTRUDERS > 4
1442
+        #endif // EXTRUDERS > 3
1443
+      #endif // EXTRUDERS > 2
1444
+    #endif // EXTRUDERS > 1
1439 1445
 
1440 1446
     if (!volumetric_enabled) {
1441 1447
       CONFIG_ECHO_START;

+ 28
- 5
Marlin/planner.cpp Datei anzeigen

@@ -882,9 +882,12 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
882 882
               if (g_uc_extruder_last_move[2] == 0) disable_e2();
883 883
               #if EXTRUDERS > 3
884 884
                 if (g_uc_extruder_last_move[3] == 0) disable_e3();
885
-              #endif
886
-            #endif
887
-          #endif
885
+                #if EXTRUDERS > 4
886
+                  if (g_uc_extruder_last_move[4] == 0) disable_e4();
887
+                #endif // EXTRUDERS > 4
888
+              #endif // EXTRUDERS > 3
889
+            #endif // EXTRUDERS > 2
890
+          #endif // EXTRUDERS > 1
888 891
         break;
889 892
         #if EXTRUDERS > 1
890 893
           case 1:
@@ -895,8 +898,11 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
895 898
               if (g_uc_extruder_last_move[2] == 0) disable_e2();
896 899
               #if EXTRUDERS > 3
897 900
                 if (g_uc_extruder_last_move[3] == 0) disable_e3();
898
-              #endif
899
-            #endif
901
+                #if EXTRUDERS > 4
902
+                  if (g_uc_extruder_last_move[4] == 0) disable_e4();
903
+                #endif // EXTRUDERS > 4
904
+              #endif // EXTRUDERS > 3
905
+            #endif // EXTRUDERS > 2
900 906
           break;
901 907
           #if EXTRUDERS > 2
902 908
             case 2:
@@ -906,6 +912,9 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
906 912
               if (g_uc_extruder_last_move[1] == 0) disable_e1();
907 913
               #if EXTRUDERS > 3
908 914
                 if (g_uc_extruder_last_move[3] == 0) disable_e3();
915
+                #if EXTRUDERS > 4
916
+                  if (g_uc_extruder_last_move[4] == 0) disable_e4();
917
+                #endif
909 918
               #endif
910 919
             break;
911 920
             #if EXTRUDERS > 3
@@ -915,7 +924,20 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
915 924
                 if (g_uc_extruder_last_move[0] == 0) disable_e0();
916 925
                 if (g_uc_extruder_last_move[1] == 0) disable_e1();
917 926
                 if (g_uc_extruder_last_move[2] == 0) disable_e2();
927
+                #if EXTRUDERS > 4
928
+                  if (g_uc_extruder_last_move[4] == 0) disable_e4();
929
+                #endif
918 930
               break;
931
+              #if EXTRUDERS > 4
932
+                case 4:
933
+                  enable_e4();
934
+                  g_uc_extruder_last_move[4] = (BLOCK_BUFFER_SIZE) * 2;
935
+                  if (g_uc_extruder_last_move[0] == 0) disable_e0();
936
+                  if (g_uc_extruder_last_move[1] == 0) disable_e1();
937
+                  if (g_uc_extruder_last_move[2] == 0) disable_e2();
938
+                  if (g_uc_extruder_last_move[3] == 0) disable_e3();
939
+                break;
940
+              #endif // EXTRUDERS > 4
919 941
             #endif // EXTRUDERS > 3
920 942
           #endif // EXTRUDERS > 2
921 943
         #endif // EXTRUDERS > 1
@@ -925,6 +947,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
925 947
       enable_e1();
926 948
       enable_e2();
927 949
       enable_e3();
950
+      enable_e4();
928 951
     #endif
929 952
   }
930 953
 

+ 129
- 78
Marlin/temperature.cpp Datei anzeigen

@@ -51,8 +51,8 @@
51 51
   static void* heater_ttbl_map[2] = {(void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE };
52 52
   static uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
53 53
 #else
54
-  static void* heater_ttbl_map[HOTENDS] = ARRAY_BY_HOTENDS((void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE, (void*)HEATER_2_TEMPTABLE, (void*)HEATER_3_TEMPTABLE);
55
-  static uint8_t heater_ttbllen_map[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN, HEATER_3_TEMPTABLE_LEN);
54
+  static void* heater_ttbl_map[HOTENDS] = ARRAY_BY_HOTENDS((void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE, (void*)HEATER_2_TEMPTABLE, (void*)HEATER_3_TEMPTABLE, (void*)HEATER_4_TEMPTABLE);
55
+  static uint8_t heater_ttbllen_map[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN, HEATER_3_TEMPTABLE_LEN, HEATER_4_TEMPTABLE_LEN);
56 56
 #endif
57 57
 
58 58
 Temperature thermalManager;
@@ -161,8 +161,8 @@ unsigned long Temperature::raw_temp_value[MAX_EXTRUDERS] = { 0 };
161 161
 unsigned long Temperature::raw_temp_bed_value = 0;
162 162
 
163 163
 // Init min and max temp with extreme values to prevent false errors during startup
164
-int 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),
165
-    Temperature::maxttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_HI_TEMP , HEATER_1_RAW_HI_TEMP , HEATER_2_RAW_HI_TEMP, HEATER_3_RAW_HI_TEMP),
164
+int 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),
165
+    Temperature::maxttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_HI_TEMP , HEATER_1_RAW_HI_TEMP , HEATER_2_RAW_HI_TEMP, HEATER_3_RAW_HI_TEMP, HEATER_4_RAW_HI_TEMP),
166 166
     Temperature::minttemp[HOTENDS] = { 0 },
167 167
     Temperature::maxttemp[HOTENDS] = ARRAY_BY_HOTENDS1(16383);
168 168
 
@@ -460,12 +460,13 @@ int Temperature::getHeaterPower(int heater) {
460 460
 #if HAS_AUTO_FAN
461 461
 
462 462
   void Temperature::checkExtruderAutoFans() {
463
-    const int8_t fanPin[] = { E0_AUTO_FAN_PIN, E1_AUTO_FAN_PIN, E2_AUTO_FAN_PIN, E3_AUTO_FAN_PIN };
464
-    const int fanBit[] = {
463
+    constexpr int8_t fanPin[] = { E0_AUTO_FAN_PIN, E1_AUTO_FAN_PIN, E2_AUTO_FAN_PIN, E3_AUTO_FAN_PIN, E4_AUTO_FAN_PIN };
464
+    constexpr int fanBit[] = {
465 465
                     0,
466 466
       AUTO_1_IS_0 ? 0 :               1,
467 467
       AUTO_2_IS_0 ? 0 : AUTO_2_IS_1 ? 1 :               2,
468
-      AUTO_3_IS_0 ? 0 : AUTO_3_IS_1 ? 1 : AUTO_3_IS_2 ? 2 : 3
468
+      AUTO_3_IS_0 ? 0 : AUTO_3_IS_1 ? 1 : AUTO_3_IS_2 ? 2 :               3,
469
+      AUTO_4_IS_0 ? 0 : AUTO_4_IS_1 ? 1 : AUTO_4_IS_2 ? 2 : AUTO_4_IS_3 ? 3 : 4
469 470
     };
470 471
     uint8_t fanState = 0;
471 472
 
@@ -973,6 +974,9 @@ void Temperature::init() {
973 974
   #if HAS_HEATER_3
974 975
     SET_OUTPUT(HEATER_3_PIN);
975 976
   #endif
977
+  #if HAS_HEATER_4
978
+    SET_OUTPUT(HEATER_3_PIN);
979
+  #endif
976 980
   #if HAS_HEATER_BED
977 981
     SET_OUTPUT(HEATER_BED_PIN);
978 982
   #endif
@@ -1033,6 +1037,9 @@ void Temperature::init() {
1033 1037
   #if HAS_TEMP_3
1034 1038
     ANALOG_SELECT(TEMP_3_PIN);
1035 1039
   #endif
1040
+  #if HAS_TEMP_4
1041
+    ANALOG_SELECT(TEMP_4_PIN);
1042
+  #endif
1036 1043
   #if HAS_TEMP_BED
1037 1044
     ANALOG_SELECT(TEMP_BED_PIN);
1038 1045
   #endif
@@ -1080,6 +1087,16 @@ void Temperature::init() {
1080 1087
       SET_OUTPUT(E3_AUTO_FAN_PIN);
1081 1088
     #endif
1082 1089
   #endif
1090
+  #if HAS_AUTO_FAN_4 && !AUTO_4_IS_0 && !AUTO_4_IS_1 && !AUTO_4_IS_2 && !AUTO_4_IS_3
1091
+    #if E4_AUTO_FAN_PIN == FAN1_PIN
1092
+      SET_OUTPUT(E4_AUTO_FAN_PIN);
1093
+      #if ENABLED(FAST_PWM_FAN)
1094
+        setPwmFrequency(E4_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
1095
+      #endif
1096
+    #else
1097
+      SET_OUTPUT(E4_AUTO_FAN_PIN);
1098
+    #endif
1099
+  #endif
1083 1100
 
1084 1101
   // Use timer0 for temperature measurement
1085 1102
   // Interleave temperature interrupt with millies interrupt
@@ -1133,6 +1150,14 @@ void Temperature::init() {
1133 1150
         #ifdef HEATER_3_MAXTEMP
1134 1151
           TEMP_MAX_ROUTINE(3);
1135 1152
         #endif
1153
+        #if HOTENDS > 4
1154
+          #ifdef HEATER_4_MINTEMP
1155
+            TEMP_MIN_ROUTINE(4);
1156
+          #endif
1157
+          #ifdef HEATER_4_MAXTEMP
1158
+            TEMP_MAX_ROUTINE(4);
1159
+          #endif
1160
+        #endif // HOTENDS > 4
1136 1161
       #endif // HOTENDS > 3
1137 1162
     #endif // HOTENDS > 2
1138 1163
   #endif // HOTENDS > 1
@@ -1264,18 +1289,18 @@ void Temperature::disable_all_heaters() {
1264 1289
 
1265 1290
   #if HAS_TEMP_HOTEND
1266 1291
     DISABLE_HEATER(0);
1267
-  #endif
1268
-
1269
-  #if HOTENDS > 1 && HAS_TEMP_1
1270
-    DISABLE_HEATER(1);
1271
-  #endif
1272
-
1273
-  #if HOTENDS > 2 && HAS_TEMP_2
1274
-    DISABLE_HEATER(2);
1275
-  #endif
1276
-
1277
-  #if HOTENDS > 3 && HAS_TEMP_3
1278
-    DISABLE_HEATER(3);
1292
+    #if HOTENDS > 1
1293
+      DISABLE_HEATER(1);
1294
+      #if HOTENDS > 2
1295
+        DISABLE_HEATER(2);
1296
+        #if HOTENDS > 3
1297
+          DISABLE_HEATER(3);
1298
+          #if HOTENDS > 4
1299
+            DISABLE_HEATER(4);
1300
+          #endif // HOTENDS > 4
1301
+        #endif // HOTENDS > 3
1302
+      #endif // HOTENDS > 2
1303
+    #endif // HOTENDS > 1
1279 1304
   #endif
1280 1305
 
1281 1306
   #if HAS_TEMP_BED
@@ -1384,6 +1409,9 @@ void Temperature::set_current_temp_raw() {
1384 1409
       current_temperature_raw[2] = raw_temp_value[2];
1385 1410
       #if HAS_TEMP_3
1386 1411
         current_temperature_raw[3] = raw_temp_value[3];
1412
+        #if HAS_TEMP_4
1413
+          current_temperature_raw[4] = raw_temp_value[4];
1414
+        #endif
1387 1415
       #endif
1388 1416
     #endif
1389 1417
   #endif
@@ -1525,9 +1553,12 @@ void Temperature::isr() {
1525 1553
       ISR_STATICS(2);
1526 1554
       #if HOTENDS > 3
1527 1555
         ISR_STATICS(3);
1528
-      #endif
1529
-    #endif
1530
-  #endif
1556
+        #if HOTENDS > 4
1557
+          ISR_STATICS(4);
1558
+        #endif // HOTENDS > 4
1559
+      #endif // HOTENDS > 3
1560
+    #endif // HOTENDS > 2
1561
+  #endif // HOTENDS > 1
1531 1562
   #if HAS_HEATER_BED
1532 1563
     ISR_STATICS(BED);
1533 1564
   #endif
@@ -1561,9 +1592,13 @@ void Temperature::isr() {
1561 1592
           #if HOTENDS > 3
1562 1593
             soft_pwm_3 = (soft_pwm_3 & pwm_mask) + soft_pwm[3];
1563 1594
             WRITE_HEATER_3(soft_pwm_3 > pwm_mask ? HIGH : LOW);
1564
-          #endif
1565
-        #endif
1566
-      #endif
1595
+            #if HOTENDS > 4
1596
+              soft_pwm_4 = (soft_pwm_4 & pwm_mask) + soft_pwm[4];
1597
+              WRITE_HEATER_4(soft_pwm_4 > pwm_mask ? HIGH : LOW);
1598
+            #endif // HOTENDS > 4
1599
+          #endif // HOTENDS > 3
1600
+        #endif // HOTENDS > 2
1601
+      #endif // HOTENDS > 1
1567 1602
 
1568 1603
       #if HAS_HEATER_BED
1569 1604
         soft_pwm_BED = (soft_pwm_BED & pwm_mask) + soft_pwm_bed;
@@ -1589,13 +1624,16 @@ void Temperature::isr() {
1589 1624
       if (soft_pwm_0 <= pwm_count_tmp) WRITE_HEATER_0(0);
1590 1625
       #if HOTENDS > 1
1591 1626
         if (soft_pwm_1 <= pwm_count_tmp) WRITE_HEATER_1(0);
1592
-      #endif
1593
-      #if HOTENDS > 2
1594
-        if (soft_pwm_2 <= pwm_count_tmp) WRITE_HEATER_2(0);
1595
-      #endif
1596
-      #if HOTENDS > 3
1597
-        if (soft_pwm_3 <= pwm_count_tmp) WRITE_HEATER_3(0);
1598
-      #endif
1627
+        #if HOTENDS > 2
1628
+          if (soft_pwm_2 <= pwm_count_tmp) WRITE_HEATER_2(0);
1629
+          #if HOTENDS > 3
1630
+            if (soft_pwm_3 <= pwm_count_tmp) WRITE_HEATER_3(0);
1631
+            #if HOTENDS > 4
1632
+              if (soft_pwm_4 <= pwm_count_tmp) WRITE_HEATER_4(0);
1633
+            #endif // HOTENDS > 4
1634
+          #endif // HOTENDS > 3
1635
+        #endif // HOTENDS > 2
1636
+      #endif // HOTENDS > 1
1599 1637
 
1600 1638
       #if HAS_HEATER_BED
1601 1639
         if (soft_pwm_BED <= pwm_count_tmp) WRITE_HEATER_BED(0);
@@ -1665,32 +1703,38 @@ void Temperature::isr() {
1665 1703
 
1666 1704
     if (slow_pwm_count == 0) {
1667 1705
 
1668
-      SLOW_PWM_ROUTINE(0); // EXTRUDER 0
1706
+      SLOW_PWM_ROUTINE(0);
1669 1707
       #if HOTENDS > 1
1670
-        SLOW_PWM_ROUTINE(1); // EXTRUDER 1
1708
+        SLOW_PWM_ROUTINE(1);
1671 1709
         #if HOTENDS > 2
1672
-          SLOW_PWM_ROUTINE(2); // EXTRUDER 2
1710
+          SLOW_PWM_ROUTINE(2);
1673 1711
           #if HOTENDS > 3
1674
-            SLOW_PWM_ROUTINE(3); // EXTRUDER 3
1675
-          #endif
1676
-        #endif
1677
-      #endif
1712
+            SLOW_PWM_ROUTINE(3);
1713
+            #if HOTENDS > 4
1714
+              SLOW_PWM_ROUTINE(4);
1715
+            #endif // HOTENDS > 4
1716
+          #endif // HOTENDS > 3
1717
+        #endif // HOTENDS > 2
1718
+      #endif // HOTENDS > 1
1678 1719
       #if HAS_HEATER_BED
1679 1720
         _SLOW_PWM_ROUTINE(BED, soft_pwm_bed); // BED
1680 1721
       #endif
1681 1722
 
1682 1723
     } // slow_pwm_count == 0
1683 1724
 
1684
-    PWM_OFF_ROUTINE(0); // EXTRUDER 0
1725
+    PWM_OFF_ROUTINE(0);
1685 1726
     #if HOTENDS > 1
1686
-      PWM_OFF_ROUTINE(1); // EXTRUDER 1
1727
+      PWM_OFF_ROUTINE(1);
1687 1728
       #if HOTENDS > 2
1688
-        PWM_OFF_ROUTINE(2); // EXTRUDER 2
1729
+        PWM_OFF_ROUTINE(2);
1689 1730
         #if HOTENDS > 3
1690
-          PWM_OFF_ROUTINE(3); // EXTRUDER 3
1691
-        #endif
1692
-      #endif
1693
-    #endif
1731
+          PWM_OFF_ROUTINE(3);
1732
+          #if HOTENDS > 4
1733
+            PWM_OFF_ROUTINE(4);
1734
+          #endif // HOTENDS > 4
1735
+        #endif // HOTENDS > 3
1736
+      #endif // HOTENDS > 2
1737
+    #endif // HOTENDS > 1
1694 1738
     #if HAS_HEATER_BED
1695 1739
       PWM_OFF_ROUTINE(BED); // BED
1696 1740
     #endif
@@ -1738,17 +1782,19 @@ void Temperature::isr() {
1738 1782
       slow_pwm_count++;
1739 1783
       slow_pwm_count &= 0x7F;
1740 1784
 
1741
-      // EXTRUDER 0
1742 1785
       if (state_timer_heater_0 > 0) state_timer_heater_0--;
1743
-      #if HOTENDS > 1    // EXTRUDER 1
1786
+      #if HOTENDS > 1
1744 1787
         if (state_timer_heater_1 > 0) state_timer_heater_1--;
1745
-        #if HOTENDS > 2    // EXTRUDER 2
1788
+        #if HOTENDS > 2
1746 1789
           if (state_timer_heater_2 > 0) state_timer_heater_2--;
1747
-          #if HOTENDS > 3    // EXTRUDER 3
1790
+          #if HOTENDS > 3
1748 1791
             if (state_timer_heater_3 > 0) state_timer_heater_3--;
1749
-          #endif
1750
-        #endif
1751
-      #endif
1792
+            #if HOTENDS > 4
1793
+              if (state_timer_heater_4 > 0) state_timer_heater_4--;
1794
+            #endif // HOTENDS > 4
1795
+          #endif // HOTENDS > 3
1796
+        #endif // HOTENDS > 2
1797
+      #endif // HOTENDS > 1
1752 1798
       #if HAS_HEATER_BED
1753 1799
         if (state_timer_heater_BED > 0) state_timer_heater_BED--;
1754 1800
       #endif
@@ -1763,7 +1809,7 @@ void Temperature::isr() {
1763 1809
     #define START_ADC(pin) ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
1764 1810
   #endif
1765 1811
 
1766
-  // Prepare or measure a sensor, each one every 12th frame
1812
+  // Prepare or measure a sensor, each one every 14th frame
1767 1813
   switch (temp_state) {
1768 1814
     case PrepareTemp_0:
1769 1815
       #if HAS_TEMP_0
@@ -1832,6 +1878,20 @@ void Temperature::isr() {
1832 1878
       #if HAS_TEMP_3
1833 1879
         raw_temp_value[3] += ADC;
1834 1880
       #endif
1881
+      temp_state = PrepareTemp_4;
1882
+      break;
1883
+
1884
+    case PrepareTemp_4:
1885
+      #if HAS_TEMP_4
1886
+        START_ADC(TEMP_4_PIN);
1887
+      #endif
1888
+      lcd_buttons_update();
1889
+      temp_state = MeasureTemp_4;
1890
+      break;
1891
+    case MeasureTemp_4:
1892
+      #if HAS_TEMP_4
1893
+        raw_temp_value[4] += ADC;
1894
+      #endif
1835 1895
       temp_state = Prepare_FILWIDTH;
1836 1896
       break;
1837 1897
 
@@ -1879,35 +1939,26 @@ void Temperature::isr() {
1879 1939
     ZERO(raw_temp_value);
1880 1940
     raw_temp_bed_value = 0;
1881 1941
 
1942
+    #define TEMPDIR(N) ((HEATER_##N##_RAW_LO_TEMP) > (HEATER_##N##_RAW_HI_TEMP) ? -1 : 1)
1943
+
1882 1944
     int constexpr temp_dir[] = {
1883 1945
       #if ENABLED(HEATER_0_USES_MAX6675)
1884 1946
          0
1885
-      #elif HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
1886
-        -1
1887 1947
       #else
1888
-         1
1889
-      #endif
1890
-      #if HAS_TEMP_1 && HOTENDS > 1
1891
-        #if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP
1892
-          , -1
1893
-        #else
1894
-          ,  1
1895
-        #endif
1896
-      #endif
1897
-      #if HAS_TEMP_2 && HOTENDS > 2
1898
-        #if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP
1899
-          , -1
1900
-        #else
1901
-          ,  1
1902
-        #endif
1903
-      #endif
1904
-      #if HAS_TEMP_3 && HOTENDS > 3
1905
-        #if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP
1906
-          , -1
1907
-        #else
1908
-          ,  1
1909
-        #endif
1948
+        TEMPDIR(0)
1910 1949
       #endif
1950
+      #if HOTENDS > 1
1951
+        , TEMPDIR(1)
1952
+        #if HOTENDS > 2
1953
+          , TEMPDIR(2)
1954
+          #if HOTENDS > 3
1955
+            , TEMPDIR(3)
1956
+            #if HOTENDS > 4
1957
+              , TEMPDIR(4)
1958
+            #endif // HOTENDS > 4
1959
+          #endif // HOTENDS > 3
1960
+        #endif // HOTENDS > 2
1961
+      #endif // HOTENDS > 1
1911 1962
     };
1912 1963
 
1913 1964
     for (uint8_t e = 0; e < COUNT(temp_dir); e++) {

+ 1
- 1
Marlin/temperature.h Datei anzeigen

@@ -174,7 +174,7 @@ class Temperature {
174 174
       static millis_t next_bed_check_ms;
175 175
     #endif
176 176
 
177
-    static unsigned long raw_temp_value[4],
177
+    static unsigned long raw_temp_value[MAX_EXTRUDERS],
178 178
                          raw_temp_bed_value;
179 179
 
180 180
     // Init min and max temp with extreme values to prevent false errors during startup

+ 126
- 92
Marlin/ultralcd.cpp Datei anzeigen

@@ -919,31 +919,37 @@ void kill_screen(const char* lcd_msg) {
919 919
    * Watch temperature callbacks
920 920
    */
921 921
   #if WATCH_HOTENDS
922
-    #if TEMP_SENSOR_0 != 0
922
+    #if HAS_TEMP_HOTEND
923 923
       void watch_temp_callback_E0() { thermalManager.start_watching_heater(0); }
924
+      #if HOTENDS > 1
925
+        void watch_temp_callback_E1() { thermalManager.start_watching_heater(1); }
926
+        #if HOTENDS > 2
927
+          void watch_temp_callback_E2() { thermalManager.start_watching_heater(2); }
928
+          #if HOTENDS > 3
929
+            void watch_temp_callback_E3() { thermalManager.start_watching_heater(3); }
930
+            #if HOTENDS > 4
931
+              void watch_temp_callback_E4() { thermalManager.start_watching_heater(4); }
932
+            #endif // HOTENDS > 4
933
+          #endif // HOTENDS > 3
934
+        #endif // HOTENDS > 2
935
+      #endif // HOTENDS > 1
924 936
     #endif
925
-    #if HOTENDS > 1 && TEMP_SENSOR_1 != 0
926
-      void watch_temp_callback_E1() { thermalManager.start_watching_heater(1); }
927
-    #endif // HOTENDS > 1
928
-    #if HOTENDS > 2 && TEMP_SENSOR_2 != 0
929
-      void watch_temp_callback_E2() { thermalManager.start_watching_heater(2); }
930
-    #endif // HOTENDS > 2
931
-    #if HOTENDS > 3 && TEMP_SENSOR_3 != 0
932
-      void watch_temp_callback_E3() { thermalManager.start_watching_heater(3); }
933
-    #endif // HOTENDS > 3
934 937
   #else
935
-    #if TEMP_SENSOR_0 != 0
938
+    #if HAS_TEMP_HOTEND
936 939
       void watch_temp_callback_E0() {}
940
+      #if HOTENDS > 1
941
+        void watch_temp_callback_E1() {}
942
+        #if HOTENDS > 2
943
+          void watch_temp_callback_E2() {}
944
+          #if HOTENDS > 3
945
+            void watch_temp_callback_E3() {}
946
+            #if HOTENDS > 4
947
+              void watch_temp_callback_E4() {}
948
+            #endif // HOTENDS > 4
949
+          #endif // HOTENDS > 3
950
+        #endif // HOTENDS > 2
951
+      #endif // HOTENDS > 1
937 952
     #endif
938
-    #if HOTENDS > 1 && TEMP_SENSOR_1 != 0
939
-      void watch_temp_callback_E1() {}
940
-    #endif // HOTENDS > 1
941
-    #if HOTENDS > 2 && TEMP_SENSOR_2 != 0
942
-      void watch_temp_callback_E2() {}
943
-    #endif // HOTENDS > 2
944
-    #if HOTENDS > 3 && TEMP_SENSOR_3 != 0
945
-      void watch_temp_callback_E3() {}
946
-    #endif // HOTENDS > 3
947 953
   #endif
948 954
 
949 955
   #if WATCH_THE_BED
@@ -990,24 +996,17 @@ void kill_screen(const char* lcd_msg) {
990 996
     // Nozzle [1-4]:
991 997
     //
992 998
     #if HOTENDS == 1
993
-      #if TEMP_SENSOR_0 != 0
994
-        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
995
-      #endif
999
+      MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
996 1000
     #else //HOTENDS > 1
997
-      #if TEMP_SENSOR_0 != 0
998
-        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
999
-      #endif
1000
-      #if TEMP_SENSOR_1 != 0
1001
-        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1);
1002
-      #endif
1001
+      MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
1002
+      MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1);
1003 1003
       #if HOTENDS > 2
1004
-        #if TEMP_SENSOR_2 != 0
1005
-          MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2);
1006
-        #endif
1004
+        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2);
1007 1005
         #if HOTENDS > 3
1008
-          #if TEMP_SENSOR_3 != 0
1009
-            MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3);
1010
-          #endif
1006
+          MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3);
1007
+          #if HOTENDS > 4
1008
+            MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N5, &thermalManager.target_temperature[4], 0, HEATER_4_MAXTEMP - 15, watch_temp_callback_E4);
1009
+          #endif // HOTENDS > 4
1011 1010
         #endif // HOTENDS > 3
1012 1011
       #endif // HOTENDS > 2
1013 1012
     #endif // HOTENDS > 1
@@ -1041,10 +1040,7 @@ void kill_screen(const char* lcd_msg) {
1041 1040
 
1042 1041
     //
1043 1042
     // Flow:
1044
-    // Flow 1:
1045
-    // Flow 2:
1046
-    // Flow 3:
1047
-    // Flow 4:
1043
+    // Flow [1-5]:
1048 1044
     //
1049 1045
     #if EXTRUDERS == 1
1050 1046
       MENU_ITEM_EDIT(int3, MSG_FLOW, &flow_percentage[0], 10, 999);
@@ -1056,6 +1052,9 @@ void kill_screen(const char* lcd_msg) {
1056 1052
         MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N3, &flow_percentage[2], 10, 999);
1057 1053
         #if EXTRUDERS > 3
1058 1054
           MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N4, &flow_percentage[3], 10, 999);
1055
+          #if EXTRUDERS > 4
1056
+            MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N5, &flow_percentage[4], 10, 999);
1057
+          #endif //EXTRUDERS > 4
1059 1058
         #endif //EXTRUDERS > 3
1060 1059
       #endif //EXTRUDERS > 2
1061 1060
     #endif //EXTRUDERS > 1
@@ -1109,7 +1108,7 @@ void kill_screen(const char* lcd_msg) {
1109 1108
     }
1110 1109
   #endif
1111 1110
 
1112
-  constexpr int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP);
1111
+  constexpr int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP);
1113 1112
 
1114 1113
   /**
1115 1114
    *
@@ -1165,8 +1164,16 @@ void kill_screen(const char* lcd_msg) {
1165 1164
           void lcd_preheat_m1_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
1166 1165
           void lcd_preheat_m2_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
1167 1166
         #endif
1168
-      #endif
1169
-    #endif
1167
+        #if HOTENDS > 4
1168
+          void lcd_preheat_m1_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
1169
+          void lcd_preheat_m2_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
1170
+          #if TEMP_SENSOR_BED != 0
1171
+            void lcd_preheat_m1_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
1172
+            void lcd_preheat_m2_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
1173
+          #endif
1174
+        #endif // HOTENDS > 4
1175
+      #endif // HOTENDS > 3
1176
+    #endif // HOTENDS > 2
1170 1177
 
1171 1178
     void lcd_preheat_m1_all() {
1172 1179
       #if HOTENDS > 1
@@ -1175,9 +1182,12 @@ void kill_screen(const char* lcd_msg) {
1175 1182
           thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 2);
1176 1183
           #if HOTENDS > 3
1177 1184
             thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 3);
1178
-          #endif
1179
-        #endif
1180
-      #endif
1185
+            #if HOTENDS > 4
1186
+              thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 4);
1187
+            #endif // HOTENDS > 4
1188
+          #endif // HOTENDS > 3
1189
+        #endif // HOTENDS > 2
1190
+      #endif // HOTENDS > 1
1181 1191
       #if TEMP_SENSOR_BED != 0
1182 1192
         lcd_preheat_m1_e0();
1183 1193
       #else
@@ -1191,9 +1201,12 @@ void kill_screen(const char* lcd_msg) {
1191 1201
           thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 2);
1192 1202
           #if HOTENDS > 3
1193 1203
             thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 3);
1194
-          #endif
1195
-        #endif
1196
-      #endif
1204
+            #if HOTENDS > 4
1205
+              thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 4);
1206
+            #endif // HOTENDS > 4
1207
+          #endif // HOTENDS > 3
1208
+        #endif // HOTENDS > 2
1209
+      #endif // HOTENDS > 1
1197 1210
       #if TEMP_SENSOR_BED != 0
1198 1211
         lcd_preheat_m2_e0();
1199 1212
       #else
@@ -1244,10 +1257,18 @@ void kill_screen(const char* lcd_msg) {
1244 1257
             #else
1245 1258
               MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3_only);
1246 1259
             #endif
1247
-          #endif
1248
-        #endif
1260
+            #if HOTENDS > 4
1261
+              #if TEMP_SENSOR_BED != 0
1262
+                MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4);
1263
+                MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E5, lcd_preheat_m1_e4_only);
1264
+              #else
1265
+                MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4_only);
1266
+              #endif
1267
+            #endif // HOTENDS > 4
1268
+          #endif // HOTENDS > 3
1269
+        #endif // HOTENDS > 2
1249 1270
         MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_m1_all);
1250
-      #endif
1271
+      #endif // HOTENDS > 1
1251 1272
       #if TEMP_SENSOR_BED != 0
1252 1273
         MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_m1_bedonly);
1253 1274
       #endif
@@ -1288,10 +1309,18 @@ void kill_screen(const char* lcd_msg) {
1288 1309
             #else
1289 1310
               MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3_only);
1290 1311
             #endif
1291
-          #endif
1292
-        #endif
1312
+            #if HOTENDS > 4
1313
+              #if TEMP_SENSOR_BED != 0
1314
+                MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4);
1315
+                MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E5, lcd_preheat_m2_e4_only);
1316
+              #else
1317
+                MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4_only);
1318
+              #endif
1319
+            #endif // HOTENDS > 4
1320
+          #endif // HOTENDS > 3
1321
+        #endif // HOTENDS > 2
1293 1322
         MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_m2_all);
1294
-      #endif
1323
+      #endif // HOTENDS > 1
1295 1324
       #if TEMP_SENSOR_BED != 0
1296 1325
         MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_m2_bedonly);
1297 1326
       #endif
@@ -2104,16 +2133,16 @@ void kill_screen(const char* lcd_msg) {
2104 2133
       PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
2105 2134
       thermalManager.updatePID();
2106 2135
     }
2107
-    #define _PIDTEMP_BASE_FUNCTIONS(eindex) \
2108
-      void copy_and_scalePID_i_E ## eindex() { copy_and_scalePID_i(eindex); } \
2109
-      void copy_and_scalePID_d_E ## eindex() { copy_and_scalePID_d(eindex); }
2136
+    #define _PIDTEMP_BASE_FUNCTIONS(N) \
2137
+      void copy_and_scalePID_i_E ## N() { copy_and_scalePID_i(N); } \
2138
+      void copy_and_scalePID_d_E ## N() { copy_and_scalePID_d(N); }
2110 2139
 
2111 2140
     #if ENABLED(PID_AUTOTUNE_MENU)
2112
-      #define _PIDTEMP_FUNCTIONS(eindex) \
2113
-        _PIDTEMP_BASE_FUNCTIONS(eindex); \
2114
-        void lcd_autotune_callback_E ## eindex() { _lcd_autotune(eindex); }
2141
+      #define _PIDTEMP_FUNCTIONS(N) \
2142
+        _PIDTEMP_BASE_FUNCTIONS(N); \
2143
+        void lcd_autotune_callback_E ## N() { _lcd_autotune(N); }
2115 2144
     #else
2116
-      #define _PIDTEMP_FUNCTIONS(eindex) _PIDTEMP_BASE_FUNCTIONS(eindex)
2145
+      #define _PIDTEMP_FUNCTIONS(N) _PIDTEMP_BASE_FUNCTIONS(N)
2117 2146
     #endif
2118 2147
 
2119 2148
     _PIDTEMP_FUNCTIONS(0)
@@ -2124,12 +2153,15 @@ void kill_screen(const char* lcd_msg) {
2124 2153
           _PIDTEMP_FUNCTIONS(2)
2125 2154
           #if HOTENDS > 3
2126 2155
             _PIDTEMP_FUNCTIONS(3)
2127
-          #endif //HOTENDS > 3
2128
-        #endif //HOTENDS > 2
2129
-      #endif //HOTENDS > 1
2130
-    #endif //PID_PARAMS_PER_HOTEND
2156
+            #if HOTENDS > 4
2157
+              _PIDTEMP_FUNCTIONS(4)
2158
+            #endif // HOTENDS > 4
2159
+          #endif // HOTENDS > 3
2160
+        #endif // HOTENDS > 2
2161
+      #endif // HOTENDS > 1
2162
+    #endif // PID_PARAMS_PER_HOTEND
2131 2163
 
2132
-  #endif //PIDTEMP
2164
+  #endif // PIDTEMP
2133 2165
 
2134 2166
   /**
2135 2167
    *
@@ -2146,27 +2178,20 @@ void kill_screen(const char* lcd_msg) {
2146 2178
 
2147 2179
     //
2148 2180
     // Nozzle:
2149
-    // Nozzle [1-4]:
2181
+    // Nozzle [1-5]:
2150 2182
     //
2151 2183
     #if HOTENDS == 1
2152
-      #if TEMP_SENSOR_0 != 0
2153
-        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
2154
-      #endif
2155
-    #else //HOTENDS > 1
2156
-      #if TEMP_SENSOR_0 != 0
2157
-        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
2158
-      #endif
2159
-      #if TEMP_SENSOR_1 != 0
2160
-        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1);
2161
-      #endif
2184
+      MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
2185
+    #else // HOTENDS > 1
2186
+      MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
2187
+      MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1);
2162 2188
       #if HOTENDS > 2
2163
-        #if TEMP_SENSOR_2 != 0
2164
-          MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2);
2165
-        #endif
2189
+        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2);
2166 2190
         #if HOTENDS > 3
2167
-          #if TEMP_SENSOR_3 != 0
2168
-            MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3);
2169
-          #endif
2191
+          MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3);
2192
+          #if HOTENDS > 4
2193
+            MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N5, &thermalManager.target_temperature[4], 0, HEATER_4_MAXTEMP - 15, watch_temp_callback_E4);
2194
+          #endif // HOTENDS > 4
2170 2195
         #endif // HOTENDS > 3
2171 2196
       #endif // HOTENDS > 2
2172 2197
     #endif // HOTENDS > 1
@@ -2247,11 +2272,14 @@ void kill_screen(const char* lcd_msg) {
2247 2272
           PID_MENU_ITEMS(" " MSG_E3, 2);
2248 2273
           #if HOTENDS > 3
2249 2274
             PID_MENU_ITEMS(" " MSG_E4, 3);
2250
-          #endif //HOTENDS > 3
2251
-        #endif //HOTENDS > 2
2252
-      #else //!PID_PARAMS_PER_HOTEND || HOTENDS == 1
2275
+            #if HOTENDS > 4
2276
+              PID_MENU_ITEMS(" " MSG_E5, 4);
2277
+            #endif // HOTENDS > 4
2278
+          #endif // HOTENDS > 3
2279
+        #endif // HOTENDS > 2
2280
+      #else // !PID_PARAMS_PER_HOTEND || HOTENDS == 1
2253 2281
         PID_MENU_ITEMS("", 0);
2254
-      #endif //!PID_PARAMS_PER_HOTEND || HOTENDS == 1
2282
+      #endif // !PID_PARAMS_PER_HOTEND || HOTENDS == 1
2255 2283
 
2256 2284
     #endif //PIDTEMP
2257 2285
 
@@ -2268,7 +2296,10 @@ void kill_screen(const char* lcd_msg) {
2268 2296
   }
2269 2297
 
2270 2298
   void _lcd_control_temperature_preheat_settings_menu(uint8_t material) {
2271
-    #if HOTENDS > 3
2299
+    #if HOTENDS > 4
2300
+      #define MINTEMP_ALL MIN5(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP, HEATER_4_MINTEMP)
2301
+      #define MAXTEMP_ALL MAX5(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP)
2302
+    #elif HOTENDS > 3
2272 2303
       #define MINTEMP_ALL MIN4(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP)
2273 2304
       #define MAXTEMP_ALL MAX4(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP)
2274 2305
     #elif HOTENDS > 2
@@ -2455,16 +2486,19 @@ void kill_screen(const char* lcd_msg) {
2455 2486
     if (volumetric_enabled) {
2456 2487
       #if EXTRUDERS == 1
2457 2488
         MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM, &filament_size[0], 1.5, 3.25, calculate_volumetric_multipliers);
2458
-      #else //EXTRUDERS > 1
2489
+      #else // EXTRUDERS > 1
2459 2490
         MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E1, &filament_size[0], 1.5, 3.25, calculate_volumetric_multipliers);
2460 2491
         MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E2, &filament_size[1], 1.5, 3.25, calculate_volumetric_multipliers);
2461 2492
         #if EXTRUDERS > 2
2462 2493
           MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E3, &filament_size[2], 1.5, 3.25, calculate_volumetric_multipliers);
2463 2494
           #if EXTRUDERS > 3
2464 2495
             MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E4, &filament_size[3], 1.5, 3.25, calculate_volumetric_multipliers);
2465
-          #endif //EXTRUDERS > 3
2466
-        #endif //EXTRUDERS > 2
2467
-      #endif //EXTRUDERS > 1
2496
+            #if EXTRUDERS > 4
2497
+              MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E5, &filament_size[4], 1.5, 3.25, calculate_volumetric_multipliers);
2498
+            #endif // EXTRUDERS > 4
2499
+          #endif // EXTRUDERS > 3
2500
+        #endif // EXTRUDERS > 2
2501
+      #endif // EXTRUDERS > 1
2468 2502
     }
2469 2503
 
2470 2504
     END_MENU();

Laden…
Abbrechen
Speichern