diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 3efc2d433..ca056e418 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -10707,9 +10707,12 @@ void prepare_move_to_destination() { || E2_ENABLE_READ == E_ENABLE_ON #if E_STEPPERS > 3 || E3_ENABLE_READ == E_ENABLE_ON - #endif - #endif - #endif + #if E_STEPPERS > 4 + || E4_ENABLE_READ == E_ENABLE_ON + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #endif // E_STEPPERS > 1 ) { lastMotorOn = ms; //... set time to NOW so the fan will turn on } @@ -10930,6 +10933,7 @@ void enable_all_steppers() { enable_e1(); enable_e2(); enable_e3(); + enable_e4(); } void disable_e_steppers() { @@ -10937,6 +10941,7 @@ void disable_e_steppers() { disable_e1(); disable_e2(); disable_e3(); + disable_e4(); } void disable_all_steppers() { @@ -11135,9 +11140,15 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { oldstatus = E3_ENABLE_READ; enable_e3(); break; - #endif - #endif - #endif + #if E_STEPPERS > 4 + case 4: + oldstatus = E4_ENABLE_READ; + enable_e4(); + break; + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #endif // E_STEPPERS > 1 } #endif // !SWITCHING_EXTRUDER @@ -11168,9 +11179,14 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { case 3: E3_ENABLE_WRITE(oldstatus); break; - #endif - #endif - #endif + #if E_STEPPERS > 4 + case 4: + E4_ENABLE_WRITE(oldstatus); + break; + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #endif // E_STEPPERS > 1 } #endif // !SWITCHING_EXTRUDER } diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index c16666c48..ec8f9d1fb 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -36,7 +36,7 @@ * */ -#define EEPROM_VERSION "V31" +#define EEPROM_VERSION "V32" // Change EEPROM version if these are changed: #define EEPROM_OFFSET 100 @@ -44,45 +44,45 @@ /** * V31 EEPROM Layout: * - * 100 Version (char x4) - * 104 EEPROM Checksum (uint16_t) + * 100 Version (char x4) + * 104 EEPROM Checksum (uint16_t) * * 106 E_STEPPERS (uint8_t) - * 107 M92 XYZE planner.axis_steps_per_mm (float x4 ... x7) - * 123 M203 XYZE planner.max_feedrate_mm_s (float x4 ... x7) - * 139 M201 XYZE planner.max_acceleration_mm_per_s2 (uint32_t x4 ... x7) - * 155 M204 P planner.acceleration (float) - * 159 M204 R planner.retract_acceleration (float) - * 163 M204 T planner.travel_acceleration (float) - * 167 M205 S planner.min_feedrate_mm_s (float) + * 107 M92 XYZE planner.axis_steps_per_mm (float x4 ... x8) + * 123 M203 XYZE planner.max_feedrate_mm_s (float x4 ... x8) + * 139 M201 XYZE planner.max_acceleration_mm_per_s2 (uint32_t x4 ... x8) + * 155 M204 P planner.acceleration (float) + * 159 M204 R planner.retract_acceleration (float) + * 163 M204 T planner.travel_acceleration (float) + * 167 M205 S planner.min_feedrate_mm_s (float) * 171 M205 T planner.min_travel_feedrate_mm_s (float) - * 175 M205 B planner.min_segment_time (ulong) - * 179 M205 X planner.max_jerk[X_AXIS] (float) - * 183 M205 Y planner.max_jerk[Y_AXIS] (float) - * 187 M205 Z planner.max_jerk[Z_AXIS] (float) - * 191 M205 E planner.max_jerk[E_AXIS] (float) - * 195 M206 XYZ home_offset (float x3) - * 207 M218 XYZ hotend_offset (float x3 per additional hotend) + * 175 M205 B planner.min_segment_time (ulong) + * 179 M205 X planner.max_jerk[X_AXIS] (float) + * 183 M205 Y planner.max_jerk[Y_AXIS] (float) + * 187 M205 Z planner.max_jerk[Z_AXIS] (float) + * 191 M205 E planner.max_jerk[E_AXIS] (float) + * 195 M206 XYZ home_offset (float x3) + * 207 M218 XYZ hotend_offset (float x3 per additional hotend) * - * Mesh bed leveling: - * 219 M420 S from mbl.status (bool) - * 220 mbl.z_offset (float) - * 224 GRID_MAX_POINTS_X (uint8 as set in firmware) - * 225 GRID_MAX_POINTS_Y (uint8 as set in firmware) - * 226 G29 S3 XYZ z_values[][] (float x9, by default, up to float x 81) +288 + * Mesh bed leveling: 43 bytes + * 219 M420 S from mbl.status (bool) + * 220 mbl.z_offset (float) + * 224 GRID_MAX_POINTS_X (uint8_t) + * 225 GRID_MAX_POINTS_Y (uint8_t) + * 226 G29 S3 XYZ z_values[][] (float x9, up to float x 81) +288 * - * AUTO BED LEVELING - * 262 M851 zprobe_zoffset (float) + * AUTO BED LEVELING 4 bytes + * 262 M851 zprobe_zoffset (float) * - * ABL_PLANAR (or placeholder): 36 bytes - * 266 planner.bed_level_matrix (matrix_3x3 = float x9) + * ABL_PLANAR (or placeholder): 36 bytes + * 266 planner.bed_level_matrix (matrix_3x3 = float x9) * - * AUTO_BED_LEVELING_BILINEAR (or placeholder): 47 bytes - * 302 GRID_MAX_POINTS_X (uint8_t) - * 303 GRID_MAX_POINTS_Y (uint8_t) - * 304 bilinear_grid_spacing (int x2) from G29: (B-F)/X, (R-L)/Y - * 308 G29 L F bilinear_start (int x2) - * 312 bed_level_grid[][] (float x9, up to float x256) +988 + * AUTO_BED_LEVELING_BILINEAR (or placeholder): 47 bytes + * 302 GRID_MAX_POINTS_X (uint8_t) + * 303 GRID_MAX_POINTS_Y (uint8_t) + * 304 bilinear_grid_spacing (int x2) + * 308 G29 L F bilinear_start (int x2) + * 312 bed_level_grid[][] (float x9, up to float x256) +988 * * DELTA (if deltabot): 48 bytes * 348 M666 XYZ endstop_adj (float x3) @@ -96,56 +96,57 @@ * 388 M665 J delta_tower_angle_trim[B] (float) * 392 M665 K delta_tower_angle_trim[C] (float) * - * Z_DUAL_ENDSTOPS (if not deltabot): 48 bytes - * 348 M666 Z z_endstop_adj (float) - * --- dummy data (float x11) + * Z_DUAL_ENDSTOPS (if not deltabot): 48 bytes + * 348 M666 Z z_endstop_adj (float) + * --- dummy data (float x11) * - * ULTIPANEL: 6 bytes - * 396 M145 S0 H lcd_preheat_hotend_temp (int x2) - * 400 M145 S0 B lcd_preheat_bed_temp (int x2) - * 404 M145 S0 F lcd_preheat_fan_speed (int x2) + * ULTIPANEL: 6 bytes + * 396 M145 S0 H lcd_preheat_hotend_temp (int x2) + * 400 M145 S0 B lcd_preheat_bed_temp (int x2) + * 404 M145 S0 F lcd_preheat_fan_speed (int x2) * - * PIDTEMP: 66 bytes - * 408 M301 E0 PIDC Kp[0], Ki[0], Kd[0], Kc[0] (float x4) - * 424 M301 E1 PIDC Kp[1], Ki[1], Kd[1], Kc[1] (float x4) - * 440 M301 E2 PIDC Kp[2], Ki[2], Kd[2], Kc[2] (float x4) - * 456 M301 E3 PIDC Kp[3], Ki[3], Kd[3], Kc[3] (float x4) - * 472 M301 L lpq_len (int) + * PIDTEMP: 66 bytes + * 408 M301 E0 PIDC Kp[0], Ki[0], Kd[0], Kc[0] (float x4) + * 424 M301 E1 PIDC Kp[1], Ki[1], Kd[1], Kc[1] (float x4) + * 440 M301 E2 PIDC Kp[2], Ki[2], Kd[2], Kc[2] (float x4) + * 456 M301 E3 PIDC Kp[3], Ki[3], Kd[3], Kc[3] (float x4) + * 472 M301 E4 PIDC Kp[3], Ki[3], Kd[3], Kc[3] (float x4) + * 488 M301 L lpq_len (int) * * PIDTEMPBED: 12 bytes - * 474 M304 PID thermalManager.bedKp, .bedKi, .bedKd (float x3) + * 490 M304 PID thermalManager.bedKp, .bedKi, .bedKd (float x3) * * DOGLCD: 2 bytes - * 486 M250 C lcd_contrast (int) + * 502 M250 C lcd_contrast (int) * * FWRETRACT: 29 bytes - * 488 M209 S autoretract_enabled (bool) - * 489 M207 S retract_length (float) - * 493 M207 W retract_length_swap (float) - * 497 M207 F retract_feedrate_mm_s (float) - * 501 M207 Z retract_zlift (float) - * 505 M208 S retract_recover_length (float) - * 509 M208 W retract_recover_length_swap (float) - * 513 M208 F retract_recover_feedrate_mm_s (float) + * 504 M209 S autoretract_enabled (bool) + * 505 M207 S retract_length (float) + * 509 M207 W retract_length_swap (float) + * 513 M207 F retract_feedrate_mm_s (float) + * 517 M207 Z retract_zlift (float) + * 521 M208 S retract_recover_length (float) + * 525 M208 W retract_recover_length_swap (float) + * 529 M208 F retract_recover_feedrate_mm_s (float) * - * Volumetric Extrusion: 17 bytes - * 517 M200 D volumetric_enabled (bool) - * 518 M200 T D filament_size (float x4) (T0..3) + * Volumetric Extrusion: 21 bytes + * 533 M200 D volumetric_enabled (bool) + * 534 M200 T D filament_size (float x5) (T0..3) * * TMC2130 Stepper Current: 20 bytes - * 534 M906 X stepperX current (uint16_t) - * 536 M906 Y stepperY current (uint16_t) - * 538 M906 Z stepperZ current (uint16_t) - * 540 M906 X2 stepperX2 current (uint16_t) - * 542 M906 Y2 stepperY2 current (uint16_t) - * 544 M906 Z2 stepperZ2 current (uint16_t) - * 546 M906 E0 stepperE0 current (uint16_t) - * 548 M906 E1 stepperE1 current (uint16_t) - * 550 M906 E2 stepperE2 current (uint16_t) - * 552 M906 E3 stepperE3 current (uint16_t) + * 554 M906 X stepperX current (uint16_t) + * 556 M906 Y stepperY current (uint16_t) + * 558 M906 Z stepperZ current (uint16_t) + * 560 M906 X2 stepperX2 current (uint16_t) + * 562 M906 Y2 stepperY2 current (uint16_t) + * 564 M906 Z2 stepperZ2 current (uint16_t) + * 566 M906 E0 stepperE0 current (uint16_t) + * 568 M906 E1 stepperE1 current (uint16_t) + * 570 M906 E2 stepperE2 current (uint16_t) + * 572 M906 E3 stepperE3 current (uint16_t) * - * 554 Minimum end-point - * 1875 (554 + 36 + 9 + 288 + 988) Maximum end-point + * 574 Minimum end-point + * 1895 (574 + 36 + 9 + 288 + 988) Maximum end-point * */ #include "Marlin.h" @@ -1433,9 +1434,14 @@ void Config_ResetDefault() { CONFIG_ECHO_START; SERIAL_ECHOPAIR(" M200 T3 D", filament_size[3]); SERIAL_EOL; - #endif - #endif - #endif + #if EXTRUDERS > 4 + CONFIG_ECHO_START; + SERIAL_ECHOPAIR(" M200 T4 D", filament_size[4]); + SERIAL_EOL; + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 + #endif // EXTRUDERS > 1 if (!volumetric_enabled) { CONFIG_ECHO_START; diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 4bf9ec5d6..22da7a3de 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -882,9 +882,12 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const if (g_uc_extruder_last_move[2] == 0) disable_e2(); #if EXTRUDERS > 3 if (g_uc_extruder_last_move[3] == 0) disable_e3(); - #endif - #endif - #endif + #if EXTRUDERS > 4 + if (g_uc_extruder_last_move[4] == 0) disable_e4(); + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 + #endif // EXTRUDERS > 1 break; #if EXTRUDERS > 1 case 1: @@ -895,8 +898,11 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const if (g_uc_extruder_last_move[2] == 0) disable_e2(); #if EXTRUDERS > 3 if (g_uc_extruder_last_move[3] == 0) disable_e3(); - #endif - #endif + #if EXTRUDERS > 4 + if (g_uc_extruder_last_move[4] == 0) disable_e4(); + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 break; #if EXTRUDERS > 2 case 2: @@ -906,6 +912,9 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const if (g_uc_extruder_last_move[1] == 0) disable_e1(); #if EXTRUDERS > 3 if (g_uc_extruder_last_move[3] == 0) disable_e3(); + #if EXTRUDERS > 4 + if (g_uc_extruder_last_move[4] == 0) disable_e4(); + #endif #endif break; #if EXTRUDERS > 3 @@ -915,7 +924,20 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const if (g_uc_extruder_last_move[0] == 0) disable_e0(); if (g_uc_extruder_last_move[1] == 0) disable_e1(); if (g_uc_extruder_last_move[2] == 0) disable_e2(); + #if EXTRUDERS > 4 + if (g_uc_extruder_last_move[4] == 0) disable_e4(); + #endif break; + #if EXTRUDERS > 4 + case 4: + enable_e4(); + g_uc_extruder_last_move[4] = (BLOCK_BUFFER_SIZE) * 2; + if (g_uc_extruder_last_move[0] == 0) disable_e0(); + if (g_uc_extruder_last_move[1] == 0) disable_e1(); + if (g_uc_extruder_last_move[2] == 0) disable_e2(); + if (g_uc_extruder_last_move[3] == 0) disable_e3(); + break; + #endif // EXTRUDERS > 4 #endif // EXTRUDERS > 3 #endif // EXTRUDERS > 2 #endif // EXTRUDERS > 1 @@ -925,6 +947,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const enable_e1(); enable_e2(); enable_e3(); + enable_e4(); #endif } diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 5a37c7750..909231fc0 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -51,8 +51,8 @@ static void* heater_ttbl_map[2] = {(void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE }; static uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN }; #else - 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); - 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); + 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); + 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); #endif Temperature thermalManager; @@ -161,8 +161,8 @@ unsigned long Temperature::raw_temp_value[MAX_EXTRUDERS] = { 0 }; unsigned long Temperature::raw_temp_bed_value = 0; // Init min and max temp with extreme values to prevent false errors during startup -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), - 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), +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), + 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), Temperature::minttemp[HOTENDS] = { 0 }, Temperature::maxttemp[HOTENDS] = ARRAY_BY_HOTENDS1(16383); @@ -460,12 +460,13 @@ int Temperature::getHeaterPower(int heater) { #if HAS_AUTO_FAN void Temperature::checkExtruderAutoFans() { - const int8_t fanPin[] = { E0_AUTO_FAN_PIN, E1_AUTO_FAN_PIN, E2_AUTO_FAN_PIN, E3_AUTO_FAN_PIN }; - const int fanBit[] = { + constexpr int8_t fanPin[] = { E0_AUTO_FAN_PIN, E1_AUTO_FAN_PIN, E2_AUTO_FAN_PIN, E3_AUTO_FAN_PIN, E4_AUTO_FAN_PIN }; + constexpr int fanBit[] = { 0, AUTO_1_IS_0 ? 0 : 1, AUTO_2_IS_0 ? 0 : AUTO_2_IS_1 ? 1 : 2, - AUTO_3_IS_0 ? 0 : AUTO_3_IS_1 ? 1 : AUTO_3_IS_2 ? 2 : 3 + AUTO_3_IS_0 ? 0 : AUTO_3_IS_1 ? 1 : AUTO_3_IS_2 ? 2 : 3, + AUTO_4_IS_0 ? 0 : AUTO_4_IS_1 ? 1 : AUTO_4_IS_2 ? 2 : AUTO_4_IS_3 ? 3 : 4 }; uint8_t fanState = 0; @@ -973,6 +974,9 @@ void Temperature::init() { #if HAS_HEATER_3 SET_OUTPUT(HEATER_3_PIN); #endif + #if HAS_HEATER_4 + SET_OUTPUT(HEATER_3_PIN); + #endif #if HAS_HEATER_BED SET_OUTPUT(HEATER_BED_PIN); #endif @@ -1033,6 +1037,9 @@ void Temperature::init() { #if HAS_TEMP_3 ANALOG_SELECT(TEMP_3_PIN); #endif + #if HAS_TEMP_4 + ANALOG_SELECT(TEMP_4_PIN); + #endif #if HAS_TEMP_BED ANALOG_SELECT(TEMP_BED_PIN); #endif @@ -1080,6 +1087,16 @@ void Temperature::init() { SET_OUTPUT(E3_AUTO_FAN_PIN); #endif #endif + #if HAS_AUTO_FAN_4 && !AUTO_4_IS_0 && !AUTO_4_IS_1 && !AUTO_4_IS_2 && !AUTO_4_IS_3 + #if E4_AUTO_FAN_PIN == FAN1_PIN + SET_OUTPUT(E4_AUTO_FAN_PIN); + #if ENABLED(FAST_PWM_FAN) + setPwmFrequency(E4_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 + #endif + #else + SET_OUTPUT(E4_AUTO_FAN_PIN); + #endif + #endif // Use timer0 for temperature measurement // Interleave temperature interrupt with millies interrupt @@ -1133,6 +1150,14 @@ void Temperature::init() { #ifdef HEATER_3_MAXTEMP TEMP_MAX_ROUTINE(3); #endif + #if HOTENDS > 4 + #ifdef HEATER_4_MINTEMP + TEMP_MIN_ROUTINE(4); + #endif + #ifdef HEATER_4_MAXTEMP + TEMP_MAX_ROUTINE(4); + #endif + #endif // HOTENDS > 4 #endif // HOTENDS > 3 #endif // HOTENDS > 2 #endif // HOTENDS > 1 @@ -1264,18 +1289,18 @@ void Temperature::disable_all_heaters() { #if HAS_TEMP_HOTEND DISABLE_HEATER(0); - #endif - - #if HOTENDS > 1 && HAS_TEMP_1 - DISABLE_HEATER(1); - #endif - - #if HOTENDS > 2 && HAS_TEMP_2 - DISABLE_HEATER(2); - #endif - - #if HOTENDS > 3 && HAS_TEMP_3 - DISABLE_HEATER(3); + #if HOTENDS > 1 + DISABLE_HEATER(1); + #if HOTENDS > 2 + DISABLE_HEATER(2); + #if HOTENDS > 3 + DISABLE_HEATER(3); + #if HOTENDS > 4 + DISABLE_HEATER(4); + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 #endif #if HAS_TEMP_BED @@ -1384,6 +1409,9 @@ void Temperature::set_current_temp_raw() { current_temperature_raw[2] = raw_temp_value[2]; #if HAS_TEMP_3 current_temperature_raw[3] = raw_temp_value[3]; + #if HAS_TEMP_4 + current_temperature_raw[4] = raw_temp_value[4]; + #endif #endif #endif #endif @@ -1525,9 +1553,12 @@ void Temperature::isr() { ISR_STATICS(2); #if HOTENDS > 3 ISR_STATICS(3); - #endif - #endif - #endif + #if HOTENDS > 4 + ISR_STATICS(4); + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 #if HAS_HEATER_BED ISR_STATICS(BED); #endif @@ -1561,9 +1592,13 @@ void Temperature::isr() { #if HOTENDS > 3 soft_pwm_3 = (soft_pwm_3 & pwm_mask) + soft_pwm[3]; WRITE_HEATER_3(soft_pwm_3 > pwm_mask ? HIGH : LOW); - #endif - #endif - #endif + #if HOTENDS > 4 + soft_pwm_4 = (soft_pwm_4 & pwm_mask) + soft_pwm[4]; + WRITE_HEATER_4(soft_pwm_4 > pwm_mask ? HIGH : LOW); + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 #if HAS_HEATER_BED soft_pwm_BED = (soft_pwm_BED & pwm_mask) + soft_pwm_bed; @@ -1589,13 +1624,16 @@ void Temperature::isr() { if (soft_pwm_0 <= pwm_count_tmp) WRITE_HEATER_0(0); #if HOTENDS > 1 if (soft_pwm_1 <= pwm_count_tmp) WRITE_HEATER_1(0); - #endif - #if HOTENDS > 2 - if (soft_pwm_2 <= pwm_count_tmp) WRITE_HEATER_2(0); - #endif - #if HOTENDS > 3 - if (soft_pwm_3 <= pwm_count_tmp) WRITE_HEATER_3(0); - #endif + #if HOTENDS > 2 + if (soft_pwm_2 <= pwm_count_tmp) WRITE_HEATER_2(0); + #if HOTENDS > 3 + if (soft_pwm_3 <= pwm_count_tmp) WRITE_HEATER_3(0); + #if HOTENDS > 4 + if (soft_pwm_4 <= pwm_count_tmp) WRITE_HEATER_4(0); + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 #if HAS_HEATER_BED if (soft_pwm_BED <= pwm_count_tmp) WRITE_HEATER_BED(0); @@ -1665,32 +1703,38 @@ void Temperature::isr() { if (slow_pwm_count == 0) { - SLOW_PWM_ROUTINE(0); // EXTRUDER 0 + SLOW_PWM_ROUTINE(0); #if HOTENDS > 1 - SLOW_PWM_ROUTINE(1); // EXTRUDER 1 + SLOW_PWM_ROUTINE(1); #if HOTENDS > 2 - SLOW_PWM_ROUTINE(2); // EXTRUDER 2 + SLOW_PWM_ROUTINE(2); #if HOTENDS > 3 - SLOW_PWM_ROUTINE(3); // EXTRUDER 3 - #endif - #endif - #endif + SLOW_PWM_ROUTINE(3); + #if HOTENDS > 4 + SLOW_PWM_ROUTINE(4); + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 #if HAS_HEATER_BED _SLOW_PWM_ROUTINE(BED, soft_pwm_bed); // BED #endif } // slow_pwm_count == 0 - PWM_OFF_ROUTINE(0); // EXTRUDER 0 + PWM_OFF_ROUTINE(0); #if HOTENDS > 1 - PWM_OFF_ROUTINE(1); // EXTRUDER 1 + PWM_OFF_ROUTINE(1); #if HOTENDS > 2 - PWM_OFF_ROUTINE(2); // EXTRUDER 2 + PWM_OFF_ROUTINE(2); #if HOTENDS > 3 - PWM_OFF_ROUTINE(3); // EXTRUDER 3 - #endif - #endif - #endif + PWM_OFF_ROUTINE(3); + #if HOTENDS > 4 + PWM_OFF_ROUTINE(4); + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 #if HAS_HEATER_BED PWM_OFF_ROUTINE(BED); // BED #endif @@ -1738,17 +1782,19 @@ void Temperature::isr() { slow_pwm_count++; slow_pwm_count &= 0x7F; - // EXTRUDER 0 if (state_timer_heater_0 > 0) state_timer_heater_0--; - #if HOTENDS > 1 // EXTRUDER 1 + #if HOTENDS > 1 if (state_timer_heater_1 > 0) state_timer_heater_1--; - #if HOTENDS > 2 // EXTRUDER 2 + #if HOTENDS > 2 if (state_timer_heater_2 > 0) state_timer_heater_2--; - #if HOTENDS > 3 // EXTRUDER 3 + #if HOTENDS > 3 if (state_timer_heater_3 > 0) state_timer_heater_3--; - #endif - #endif - #endif + #if HOTENDS > 4 + if (state_timer_heater_4 > 0) state_timer_heater_4--; + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 #if HAS_HEATER_BED if (state_timer_heater_BED > 0) state_timer_heater_BED--; #endif @@ -1763,7 +1809,7 @@ void Temperature::isr() { #define START_ADC(pin) ADCSRB = 0; SET_ADMUX_ADCSRA(pin) #endif - // Prepare or measure a sensor, each one every 12th frame + // Prepare or measure a sensor, each one every 14th frame switch (temp_state) { case PrepareTemp_0: #if HAS_TEMP_0 @@ -1832,6 +1878,20 @@ void Temperature::isr() { #if HAS_TEMP_3 raw_temp_value[3] += ADC; #endif + temp_state = PrepareTemp_4; + break; + + case PrepareTemp_4: + #if HAS_TEMP_4 + START_ADC(TEMP_4_PIN); + #endif + lcd_buttons_update(); + temp_state = MeasureTemp_4; + break; + case MeasureTemp_4: + #if HAS_TEMP_4 + raw_temp_value[4] += ADC; + #endif temp_state = Prepare_FILWIDTH; break; @@ -1879,35 +1939,26 @@ void Temperature::isr() { ZERO(raw_temp_value); raw_temp_bed_value = 0; + #define TEMPDIR(N) ((HEATER_##N##_RAW_LO_TEMP) > (HEATER_##N##_RAW_HI_TEMP) ? -1 : 1) + int constexpr temp_dir[] = { #if ENABLED(HEATER_0_USES_MAX6675) 0 - #elif HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP - -1 #else - 1 - #endif - #if HAS_TEMP_1 && HOTENDS > 1 - #if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP - , -1 - #else - , 1 - #endif - #endif - #if HAS_TEMP_2 && HOTENDS > 2 - #if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP - , -1 - #else - , 1 - #endif - #endif - #if HAS_TEMP_3 && HOTENDS > 3 - #if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP - , -1 - #else - , 1 - #endif + TEMPDIR(0) #endif + #if HOTENDS > 1 + , TEMPDIR(1) + #if HOTENDS > 2 + , TEMPDIR(2) + #if HOTENDS > 3 + , TEMPDIR(3) + #if HOTENDS > 4 + , TEMPDIR(4) + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 }; for (uint8_t e = 0; e < COUNT(temp_dir); e++) { diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 09cf44bd2..4e7e2a83e 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -174,7 +174,7 @@ class Temperature { static millis_t next_bed_check_ms; #endif - static unsigned long raw_temp_value[4], + static unsigned long raw_temp_value[MAX_EXTRUDERS], raw_temp_bed_value; // Init min and max temp with extreme values to prevent false errors during startup diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 96dc01909..ad37d2e0d 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -919,31 +919,37 @@ void kill_screen(const char* lcd_msg) { * Watch temperature callbacks */ #if WATCH_HOTENDS - #if TEMP_SENSOR_0 != 0 + #if HAS_TEMP_HOTEND void watch_temp_callback_E0() { thermalManager.start_watching_heater(0); } + #if HOTENDS > 1 + void watch_temp_callback_E1() { thermalManager.start_watching_heater(1); } + #if HOTENDS > 2 + void watch_temp_callback_E2() { thermalManager.start_watching_heater(2); } + #if HOTENDS > 3 + void watch_temp_callback_E3() { thermalManager.start_watching_heater(3); } + #if HOTENDS > 4 + void watch_temp_callback_E4() { thermalManager.start_watching_heater(4); } + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 #endif - #if HOTENDS > 1 && TEMP_SENSOR_1 != 0 - void watch_temp_callback_E1() { thermalManager.start_watching_heater(1); } - #endif // HOTENDS > 1 - #if HOTENDS > 2 && TEMP_SENSOR_2 != 0 - void watch_temp_callback_E2() { thermalManager.start_watching_heater(2); } - #endif // HOTENDS > 2 - #if HOTENDS > 3 && TEMP_SENSOR_3 != 0 - void watch_temp_callback_E3() { thermalManager.start_watching_heater(3); } - #endif // HOTENDS > 3 #else - #if TEMP_SENSOR_0 != 0 + #if HAS_TEMP_HOTEND void watch_temp_callback_E0() {} + #if HOTENDS > 1 + void watch_temp_callback_E1() {} + #if HOTENDS > 2 + void watch_temp_callback_E2() {} + #if HOTENDS > 3 + void watch_temp_callback_E3() {} + #if HOTENDS > 4 + void watch_temp_callback_E4() {} + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 #endif - #if HOTENDS > 1 && TEMP_SENSOR_1 != 0 - void watch_temp_callback_E1() {} - #endif // HOTENDS > 1 - #if HOTENDS > 2 && TEMP_SENSOR_2 != 0 - void watch_temp_callback_E2() {} - #endif // HOTENDS > 2 - #if HOTENDS > 3 && TEMP_SENSOR_3 != 0 - void watch_temp_callback_E3() {} - #endif // HOTENDS > 3 #endif #if WATCH_THE_BED @@ -990,24 +996,17 @@ void kill_screen(const char* lcd_msg) { // Nozzle [1-4]: // #if HOTENDS == 1 - #if TEMP_SENSOR_0 != 0 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); - #endif + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); #else //HOTENDS > 1 - #if TEMP_SENSOR_0 != 0 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); - #endif - #if TEMP_SENSOR_1 != 0 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1); - #endif + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1); #if HOTENDS > 2 - #if TEMP_SENSOR_2 != 0 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2); - #endif + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2); #if HOTENDS > 3 - #if TEMP_SENSOR_3 != 0 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3); - #endif + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3); + #if HOTENDS > 4 + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N5, &thermalManager.target_temperature[4], 0, HEATER_4_MAXTEMP - 15, watch_temp_callback_E4); + #endif // HOTENDS > 4 #endif // HOTENDS > 3 #endif // HOTENDS > 2 #endif // HOTENDS > 1 @@ -1041,10 +1040,7 @@ void kill_screen(const char* lcd_msg) { // // Flow: - // Flow 1: - // Flow 2: - // Flow 3: - // Flow 4: + // Flow [1-5]: // #if EXTRUDERS == 1 MENU_ITEM_EDIT(int3, MSG_FLOW, &flow_percentage[0], 10, 999); @@ -1056,6 +1052,9 @@ void kill_screen(const char* lcd_msg) { MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N3, &flow_percentage[2], 10, 999); #if EXTRUDERS > 3 MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N4, &flow_percentage[3], 10, 999); + #if EXTRUDERS > 4 + MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N5, &flow_percentage[4], 10, 999); + #endif //EXTRUDERS > 4 #endif //EXTRUDERS > 3 #endif //EXTRUDERS > 2 #endif //EXTRUDERS > 1 @@ -1109,7 +1108,7 @@ void kill_screen(const char* lcd_msg) { } #endif - constexpr int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP); + constexpr int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP); /** * @@ -1165,8 +1164,16 @@ void kill_screen(const char* lcd_msg) { void lcd_preheat_m1_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } void lcd_preheat_m2_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } #endif - #endif - #endif + #if HOTENDS > 4 + void lcd_preheat_m1_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); } + void lcd_preheat_m2_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); } + #if TEMP_SENSOR_BED != 0 + void lcd_preheat_m1_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } + void lcd_preheat_m2_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } + #endif + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 void lcd_preheat_m1_all() { #if HOTENDS > 1 @@ -1175,9 +1182,12 @@ void kill_screen(const char* lcd_msg) { thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 2); #if HOTENDS > 3 thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 3); - #endif - #endif - #endif + #if HOTENDS > 4 + thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 4); + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 #if TEMP_SENSOR_BED != 0 lcd_preheat_m1_e0(); #else @@ -1191,9 +1201,12 @@ void kill_screen(const char* lcd_msg) { thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 2); #if HOTENDS > 3 thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 3); - #endif - #endif - #endif + #if HOTENDS > 4 + thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 4); + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 #if TEMP_SENSOR_BED != 0 lcd_preheat_m2_e0(); #else @@ -1244,10 +1257,18 @@ void kill_screen(const char* lcd_msg) { #else MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3_only); #endif - #endif - #endif + #if HOTENDS > 4 + #if TEMP_SENSOR_BED != 0 + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4); + MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E5, lcd_preheat_m1_e4_only); + #else + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4_only); + #endif + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_m1_all); - #endif + #endif // HOTENDS > 1 #if TEMP_SENSOR_BED != 0 MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_m1_bedonly); #endif @@ -1288,10 +1309,18 @@ void kill_screen(const char* lcd_msg) { #else MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3_only); #endif - #endif - #endif + #if HOTENDS > 4 + #if TEMP_SENSOR_BED != 0 + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4); + MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E5, lcd_preheat_m2_e4_only); + #else + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4_only); + #endif + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_m2_all); - #endif + #endif // HOTENDS > 1 #if TEMP_SENSOR_BED != 0 MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_m2_bedonly); #endif @@ -2104,16 +2133,16 @@ void kill_screen(const char* lcd_msg) { PID_PARAM(Kd, e) = scalePID_d(raw_Kd); thermalManager.updatePID(); } - #define _PIDTEMP_BASE_FUNCTIONS(eindex) \ - void copy_and_scalePID_i_E ## eindex() { copy_and_scalePID_i(eindex); } \ - void copy_and_scalePID_d_E ## eindex() { copy_and_scalePID_d(eindex); } + #define _PIDTEMP_BASE_FUNCTIONS(N) \ + void copy_and_scalePID_i_E ## N() { copy_and_scalePID_i(N); } \ + void copy_and_scalePID_d_E ## N() { copy_and_scalePID_d(N); } #if ENABLED(PID_AUTOTUNE_MENU) - #define _PIDTEMP_FUNCTIONS(eindex) \ - _PIDTEMP_BASE_FUNCTIONS(eindex); \ - void lcd_autotune_callback_E ## eindex() { _lcd_autotune(eindex); } + #define _PIDTEMP_FUNCTIONS(N) \ + _PIDTEMP_BASE_FUNCTIONS(N); \ + void lcd_autotune_callback_E ## N() { _lcd_autotune(N); } #else - #define _PIDTEMP_FUNCTIONS(eindex) _PIDTEMP_BASE_FUNCTIONS(eindex) + #define _PIDTEMP_FUNCTIONS(N) _PIDTEMP_BASE_FUNCTIONS(N) #endif _PIDTEMP_FUNCTIONS(0) @@ -2124,12 +2153,15 @@ void kill_screen(const char* lcd_msg) { _PIDTEMP_FUNCTIONS(2) #if HOTENDS > 3 _PIDTEMP_FUNCTIONS(3) - #endif //HOTENDS > 3 - #endif //HOTENDS > 2 - #endif //HOTENDS > 1 - #endif //PID_PARAMS_PER_HOTEND + #if HOTENDS > 4 + _PIDTEMP_FUNCTIONS(4) + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 + #endif // PID_PARAMS_PER_HOTEND - #endif //PIDTEMP + #endif // PIDTEMP /** * @@ -2146,27 +2178,20 @@ void kill_screen(const char* lcd_msg) { // // Nozzle: - // Nozzle [1-4]: + // Nozzle [1-5]: // #if HOTENDS == 1 - #if TEMP_SENSOR_0 != 0 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); - #endif - #else //HOTENDS > 1 - #if TEMP_SENSOR_0 != 0 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); - #endif - #if TEMP_SENSOR_1 != 0 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1); - #endif + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); + #else // HOTENDS > 1 + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1); #if HOTENDS > 2 - #if TEMP_SENSOR_2 != 0 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2); - #endif + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2); #if HOTENDS > 3 - #if TEMP_SENSOR_3 != 0 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3); - #endif + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3); + #if HOTENDS > 4 + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N5, &thermalManager.target_temperature[4], 0, HEATER_4_MAXTEMP - 15, watch_temp_callback_E4); + #endif // HOTENDS > 4 #endif // HOTENDS > 3 #endif // HOTENDS > 2 #endif // HOTENDS > 1 @@ -2247,11 +2272,14 @@ void kill_screen(const char* lcd_msg) { PID_MENU_ITEMS(" " MSG_E3, 2); #if HOTENDS > 3 PID_MENU_ITEMS(" " MSG_E4, 3); - #endif //HOTENDS > 3 - #endif //HOTENDS > 2 - #else //!PID_PARAMS_PER_HOTEND || HOTENDS == 1 + #if HOTENDS > 4 + PID_MENU_ITEMS(" " MSG_E5, 4); + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #else // !PID_PARAMS_PER_HOTEND || HOTENDS == 1 PID_MENU_ITEMS("", 0); - #endif //!PID_PARAMS_PER_HOTEND || HOTENDS == 1 + #endif // !PID_PARAMS_PER_HOTEND || HOTENDS == 1 #endif //PIDTEMP @@ -2268,7 +2296,10 @@ void kill_screen(const char* lcd_msg) { } void _lcd_control_temperature_preheat_settings_menu(uint8_t material) { - #if HOTENDS > 3 + #if HOTENDS > 4 + #define MINTEMP_ALL MIN5(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP, HEATER_4_MINTEMP) + #define MAXTEMP_ALL MAX5(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP) + #elif HOTENDS > 3 #define MINTEMP_ALL MIN4(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP) #define MAXTEMP_ALL MAX4(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP) #elif HOTENDS > 2 @@ -2455,16 +2486,19 @@ void kill_screen(const char* lcd_msg) { if (volumetric_enabled) { #if EXTRUDERS == 1 MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM, &filament_size[0], 1.5, 3.25, calculate_volumetric_multipliers); - #else //EXTRUDERS > 1 + #else // EXTRUDERS > 1 MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E1, &filament_size[0], 1.5, 3.25, calculate_volumetric_multipliers); MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E2, &filament_size[1], 1.5, 3.25, calculate_volumetric_multipliers); #if EXTRUDERS > 2 MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E3, &filament_size[2], 1.5, 3.25, calculate_volumetric_multipliers); #if EXTRUDERS > 3 MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E4, &filament_size[3], 1.5, 3.25, calculate_volumetric_multipliers); - #endif //EXTRUDERS > 3 - #endif //EXTRUDERS > 2 - #endif //EXTRUDERS > 1 + #if EXTRUDERS > 4 + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E5, &filament_size[4], 1.5, 3.25, calculate_volumetric_multipliers); + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 + #endif // EXTRUDERS > 1 } END_MENU();