Merge pull request #3895 from thinkyhead/rc_singlenozzle_part_2

SINGLENOZZLE: EXTRUDERS versus HOTENDS
master
Scott Lahteine 9 years ago
commit 43947072d5

@ -535,6 +535,21 @@
#define HAS_PID_HEATING (ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED))
#define HAS_PID_FOR_BOTH (ENABLED(PIDTEMP) && ENABLED(PIDTEMPBED))
/**
* SINGLENOZZLE needs to differentiate EXTRUDERS and HOTENDS
* And all "extruders" are in the same place.
*/
#if ENABLED(SINGLENOZZLE)
#define HOTENDS 1
#undef TEMP_SENSOR_1_AS_REDUNDANT
#undef HOTEND_OFFSET_X
#undef HOTEND_OFFSET_Y
#define HOTEND_OFFSET_X { 0 }
#define HOTEND_OFFSET_Y { 0 }
#else
#define HOTENDS EXTRUDERS
#endif
/**
* ARRAY_BY_EXTRUDERS based on EXTRUDERS
*/
@ -551,15 +566,20 @@
#define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1)
/**
* With SINGLENOZZLE all "extruders" are in the same place
* ARRAY_BY_HOTENDS based on HOTENDS
*/
#if ENABLED(SINGLENOZZLE)
#undef EXTRUDER_OFFSET_X
#undef EXTRUDER_OFFSET_Y
#define EXTRUDER_OFFSET_X { 0 }
#define EXTRUDER_OFFSET_Y { 0 }
#if HOTENDS > 3
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2, v3, v4 }
#elif HOTENDS > 2
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2, v3 }
#elif HOTENDS > 1
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2 }
#else
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1 }
#endif
#define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1)
/**
* Z_DUAL_ENDSTOPS endstop reassignment
*/
@ -695,11 +715,11 @@
* Helper Macros for heaters and extruder fan
*/
#define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, v)
#if EXTRUDERS > 1 || ENABLED(HEATERS_PARALLEL)
#if HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)
#define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, v)
#if EXTRUDERS > 2
#if HOTENDS > 2
#define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, v)
#if EXTRUDERS > 3
#if HOTENDS > 3
#define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, v)
#endif
#endif

@ -126,8 +126,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -224,7 +224,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -241,7 +241,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -237,7 +237,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -356,16 +356,16 @@ static uint8_t target_extruder;
#endif
// Extruder offsets
#if EXTRUDERS > 1
#ifndef EXTRUDER_OFFSET_X
#define EXTRUDER_OFFSET_X { 0 } // X offsets for each extruder
#if HOTENDS > 1
#ifndef HOTEND_OFFSET_X
#define HOTEND_OFFSET_X { 0 } // X offsets for each extruder
#endif
#ifndef EXTRUDER_OFFSET_Y
#define EXTRUDER_OFFSET_Y { 0 } // Y offsets for each extruder
#ifndef HOTEND_OFFSET_Y
#define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder
#endif
float extruder_offset[][EXTRUDERS] = {
EXTRUDER_OFFSET_X,
EXTRUDER_OFFSET_Y
float hotend_offset[][HOTENDS] = {
HOTEND_OFFSET_X,
HOTEND_OFFSET_Y
#if ENABLED(DUAL_X_CARRIAGE)
, { 0 } // Z offsets for each extruder
#endif
@ -1249,7 +1249,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
* This allow soft recalibration of the second extruder offset position
* without firmware reflash (through the M218 command).
*/
return (extruder_offset[X_AXIS][1] > 0) ? extruder_offset[X_AXIS][1] : X2_HOME_POS;
return (hotend_offset[X_AXIS][1] > 0) ? hotend_offset[X_AXIS][1] : X2_HOME_POS;
}
static int x_home_dir(int extruder) {
@ -1280,7 +1280,7 @@ static void update_software_endstops(AxisEnum axis) {
#if ENABLED(DUAL_X_CARRIAGE)
if (axis == X_AXIS) {
float dual_max_x = max(extruder_offset[X_AXIS][1], X2_MAX_POS);
float dual_max_x = max(hotend_offset[X_AXIS][1], X2_MAX_POS);
if (active_extruder != 0) {
sw_endstop_min[X_AXIS] = X2_MIN_POS + offs;
sw_endstop_max[X_AXIS] = dual_max_x + offs;
@ -4400,6 +4400,10 @@ inline void gcode_M104() {
if (get_target_extruder_from_command(104)) return;
if (DEBUGGING(DRYRUN)) return;
#if ENABLED(SINGLENOZZLE)
if (target_extruder != active_extruder) return;
#endif
if (code_seen('S')) {
float temp = code_value();
thermalManager.setTargetHotend(temp, target_extruder);
@ -4445,8 +4449,8 @@ inline void gcode_M104() {
SERIAL_PROTOCOLPGM(" /");
SERIAL_PROTOCOL_F(thermalManager.degTargetBed(), 1);
#endif
#if EXTRUDERS > 1
for (int8_t e = 0; e < EXTRUDERS; ++e) {
#if HOTENDS > 1
for (int8_t e = 0; e < HOTENDS; ++e) {
SERIAL_PROTOCOLPGM(" T");
SERIAL_PROTOCOL(e);
SERIAL_PROTOCOLCHAR(':');
@ -4471,8 +4475,8 @@ inline void gcode_M104() {
#else
SERIAL_PROTOCOL(thermalManager.getHeaterPower(target_extruder));
#endif
#if EXTRUDERS > 1
for (int8_t e = 0; e < EXTRUDERS; ++e) {
#if HOTENDS > 1
for (int8_t e = 0; e < HOTENDS; ++e) {
SERIAL_PROTOCOLPGM(" @");
SERIAL_PROTOCOL(e);
SERIAL_PROTOCOLCHAR(':');
@ -4491,13 +4495,13 @@ inline void gcode_M104() {
SERIAL_PROTOCOLPGM("C->");
SERIAL_PROTOCOL_F(thermalManager.rawBedTemp() / OVERSAMPLENR, 0);
#endif
for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
for (int8_t cur_hotend = 0; cur_hotend < HOTENDS; ++cur_hotend) {
SERIAL_PROTOCOLPGM(" T");
SERIAL_PROTOCOL(cur_extruder);
SERIAL_PROTOCOL(cur_hotend);
SERIAL_PROTOCOLCHAR(':');
SERIAL_PROTOCOL_F(thermalManager.degHotend(cur_extruder), 1);
SERIAL_PROTOCOL_F(thermalManager.degHotend(cur_hotend), 1);
SERIAL_PROTOCOLPGM("C->");
SERIAL_PROTOCOL_F(thermalManager.rawHotendTemp(cur_extruder) / OVERSAMPLENR, 0);
SERIAL_PROTOCOL_F(thermalManager.rawHotendTemp(cur_hotend) / OVERSAMPLENR, 0);
}
#endif
}
@ -4554,6 +4558,10 @@ inline void gcode_M109() {
if (get_target_extruder_from_command(109)) return;
if (DEBUGGING(DRYRUN)) return;
#if ENABLED(SINGLENOZZLE)
if (target_extruder != active_extruder) return;
#endif
bool no_wait_for_cooling = code_seen('S');
if (no_wait_for_cooling || code_seen('R')) {
float temp = code_value();
@ -5429,7 +5437,7 @@ inline void gcode_M206() {
#endif // FWRETRACT
#if EXTRUDERS > 1
#if HOTENDS > 1
/**
* M218 - set hotend offset (in mm)
@ -5442,29 +5450,29 @@ inline void gcode_M206() {
inline void gcode_M218() {
if (get_target_extruder_from_command(218)) return;
if (code_seen('X')) extruder_offset[X_AXIS][target_extruder] = code_value();
if (code_seen('Y')) extruder_offset[Y_AXIS][target_extruder] = code_value();
if (code_seen('X')) hotend_offset[X_AXIS][target_extruder] = code_value();
if (code_seen('Y')) hotend_offset[Y_AXIS][target_extruder] = code_value();
#if ENABLED(DUAL_X_CARRIAGE)
if (code_seen('Z')) extruder_offset[Z_AXIS][target_extruder] = code_value();
if (code_seen('Z')) hotend_offset[Z_AXIS][target_extruder] = code_value();
#endif
SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
for (int e = 0; e < EXTRUDERS; e++) {
for (int e = 0; e < HOTENDS; e++) {
SERIAL_CHAR(' ');
SERIAL_ECHO(extruder_offset[X_AXIS][e]);
SERIAL_ECHO(hotend_offset[X_AXIS][e]);
SERIAL_CHAR(',');
SERIAL_ECHO(extruder_offset[Y_AXIS][e]);
SERIAL_ECHO(hotend_offset[Y_AXIS][e]);
#if ENABLED(DUAL_X_CARRIAGE)
SERIAL_CHAR(',');
SERIAL_ECHO(extruder_offset[Z_AXIS][e]);
SERIAL_ECHO(hotend_offset[Z_AXIS][e]);
#endif
}
SERIAL_EOL;
}
#endif // EXTRUDERS > 1
#endif // HOTENDS > 1
/**
* M220: Set speed percentage factor, aka "Feed Rate" (M220 S95)
@ -5594,7 +5602,7 @@ inline void gcode_M226() {
// default behaviour (omitting E parameter) is to update for extruder 0 only
int e = code_seen('E') ? code_value() : 0; // extruder being updated
if (e < EXTRUDERS) { // catch bad input value
if (e < HOTENDS) { // catch bad input value
if (code_seen('P')) PID_PARAM(Kp, e) = code_value();
if (code_seen('I')) PID_PARAM(Ki, e) = scalePID_i(code_value());
if (code_seen('D')) PID_PARAM(Kd, e) = scalePID_d(code_value());
@ -5606,10 +5614,10 @@ inline void gcode_M226() {
thermalManager.updatePID();
SERIAL_ECHO_START;
#if ENABLED(PID_PARAMS_PER_EXTRUDER)
#if ENABLED(PID_PARAMS_PER_HOTEND)
SERIAL_ECHO(" e:"); // specify extruder in serial output
SERIAL_ECHO(e);
#endif // PID_PARAMS_PER_EXTRUDER
#endif // PID_PARAMS_PER_HOTEND
SERIAL_ECHO(" p:");
SERIAL_ECHO(PID_PARAM(Kp, e));
SERIAL_ECHO(" i:");
@ -5728,7 +5736,7 @@ inline void gcode_M303() {
float temp = code_seen('S') ? code_value() : (e < 0 ? 70.0 : 150.0);
if (e >= 0 && e < EXTRUDERS)
if (e >= 0 && e < HOTENDS)
target_extruder = e;
KEEPALIVE_STATE(NOT_BUSY); // don't send "busy: processing" messages during autotune output
@ -6310,13 +6318,13 @@ inline void gcode_M503() {
SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
SERIAL_CHAR(' ');
SERIAL_ECHO(extruder_offset[X_AXIS][0]);
SERIAL_ECHO(hotend_offset[X_AXIS][0]);
SERIAL_CHAR(',');
SERIAL_ECHO(extruder_offset[Y_AXIS][0]);
SERIAL_ECHO(hotend_offset[Y_AXIS][0]);
SERIAL_CHAR(' ');
SERIAL_ECHO(duplicate_extruder_x_offset);
SERIAL_CHAR(',');
SERIAL_ECHOLN(extruder_offset[Y_AXIS][1]);
SERIAL_ECHOLN(hotend_offset[Y_AXIS][1]);
break;
case DXC_FULL_CONTROL_MODE:
case DXC_AUTO_PARK_MODE:
@ -6474,7 +6482,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
#endif
}
#if EXTRUDERS > 1
#if HOTENDS > 1
if (tmp_extruder != active_extruder) {
// Save current position to return to after applying extruder offset
set_destination_to_current();
@ -6492,8 +6500,8 @@ inline void gcode_T(uint8_t tmp_extruder) {
}
// apply Y & Z extruder offset (x offset is already used in determining home pos)
current_position[Y_AXIS] -= extruder_offset[Y_AXIS][active_extruder] - extruder_offset[Y_AXIS][tmp_extruder];
current_position[Z_AXIS] -= extruder_offset[Z_AXIS][active_extruder] - extruder_offset[Z_AXIS][tmp_extruder];
current_position[Y_AXIS] -= hotend_offset[Y_AXIS][active_extruder] - hotend_offset[Y_AXIS][tmp_extruder];
current_position[Z_AXIS] -= hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
active_extruder = tmp_extruder;
// This function resets the max/min values - the current position may be overwritten below.
@ -6523,11 +6531,11 @@ inline void gcode_T(uint8_t tmp_extruder) {
#else // !DUAL_X_CARRIAGE
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
// Offset extruder, make sure to apply the bed level rotation matrix
vector_3 tmp_offset_vec = vector_3(extruder_offset[X_AXIS][tmp_extruder],
extruder_offset[Y_AXIS][tmp_extruder],
vector_3 tmp_offset_vec = vector_3(hotend_offset[X_AXIS][tmp_extruder],
hotend_offset[Y_AXIS][tmp_extruder],
0),
act_offset_vec = vector_3(extruder_offset[X_AXIS][active_extruder],
extruder_offset[Y_AXIS][active_extruder],
act_offset_vec = vector_3(hotend_offset[X_AXIS][active_extruder],
hotend_offset[Y_AXIS][active_extruder],
0),
offset_vec = tmp_offset_vec - act_offset_vec;
@ -6559,7 +6567,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
// The newly-selected extruder is actually at...
for (int i=X_AXIS; i<=Y_AXIS; i++) {
float diff = extruder_offset[i][tmp_extruder] - extruder_offset[i][active_extruder];
float diff = hotend_offset[i][tmp_extruder] - hotend_offset[i][active_extruder];
current_position[i] += diff;
position_shift[i] += diff; // Offset the coordinate space
update_software_endstops((AxisEnum)i);
@ -6590,7 +6598,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
enable_solenoid_on_active_extruder();
#endif // EXT_SOLENOID
#endif // EXTRUDERS > 1
#endif // HOTENDS > 1
feedrate = stored_feedrate;
@ -7021,7 +7029,7 @@ void process_next_command() {
break;
#endif // FWRETRACT
#if EXTRUDERS > 1
#if HOTENDS > 1
case 218: // M218 - set hotend offset (in mm), T<extruder_number> X<offset_on_X> Y<offset_on_Y>
gcode_M218();
break;
@ -7891,8 +7899,8 @@ void prepare_move() {
float max_temp = 0.0;
if (ELAPSED(millis(), next_status_led_update_ms)) {
next_status_led_update_ms += 500; // Update every 0.5s
for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder)
max_temp = max(max(max_temp, thermalManager.degHotend(cur_extruder)), thermalManager.degTargetHotend(cur_extruder));
for (int8_t cur_hotend = 0; cur_hotend < HOTENDS; ++cur_hotend)
max_temp = max(max(max_temp, thermalManager.degHotend(cur_hotend)), thermalManager.degTargetHotend(cur_hotend));
#if HAS_TEMP_BED
max_temp = max(max(max_temp, thermalManager.degTargetBed()), thermalManager.degBed());
#endif

@ -468,39 +468,45 @@
/**
* Test Heater, Temp Sensor, and Extruder Pins; Sensor Type must also be set.
*/
#if EXTRUDERS > 3
#if TEMP_SENSOR_3 == 0
#error "TEMP_SENSOR_3 is required with 4 EXTRUDERS."
#elif !HAS_HEATER_3
#error "HEATER_3_PIN not defined for this board."
#elif !PIN_EXISTS(TEMP_3)
#error "TEMP_3_PIN not defined for this board."
#elif !PIN_EXISTS(E3_STEP) || !PIN_EXISTS(E3_DIR) || !PIN_EXISTS(E3_ENABLE)
#error "E3_STEP_PIN, E3_DIR_PIN, or E3_ENABLE_PIN not defined for this board."
#if !HAS_HEATER_0
#error "HEATER_0_PIN not defined for this board."
#elif !PIN_EXISTS(TEMP_0)
#error "TEMP_0_PIN not defined for this board."
#elif !PIN_EXISTS(E0_STEP) || !PIN_EXISTS(E0_DIR) || !PIN_EXISTS(E0_ENABLE)
#error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
#elif TEMP_SENSOR_0 == 0
#error "TEMP_SENSOR_0 is required."
#endif
#if HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)
#if !HAS_HEATER_1
#error "HEATER_1_PIN not defined for this board."
#endif
#elif EXTRUDERS > 2
#endif
#if HOTENDS > 1
#if TEMP_SENSOR_1 == 0
#error "TEMP_SENSOR_1 is required with 2 or more HOTENDS."
#elif !PIN_EXISTS(TEMP_1)
#error "TEMP_1_PIN not defined for this board."
#endif
#if HOTENDS > 2
#if TEMP_SENSOR_2 == 0
#error "TEMP_SENSOR_2 is required with 3 or more EXTRUDERS."
#error "TEMP_SENSOR_2 is required with 3 or more HOTENDS."
#elif !HAS_HEATER_2
#error "HEATER_2_PIN not defined for this board."
#elif !PIN_EXISTS(TEMP_2)
#error "TEMP_2_PIN not defined for this board."
#elif !PIN_EXISTS(E2_STEP) || !PIN_EXISTS(E2_DIR) || !PIN_EXISTS(E2_ENABLE)
#error "E2_STEP_PIN, E2_DIR_PIN, or E2_ENABLE_PIN not defined for this board."
#endif
#elif EXTRUDERS > 1
#if TEMP_SENSOR_1 == 0
#error "TEMP_SENSOR_1 is required with 2 or more EXTRUDERS."
#elif !PIN_EXISTS(TEMP_1)
#error "TEMP_1_PIN not defined for this board."
#elif !PIN_EXISTS(E1_STEP) || !PIN_EXISTS(E1_DIR) || !PIN_EXISTS(E1_ENABLE)
#error "E1_STEP_PIN, E1_DIR_PIN, or E1_ENABLE_PIN not defined for this board."
#if HOTENDS > 3
#if TEMP_SENSOR_3 == 0
#error "TEMP_SENSOR_3 is required with 4 HOTENDS."
#elif !HAS_HEATER_3
#error "HEATER_3_PIN not defined for this board."
#elif !PIN_EXISTS(TEMP_3)
#error "TEMP_3_PIN not defined for this board."
#endif
#endif
#endif
#if EXTRUDERS > 1 || ENABLED(HEATERS_PARALLEL)
#if !HAS_HEATER_1
#error "HEATER_1_PIN not defined for this board."
#endif
#endif
@ -508,14 +514,21 @@
#error "TEMP_SENSOR_1 is required with TEMP_SENSOR_1_AS_REDUNDANT."
#endif
#if !HAS_HEATER_0
#error "HEATER_0_PIN not defined for this board."
#elif !PIN_EXISTS(TEMP_0)
#error "TEMP_0_PIN not defined for this board."
#elif !PIN_EXISTS(E0_STEP) || !PIN_EXISTS(E0_DIR) || !PIN_EXISTS(E0_ENABLE)
#error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
#elif TEMP_SENSOR_0 == 0
#error "TEMP_SENSOR_0 is required."
/**
* Test Extruder Pins
*/
#if EXTRUDERS > 3
#if !PIN_EXISTS(E3_STEP) || !PIN_EXISTS(E3_DIR) || !PIN_EXISTS(E3_ENABLE)
#error E3_STEP_PIN, E3_DIR_PIN, or E3_ENABLE_PIN not defined for this board.
#endif
#elif EXTRUDERS > 2
#if !PIN_EXISTS(E2_STEP) || !PIN_EXISTS(E2_DIR) || !PIN_EXISTS(E2_ENABLE)
#error E2_STEP_PIN, E2_DIR_PIN, or E2_ENABLE_PIN not defined for this board.
#endif
#elif EXTRUDERS > 1
#if !PIN_EXISTS(E1_STEP) || !PIN_EXISTS(E1_DIR) || !PIN_EXISTS(E1_ENABLE)
#error E1_STEP_PIN, E1_DIR_PIN, or E1_ENABLE_PIN not defined for this board.
#endif
#endif
/**
@ -574,6 +587,12 @@
#error "Z_DUAL_ENDSTOPS settings are simplified. Just set Z2_USE_ENDSTOP to the endstop you want to repurpose for Z2"
#elif defined(LANGUAGE_INCLUDE)
#error "LANGUAGE_INCLUDE has been replaced by LCD_LANGUAGE. Please update your configuration."
#elif defined(EXTRUDER_OFFSET_X) || defined(EXTRUDER_OFFSET_Y)
#error "EXTRUDER_OFFSET_[XY] is deprecated. Use HOTEND_OFFSET_[XY] instead."
#elif defined(PID_PARAMS_PER_EXTRUDER)
#error "PID_PARAMS_PER_EXTRUDER is deprecated. Use PID_PARAMS_PER_HOTEND instead."
#elif defined(EXTRUDER_WATTS)
#error "EXTRUDER_WATTS is deprecated. Use HOTEND_WATTS instead."
#endif
#endif //SANITYCHECK_H

@ -32,17 +32,17 @@
#define BOARD_CHEAPTRONIC 2 // Cheaptronic v1.0
#define BOARD_SETHI 20 // Sethi 3D_1
#define BOARD_RAMPS_OLD 3 // MEGA/RAMPS up to 1.2
#define BOARD_RAMPS_13_EFB 33 // RAMPS 1.3 (Power outputs: Extruder, Fan, Bed)
#define BOARD_RAMPS_13_EEB 34 // RAMPS 1.3 (Power outputs: Extruder0, Extruder1, Bed)
#define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 (Power outputs: Extruder, Fan, Fan)
#define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 (Power outputs: Extruder0, Extruder1, Fan)
#define BOARD_RAMPS_13_EFB 33 // RAMPS 1.3 (Power outputs: Hotend, Fan, Bed)
#define BOARD_RAMPS_13_EEB 34 // RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Bed)
#define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 (Power outputs: Hotend, Fan0, Fan1)
#define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Fan)
#define BOARD_RAMPS_13_SF 38 // RAMPS 1.3 (Power outputs: Spindle, Controller Fan)
#define BOARD_FELIX2 37 // Felix 2.0+ Electronics Board (RAMPS like)
#define BOARD_RIGIDBOARD 42 // Invent-A-Part RigidBoard
#define BOARD_RAMPS_14_EFB 43 // RAMPS 1.4 (Power outputs: Extruder, Fan, Bed)
#define BOARD_RAMPS_14_EEB 44 // RAMPS 1.4 (Power outputs: Extruder0, Extruder1, Bed)
#define BOARD_RAMPS_14_EFF 45 // RAMPS 1.4 (Power outputs: Extruder, Fan, Fan)
#define BOARD_RAMPS_14_EEF 46 // RAMPS 1.4 (Power outputs: Extruder0, Extruder1, Fan)
#define BOARD_RAMPS_14_EFB 43 // RAMPS 1.4 (Power outputs: Hotend, Fan, Bed)
#define BOARD_RAMPS_14_EEB 44 // RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Bed)
#define BOARD_RAMPS_14_EFF 45 // RAMPS 1.4 (Power outputs: Hotend, Fan0, Fan1)
#define BOARD_RAMPS_14_EEF 46 // RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Fan)
#define BOARD_RAMPS_14_SF 48 // RAMPS 1.4 (Power outputs: Spindle, Controller Fan)
#define BOARD_GEN6 5 // Gen6
#define BOARD_GEN6_DELUXE 51 // Gen6 deluxe

@ -247,7 +247,7 @@ void Config_StoreSettings() {
for (uint8_t e = 0; e < 4; e++) {
#if ENABLED(PIDTEMP)
if (e < EXTRUDERS) {
if (e < HOTENDS) {
EEPROM_WRITE_VAR(i, PID_PARAM(Kp, e));
EEPROM_WRITE_VAR(i, PID_PARAM(Ki, e));
EEPROM_WRITE_VAR(i, PID_PARAM(Kd, e));
@ -267,7 +267,7 @@ void Config_StoreSettings() {
for (uint8_t q = 3; q--;) EEPROM_WRITE_VAR(i, dummy); // Ki, Kd, Kc
}
} // Extruders Loop
} // Hotends Loop
#if DISABLED(PID_ADD_EXTRUSION_RATE)
int lpq_len = 20;
@ -427,7 +427,7 @@ void Config_RetrieveSettings() {
#if ENABLED(PIDTEMP)
for (uint8_t e = 0; e < 4; e++) { // 4 = max extruders currently supported by Marlin
EEPROM_READ_VAR(i, dummy); // Kp
if (e < EXTRUDERS && dummy != DUMMY_PID_VALUE) {
if (e < HOTENDS && dummy != DUMMY_PID_VALUE) {
// do not need to scale PID values as the values in EEPROM are already scaled
PID_PARAM(Kp, e) = dummy;
EEPROM_READ_VAR(i, PID_PARAM(Ki, e));
@ -585,8 +585,8 @@ void Config_ResetDefault() {
#endif
#if ENABLED(PIDTEMP)
#if ENABLED(PID_PARAMS_PER_EXTRUDER)
for (uint8_t e = 0; e < EXTRUDERS; e++)
#if ENABLED(PID_PARAMS_PER_HOTEND)
for (uint8_t e = 0; e < HOTENDS; e++)
#else
int e = 0; UNUSED(e); // only need to write once
#endif
@ -802,9 +802,9 @@ void Config_PrintSettings(bool forReplay) {
SERIAL_ECHOLNPGM("PID settings:");
}
#if ENABLED(PIDTEMP)
#if EXTRUDERS > 1
#if HOTENDS > 1
if (forReplay) {
for (uint8_t i = 0; i < EXTRUDERS; i++) {
for (uint8_t i = 0; i < HOTENDS; i++) {
CONFIG_ECHO_START;
SERIAL_ECHOPAIR(" M301 E", i);
SERIAL_ECHOPAIR(" P", PID_PARAM(Kp, i));
@ -818,8 +818,8 @@ void Config_PrintSettings(bool forReplay) {
}
}
else
#endif // EXTRUDERS > 1
// !forReplay || EXTRUDERS == 1
#endif // HOTENDS > 1
// !forReplay || HOTENDS == 1
{
CONFIG_ECHO_START;
SERIAL_ECHOPAIR(" M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echo values for E0

@ -110,7 +110,7 @@
// be displayed.
#if HAS_TEMP_BED
#if EXTRUDERS == 1
#if HOTENDS == 1
#define STATUS_SCREENWIDTH 115 //Width in pixels
#define STATUS_SCREENHEIGHT 19 //Height in pixels
#define STATUS_SCREENBYTEWIDTH 15 //Width in bytes
@ -160,7 +160,7 @@
0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0x80, 0x7F, 0xFF, 0xE0,
0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00
};
#elif EXTRUDERS == 2
#elif HOTENDS == 2
#define STATUS_SCREENWIDTH 115 //Width in pixels
#define STATUS_SCREENHEIGHT 19 //Height in pixels
#define STATUS_SCREENBYTEWIDTH 15 //Width in bytes
@ -262,7 +262,7 @@
};
#endif // Extruders
#else
#if EXTRUDERS == 1
#if HOTENDS == 1
#define STATUS_SCREENWIDTH 115 //Width in pixels
#define STATUS_SCREENHEIGHT 19 //Height in pixels
#define STATUS_SCREENBYTEWIDTH 15 //Width in bytes
@ -312,7 +312,7 @@
0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xE0,
0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
#elif EXTRUDERS == 2
#elif HOTENDS == 2
#define STATUS_SCREENWIDTH 115 //Width in pixels
#define STATUS_SCREENHEIGHT 19 //Height in pixels
#define STATUS_SCREENBYTEWIDTH 15 //Width in bytes

@ -370,10 +370,10 @@ static void lcd_implementation_status_screen() {
#endif
// Extruders
for (int i = 0; i < EXTRUDERS; i++) _draw_heater_status(5 + i * 25, i);
for (int i = 0; i < HOTENDS; i++) _draw_heater_status(5 + i * 25, i);
// Heated bed
#if EXTRUDERS < 4 && HAS_TEMP_BED
#if HOTENDS < 4 && HAS_TEMP_BED
_draw_heater_status(81, -1);
#endif

@ -126,8 +126,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -224,7 +224,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -241,7 +241,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -237,7 +237,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -126,8 +126,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -224,7 +224,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -241,7 +241,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -129,8 +129,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -227,7 +227,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -244,7 +244,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -237,7 +237,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -126,8 +126,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -224,7 +224,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -241,7 +241,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 250 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -237,7 +237,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -133,8 +133,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -231,7 +231,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -248,7 +248,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -243,7 +243,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -126,8 +126,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -224,7 +224,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -241,7 +241,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -126,8 +126,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
#define EXTRUDER_OFFSET_X {0.0, 36.00} // (in mm) for each extruder, offset of the hotend on the X axis
#define EXTRUDER_OFFSET_Y {0.0, 0.00} // (in mm) for each extruder, offset of the hotend on the Y axis
#define HOTEND_OFFSET_X {0.0, 36.00} // (in mm) for each extruder, offset of the hotend on the X axis
#define HOTEND_OFFSET_Y {0.0, 0.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -224,7 +224,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -241,7 +241,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -237,7 +237,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -151,8 +151,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -249,7 +249,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
#define EXTRUDER_WATTS (2*2/5.9) // P=U^2/R
#define HOTEND_WATTS (2*2/5.9) // P=U^2/R
#define BED_WATTS (5.45*5.45/2.2) // P=U^2/R
//===========================================================================
@ -266,7 +266,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 20 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -237,7 +237,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -126,8 +126,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -224,7 +224,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -241,7 +241,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 16 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -245,7 +245,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -129,8 +129,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -227,7 +227,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -244,7 +244,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -237,7 +237,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -126,8 +126,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -224,7 +224,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -241,7 +241,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -126,8 +126,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -224,7 +224,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -241,7 +241,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -237,7 +237,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -126,8 +126,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -224,7 +224,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -241,7 +241,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -237,7 +237,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -126,8 +126,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -224,7 +224,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -241,7 +241,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -237,7 +237,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -132,8 +132,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -230,7 +230,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -247,7 +247,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 50 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -242,7 +242,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -119,8 +119,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -217,7 +217,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -234,7 +234,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -237,7 +237,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -126,8 +126,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -224,7 +224,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -241,7 +241,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -237,7 +237,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -126,8 +126,8 @@
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX
@ -224,7 +224,7 @@
#define BED_MAXTEMP 150
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=U^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=U^2/R
//===========================================================================
@ -241,7 +241,7 @@
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
//#define PID_PARAMS_PER_EXTRUDER // Uses separate PID parameters for each extruder (useful for mismatched extruders)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.

@ -237,7 +237,7 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.

@ -243,20 +243,38 @@
#define marlinAnalogInputToDigitalPin(p) ((p) == -1 ? -1 : (p) + 0xA0)
// List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those!
#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, E0_MS1_PIN, E0_MS2_PIN, HEATER_0_PIN, EXTRUDER_0_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_0_PIN),
#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, E0_MS1_PIN, E0_MS2_PIN,
#define _E1_PINS
#define _E2_PINS
#define _E3_PINS
#if EXTRUDERS > 1
#undef _E1_PINS
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, HEATER_1_PIN, E1_MS1_PIN, E1_MS2_PIN, EXTRUDER_1_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_1_PIN),
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN,
#if EXTRUDERS > 2
#undef _E2_PINS
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, HEATER_2_PIN, EXTRUDER_2_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_2_PIN),
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN,
#if EXTRUDERS > 3
#undef _E3_PINS
#define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, HEATER_3_PIN, EXTRUDER_3_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_3_PIN),
#define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN,
#endif
#endif
#endif
#define _H0_PINS HEATER_0_PIN, EXTRUDER_0_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_0_PIN),
#define _H1_PINS
#define _H2_PINS
#define _H3_PINS
#if HOTENDS > 1
#undef _H1_PINS
#define _H1_PINS HEATER_1_PIN, EXTRUDER_1_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_1_PIN),
#if HOTENDS > 2
#undef _H2_PINS
#define _H2_PINS HEATER_2_PIN, EXTRUDER_2_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_2_PIN),
#if HOTENDS > 3
#undef _H3_PINS
#define _H3_PINS HEATER_3_PIN, EXTRUDER_3_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_3_PIN),
#endif
#endif
#endif
@ -383,6 +401,7 @@
Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_MIN_PROBE_PIN, \
PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, FAN1_PIN, FAN2_PIN, CONTROLLERFAN_PIN, \
_E0_PINS _E1_PINS _E2_PINS _E3_PINS BED_PINS \
_H0_PINS _H1_PINS _H2_PINS _H3_PINS \
_X2_PINS _Y2_PINS _Z2_PINS \
X_MS1_PIN, X_MS2_PIN, Y_MS1_PIN, Y_MS2_PIN, Z_MS1_PIN, Z_MS2_PIN \
}

@ -28,7 +28,7 @@
#error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu."
#endif
#if EXTRUDERS > 2
#if EXTRUDERS > 2 || HOTENDS > 2
#error "Mega Controller supports up to 2 extruders. Comment this line to keep going."
#endif

@ -25,16 +25,16 @@
*
* Applies to the following boards:
*
* RAMPS_14_EFB (Extruder, Fan, Bed)
* RAMPS_14_EEB (Extruder, Extruder, Bed)
* RAMPS_14_EFF (Extruder, Fan, Fan)
* RAMPS_14_EEF (Extruder, Extruder, Fan)
* RAMPS_14_EFB (Hotend, Fan, Bed)
* RAMPS_14_EEB (Hotend0, Hotend1, Bed)
* RAMPS_14_EFF (Hotend, Fan0, Fan1)
* RAMPS_14_EEF (Hotend0, Hotend1, Fan)
* RAMPS_14_SF (Spindle, Controller Fan)
*
* RAMPS_13_EFB (Extruder, Fan, Bed)
* RAMPS_13_EEB (Extruder, Extruder, Bed)
* RAMPS_13_EFF (Extruder, Fan, Fan)
* RAMPS_13_EEF (Extruder, Extruder, Fan)
* RAMPS_13_EFB (Hotend, Fan, Bed)
* RAMPS_13_EEB (Hotend0, Hotend1, Bed)
* RAMPS_13_EFF (Hotend, Fan0, Fan1)
* RAMPS_13_EEF (Hotend0, Hotend1, Fan)
* RAMPS_13_SF (Spindle, Controller Fan)
*
* Other pins_MYBOARD.h files may override these defaults

@ -28,7 +28,7 @@
#error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu."
#endif
#if EXTRUDERS > 3
#if EXTRUDERS > 3 || HOTENDS > 3
#error "RUMBA supports up to 3 extruders. Comment this line to keep going."
#endif

@ -42,17 +42,17 @@
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[EXTRUDERS] = ARRAY_BY_EXTRUDERS((void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE, (void*)HEATER_2_TEMPTABLE, (void*)HEATER_3_TEMPTABLE);
static uint8_t heater_ttbllen_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS(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);
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);
#endif
Temperature thermalManager;
// public:
int Temperature::current_temperature_raw[EXTRUDERS] = { 0 };
float Temperature::current_temperature[EXTRUDERS] = { 0.0 };
int Temperature::target_temperature[EXTRUDERS] = { 0 };
int Temperature::current_temperature_raw[HOTENDS] = { 0 };
float Temperature::current_temperature[HOTENDS] = { 0.0 };
int Temperature::target_temperature[HOTENDS] = { 0 };
int Temperature::current_temperature_bed_raw = 0;
float Temperature::current_temperature_bed = 0.0;
@ -69,12 +69,12 @@ unsigned char Temperature::soft_pwm_bed;
#endif
#if ENABLED(PIDTEMP)
#if ENABLED(PID_PARAMS_PER_EXTRUDER)
float Temperature::Kp[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kp),
Temperature::Ki[EXTRUDERS] = ARRAY_BY_EXTRUDERS1((DEFAULT_Ki) * (PID_dT)),
Temperature::Kd[EXTRUDERS] = ARRAY_BY_EXTRUDERS1((DEFAULT_Kd) / (PID_dT));
#if ENABLED(PID_PARAMS_PER_HOTEND)
float Temperature::Kp[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kp),
Temperature::Ki[HOTENDS] = ARRAY_BY_HOTENDS1((DEFAULT_Ki) * (PID_dT)),
Temperature::Kd[HOTENDS] = ARRAY_BY_HOTENDS1((DEFAULT_Kd) / (PID_dT));
#if ENABLED(PID_ADD_EXTRUSION_RATE)
float Temperature::Kc[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kc);
float Temperature::Kc[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kc);
#endif
#else
float Temperature::Kp = DEFAULT_Kp,
@ -97,8 +97,8 @@ unsigned char Temperature::soft_pwm_bed;
#endif
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
int Temperature::watch_target_temp[EXTRUDERS] = { 0 };
millis_t Temperature::watch_heater_next_ms[EXTRUDERS] = { 0 };
int Temperature::watch_target_temp[HOTENDS] = { 0 };
millis_t Temperature::watch_heater_next_ms[HOTENDS] = { 0 };
#endif
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_BED_TEMP_PERIOD > 0
@ -120,23 +120,23 @@ unsigned char Temperature::soft_pwm_bed;
volatile bool Temperature::temp_meas_ready = false;
#if ENABLED(PIDTEMP)
float Temperature::temp_iState[EXTRUDERS] = { 0 };
float Temperature::temp_dState[EXTRUDERS] = { 0 };
float Temperature::pTerm[EXTRUDERS];
float Temperature::iTerm[EXTRUDERS];
float Temperature::dTerm[EXTRUDERS];
float Temperature::temp_iState[HOTENDS] = { 0 };
float Temperature::temp_dState[HOTENDS] = { 0 };
float Temperature::pTerm[HOTENDS];
float Temperature::iTerm[HOTENDS];
float Temperature::dTerm[HOTENDS];
#if ENABLED(PID_ADD_EXTRUSION_RATE)
float Temperature::cTerm[EXTRUDERS];
long Temperature::last_position[EXTRUDERS];
float Temperature::cTerm[HOTENDS];
long Temperature::last_position[HOTENDS];
long Temperature::lpq[LPQ_MAX_LEN];
int Temperature::lpq_ptr = 0;
#endif
float Temperature::pid_error[EXTRUDERS];
float Temperature::temp_iState_min[EXTRUDERS];
float Temperature::temp_iState_max[EXTRUDERS];
bool Temperature::pid_reset[EXTRUDERS];
float Temperature::pid_error[HOTENDS];
float Temperature::temp_iState_min[HOTENDS];
float Temperature::temp_iState_max[HOTENDS];
bool Temperature::pid_reset[HOTENDS];
#endif
#if ENABLED(PIDTEMPBED)
@ -156,10 +156,10 @@ unsigned long Temperature::raw_temp_value[4] = { 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[EXTRUDERS] = ARRAY_BY_EXTRUDERS(HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP, HEATER_3_RAW_LO_TEMP);
int Temperature::maxttemp_raw[EXTRUDERS] = ARRAY_BY_EXTRUDERS(HEATER_0_RAW_HI_TEMP , HEATER_1_RAW_HI_TEMP , HEATER_2_RAW_HI_TEMP, HEATER_3_RAW_HI_TEMP);
int Temperature::minttemp[EXTRUDERS] = { 0 };
int Temperature::maxttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(16383);
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);
int 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[HOTENDS] = { 0 };
int Temperature::maxttemp[HOTENDS] = ARRAY_BY_HOTENDS1(16383);
#ifdef BED_MINTEMP
int Temperature::bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP;
@ -177,7 +177,7 @@ int Temperature::maxttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(16383);
millis_t Temperature::next_auto_fan_check_ms;
#endif
unsigned char Temperature::soft_pwm[EXTRUDERS];
unsigned char Temperature::soft_pwm[HOTENDS];
#if ENABLED(FAN_SOFT_PWM)
unsigned char Temperature::soft_pwm_fan[FAN_COUNT];
@ -189,7 +189,7 @@ unsigned char Temperature::soft_pwm[EXTRUDERS];
#if HAS_PID_HEATING
void Temperature::PID_autotune(float temp, int extruder, int ncycles, bool set_result/*=false*/) {
void Temperature::PID_autotune(float temp, int hotend, int ncycles, bool set_result/*=false*/) {
float input = 0.0;
int cycles = 0;
bool heating = true;
@ -208,12 +208,12 @@ unsigned char Temperature::soft_pwm[EXTRUDERS];
if (false
#if ENABLED(PIDTEMP)
|| extruder >= EXTRUDERS
|| hotend >= HOTENDS
#else
|| extruder >= 0
|| hotend >= 0
#endif
#if DISABLED(PIDTEMPBED)
|| extruder < 0
|| hotend < 0
#endif
) {
SERIAL_ECHOLN(MSG_PID_BAD_EXTRUDER_NUM);
@ -225,12 +225,12 @@ unsigned char Temperature::soft_pwm[EXTRUDERS];
disable_all_heaters(); // switch off all heaters.
#if HAS_PID_FOR_BOTH
if (extruder < 0)
if (hotend < 0)
soft_pwm_bed = bias = d = (MAX_BED_POWER) / 2;
else
soft_pwm[extruder] = bias = d = (PID_MAX) / 2;
soft_pwm[hotend] = bias = d = (PID_MAX) / 2;
#elif ENABLED(PIDTEMP)
soft_pwm[extruder] = bias = d = (PID_MAX) / 2;
soft_pwm[hotend] = bias = d = (PID_MAX) / 2;
#else
soft_pwm_bed = bias = d = (MAX_BED_POWER) / 2;
#endif
@ -245,9 +245,9 @@ unsigned char Temperature::soft_pwm[EXTRUDERS];
input =
#if HAS_PID_FOR_BOTH
extruder < 0 ? current_temperature_bed : current_temperature[extruder]
hotend < 0 ? current_temperature_bed : current_temperature[hotend]
#elif ENABLED(PIDTEMP)
current_temperature[extruder]
current_temperature[hotend]
#else
current_temperature_bed
#endif
@ -267,12 +267,12 @@ unsigned char Temperature::soft_pwm[EXTRUDERS];
if (ELAPSED(ms, t2 + 5000UL)) {
heating = false;
#if HAS_PID_FOR_BOTH
if (extruder < 0)
if (hotend < 0)
soft_pwm_bed = (bias - d) >> 1;
else
soft_pwm[extruder] = (bias - d) >> 1;
soft_pwm[hotend] = (bias - d) >> 1;
#elif ENABLED(PIDTEMP)
soft_pwm[extruder] = (bias - d) >> 1;
soft_pwm[hotend] = (bias - d) >> 1;
#elif ENABLED(PIDTEMPBED)
soft_pwm_bed = (bias - d) >> 1;
#endif
@ -290,7 +290,7 @@ unsigned char Temperature::soft_pwm[EXTRUDERS];
if (cycles > 0) {
long max_pow =
#if HAS_PID_FOR_BOTH
extruder < 0 ? MAX_BED_POWER : PID_MAX
hotend < 0 ? MAX_BED_POWER : PID_MAX
#elif ENABLED(PIDTEMP)
PID_MAX
#else
@ -336,12 +336,12 @@ unsigned char Temperature::soft_pwm[EXTRUDERS];
}
}
#if HAS_PID_FOR_BOTH
if (extruder < 0)
if (hotend < 0)
soft_pwm_bed = (bias + d) >> 1;
else
soft_pwm[extruder] = (bias + d) >> 1;
soft_pwm[hotend] = (bias + d) >> 1;
#elif ENABLED(PIDTEMP)
soft_pwm[extruder] = (bias + d) >> 1;
soft_pwm[hotend] = (bias + d) >> 1;
#else
soft_pwm_bed = (bias + d) >> 1;
#endif
@ -373,7 +373,7 @@ unsigned char Temperature::soft_pwm[EXTRUDERS];
SERIAL_PROTOCOLLNPGM(MSG_PID_AUTOTUNE_FINISHED);
#if HAS_PID_FOR_BOTH
const char* estring = extruder < 0 ? "bed" : "";
const char* estring = hotend < 0 ? "bed" : "";
SERIAL_PROTOCOLPGM("#define DEFAULT_"); SERIAL_PROTOCOL(estring); SERIAL_PROTOCOLPGM("Kp "); SERIAL_PROTOCOLLN(workKp);
SERIAL_PROTOCOLPGM("#define DEFAULT_"); SERIAL_PROTOCOL(estring); SERIAL_PROTOCOLPGM("Ki "); SERIAL_PROTOCOLLN(workKi);
SERIAL_PROTOCOLPGM("#define DEFAULT_"); SERIAL_PROTOCOL(estring); SERIAL_PROTOCOLPGM("Kd "); SERIAL_PROTOCOLLN(workKd);
@ -394,15 +394,15 @@ unsigned char Temperature::soft_pwm[EXTRUDERS];
updatePID()
#define _SET_EXTRUDER_PID() \
PID_PARAM(Kp, extruder) = workKp; \
PID_PARAM(Ki, extruder) = scalePID_i(workKi); \
PID_PARAM(Kd, extruder) = scalePID_d(workKd); \
PID_PARAM(Kp, hotend) = workKp; \
PID_PARAM(Ki, hotend) = scalePID_i(workKi); \
PID_PARAM(Kd, hotend) = scalePID_d(workKd); \
updatePID()
// Use the result? (As with "M303 U1")
if (set_result) {
#if HAS_PID_FOR_BOTH
if (extruder < 0) {
if (hotend < 0) {
_SET_BED_PID();
}
else {
@ -430,7 +430,7 @@ Temperature::Temperature() { }
void Temperature::updatePID() {
#if ENABLED(PIDTEMP)
for (int e = 0; e < EXTRUDERS; e++) {
for (int e = 0; e < HOTENDS; e++) {
temp_iState_max[e] = (PID_INTEGRAL_DRIVE_MAX) / PID_PARAM(Ki, e);
#if ENABLED(PID_ADD_EXTRUSION_RATE)
last_position[e] = 0;
@ -459,7 +459,7 @@ int Temperature::getHeaterPower(int heater) {
EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_2_AUTO_FAN_PIN ? 2 : 3
};
uint8_t fanState = 0;
for (int f = 0; f <= EXTRUDERS; f++) {
for (int f = 0; f <= HOTENDS; f++) {
if (current_temperature[f] > EXTRUDER_AUTO_FAN_TEMPERATURE)
SBI(fanState, fanBit[f]);
}
@ -665,8 +665,8 @@ void Temperature::manage_heater() {
millis_t ms = millis();
#endif
// Loop through all extruders
for (int e = 0; e < EXTRUDERS; e++) {
// Loop through all hotends
for (int e = 0; e < HOTENDS; e++) {
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
@ -719,7 +719,7 @@ void Temperature::manage_heater() {
}
#endif
} // Extruders Loop
} // Hotends Loop
#if HAS_AUTO_FAN
if (ELAPSED(ms, next_auto_fan_check_ms)) { // only need to check fan state very infrequently
@ -790,9 +790,9 @@ void Temperature::manage_heater() {
// For hot end temperature measurement.
float Temperature::analog2temp(int raw, uint8_t e) {
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
if (e > EXTRUDERS)
if (e > HOTENDS)
#else
if (e >= EXTRUDERS)
if (e >= HOTENDS)
#endif
{
SERIAL_ERROR_START;
@ -873,7 +873,7 @@ void Temperature::updateTemperaturesFromRawValues() {
#if ENABLED(HEATER_0_USES_MAX6675)
current_temperature_raw[0] = read_max6675();
#endif
for (uint8_t e = 0; e < EXTRUDERS; e++) {
for (uint8_t e = 0; e < HOTENDS; e++) {
current_temperature[e] = Temperature::analog2temp(current_temperature_raw[e], e);
}
current_temperature_bed = Temperature::analog2tempBed(current_temperature_bed_raw);
@ -926,8 +926,8 @@ void Temperature::init() {
MCUCR = _BV(JTD);
#endif
// Finish init of mult extruder arrays
for (int e = 0; e < EXTRUDERS; e++) {
// Finish init of mult hotend arrays
for (int e = 0; e < HOTENDS; e++) {
// populate with the first value
maxttemp[e] = maxttemp[0];
#if ENABLED(PIDTEMP)
@ -1083,30 +1083,30 @@ void Temperature::init() {
#ifdef HEATER_0_MAXTEMP
TEMP_MAX_ROUTINE(0);
#endif
#if EXTRUDERS > 1
#if HOTENDS > 1
#ifdef HEATER_1_MINTEMP
TEMP_MIN_ROUTINE(1);
#endif
#ifdef HEATER_1_MAXTEMP
TEMP_MAX_ROUTINE(1);
#endif
#if EXTRUDERS > 2
#if HOTENDS > 2
#ifdef HEATER_2_MINTEMP
TEMP_MIN_ROUTINE(2);
#endif
#ifdef HEATER_2_MAXTEMP
TEMP_MAX_ROUTINE(2);
#endif
#if EXTRUDERS > 3
#if HOTENDS > 3
#ifdef HEATER_3_MINTEMP
TEMP_MIN_ROUTINE(3);
#endif
#ifdef HEATER_3_MAXTEMP
TEMP_MAX_ROUTINE(3);
#endif
#endif // EXTRUDERS > 3
#endif // EXTRUDERS > 2
#endif // EXTRUDERS > 1
#endif // HOTENDS > 3
#endif // HOTENDS > 2
#endif // HOTENDS > 1
#ifdef BED_MINTEMP
while(analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) {
@ -1163,8 +1163,8 @@ void Temperature::init() {
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
Temperature::TRState Temperature::thermal_runaway_state_machine[EXTRUDERS] = { TRInactive };
millis_t Temperature::thermal_runaway_timer[EXTRUDERS] = { 0 };
Temperature::TRState Temperature::thermal_runaway_state_machine[HOTENDS] = { TRInactive };
millis_t Temperature::thermal_runaway_timer[HOTENDS] = { 0 };
#endif
#if HAS_THERMALLY_PROTECTED_BED
@ -1174,7 +1174,7 @@ void Temperature::init() {
void Temperature::thermal_runaway_protection(Temperature::TRState* state, millis_t* timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) {
static float tr_target_temperature[EXTRUDERS + 1] = { 0.0 };
static float tr_target_temperature[HOTENDS + 1] = { 0.0 };
/**
SERIAL_ECHO_START;
@ -1187,7 +1187,7 @@ void Temperature::init() {
SERIAL_EOL;
*/
int heater_index = heater_id >= 0 ? heater_id : EXTRUDERS;
int heater_index = heater_id >= 0 ? heater_id : HOTENDS;
// If the target temperature changes, restart
if (tr_target_temperature[heater_index] != target_temperature) {
@ -1218,7 +1218,7 @@ void Temperature::init() {
#endif // THERMAL_PROTECTION_HOTENDS || THERMAL_PROTECTION_BED
void Temperature::disable_all_heaters() {
for (int i = 0; i < EXTRUDERS; i++) setTargetHotend(0, i);
for (int i = 0; i < HOTENDS; i++) setTargetHotend(0, i);
setTargetBed(0);
// If all heaters go down then for sure our print job has stopped
@ -1236,15 +1236,15 @@ void Temperature::disable_all_heaters() {
WRITE_HEATER_0P(LOW); // Should HEATERS_PARALLEL apply here? Then change to DISABLE_HEATER(0)
#endif
#if EXTRUDERS > 1 && HAS_TEMP_1
#if HOTENDS > 1 && HAS_TEMP_1
DISABLE_HEATER(1);
#endif
#if EXTRUDERS > 2 && HAS_TEMP_2
#if HOTENDS > 2 && HAS_TEMP_2
DISABLE_HEATER(2);
#endif
#if EXTRUDERS > 3 && HAS_TEMP_3
#if HOTENDS > 3 && HAS_TEMP_3
DISABLE_HEATER(3);
#endif
@ -1390,11 +1390,11 @@ void Temperature::isr() {
// Statics per heater
ISR_STATICS(0);
#if (EXTRUDERS > 1) || ENABLED(HEATERS_PARALLEL)
#if (HOTENDS > 1) || ENABLED(HEATERS_PARALLEL)
ISR_STATICS(1);
#if EXTRUDERS > 2
#if HOTENDS > 2
ISR_STATICS(2);
#if EXTRUDERS > 3
#if HOTENDS > 3
ISR_STATICS(3);
#endif
#endif
@ -1418,13 +1418,13 @@ void Temperature::isr() {
}
else WRITE_HEATER_0P(0); // If HEATERS_PARALLEL should apply, change to WRITE_HEATER_0
#if EXTRUDERS > 1
#if HOTENDS > 1
soft_pwm_1 = soft_pwm[1];
WRITE_HEATER_1(soft_pwm_1 > 0 ? 1 : 0);
#if EXTRUDERS > 2
#if HOTENDS > 2
soft_pwm_2 = soft_pwm[2];
WRITE_HEATER_2(soft_pwm_2 > 0 ? 1 : 0);
#if EXTRUDERS > 3
#if HOTENDS > 3
soft_pwm_3 = soft_pwm[3];
WRITE_HEATER_3(soft_pwm_3 > 0 ? 1 : 0);
#endif
@ -1453,11 +1453,11 @@ void Temperature::isr() {
}
if (soft_pwm_0 < pwm_count) WRITE_HEATER_0(0);
#if EXTRUDERS > 1
#if HOTENDS > 1
if (soft_pwm_1 < pwm_count) WRITE_HEATER_1(0);
#if EXTRUDERS > 2
#if HOTENDS > 2
if (soft_pwm_2 < pwm_count) WRITE_HEATER_2(0);
#if EXTRUDERS > 3
#if HOTENDS > 3
if (soft_pwm_3 < pwm_count) WRITE_HEATER_3(0);
#endif
#endif
@ -1524,11 +1524,11 @@ void Temperature::isr() {
if (slow_pwm_count == 0) {
SLOW_PWM_ROUTINE(0); // EXTRUDER 0
#if EXTRUDERS > 1
#if HOTENDS > 1
SLOW_PWM_ROUTINE(1); // EXTRUDER 1
#if EXTRUDERS > 2
#if HOTENDS > 2
SLOW_PWM_ROUTINE(2); // EXTRUDER 2
#if EXTRUDERS > 3
#if HOTENDS > 3
SLOW_PWM_ROUTINE(3); // EXTRUDER 3
#endif
#endif
@ -1540,11 +1540,11 @@ void Temperature::isr() {
} // slow_pwm_count == 0
PWM_OFF_ROUTINE(0); // EXTRUDER 0
#if EXTRUDERS > 1
#if HOTENDS > 1
PWM_OFF_ROUTINE(1); // EXTRUDER 1
#if EXTRUDERS > 2
#if HOTENDS > 2
PWM_OFF_ROUTINE(2); // EXTRUDER 2
#if EXTRUDERS > 3
#if HOTENDS > 3
PWM_OFF_ROUTINE(3); // EXTRUDER 3
#endif
#endif
@ -1589,11 +1589,11 @@ void Temperature::isr() {
// EXTRUDER 0
if (state_timer_heater_0 > 0) state_timer_heater_0--;
#if EXTRUDERS > 1 // EXTRUDER 1
#if HOTENDS > 1 // EXTRUDER 1
if (state_timer_heater_1 > 0) state_timer_heater_1--;
#if EXTRUDERS > 2 // EXTRUDER 2
#if HOTENDS > 2 // EXTRUDER 2
if (state_timer_heater_2 > 0) state_timer_heater_2--;
#if EXTRUDERS > 3 // EXTRUDER 3
#if HOTENDS > 3 // EXTRUDER 3
if (state_timer_heater_3 > 0) state_timer_heater_3--;
#endif
#endif
@ -1736,7 +1736,7 @@ void Temperature::isr() {
if (minttemp_raw[0] GE0 current_temperature_raw[0]) min_temp_error(0);
#endif
#if HAS_TEMP_1 && EXTRUDERS > 1
#if HAS_TEMP_1 && HOTENDS > 1
#if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP
#define GE1 <=
#else
@ -1746,7 +1746,7 @@ void Temperature::isr() {
if (minttemp_raw[1] GE1 current_temperature_raw[1]) min_temp_error(1);
#endif // TEMP_SENSOR_1
#if HAS_TEMP_2 && EXTRUDERS > 2
#if HAS_TEMP_2 && HOTENDS > 2
#if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP
#define GE2 <=
#else
@ -1756,7 +1756,7 @@ void Temperature::isr() {
if (minttemp_raw[2] GE2 current_temperature_raw[2]) min_temp_error(2);
#endif // TEMP_SENSOR_2
#if HAS_TEMP_3 && EXTRUDERS > 3
#if HAS_TEMP_3 && HOTENDS > 3
#if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP
#define GE3 <=
#else

@ -42,9 +42,9 @@ class Temperature {
public:
static int current_temperature_raw[EXTRUDERS];
static float current_temperature[EXTRUDERS];
static int target_temperature[EXTRUDERS];
static int current_temperature_raw[HOTENDS];
static float current_temperature[HOTENDS];
static int target_temperature[HOTENDS];
static int current_temperature_bed_raw;
static float current_temperature_bed;
@ -66,11 +66,11 @@ class Temperature {
#if ENABLED(PIDTEMP)
#if ENABLED(PID_PARAMS_PER_EXTRUDER)
#if ENABLED(PID_PARAMS_PER_HOTEND)
static float Kp[EXTRUDERS], Ki[EXTRUDERS], Kd[EXTRUDERS];
static float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS];
#if ENABLED(PID_ADD_EXTRUSION_RATE)
static float Kc[EXTRUDERS];
static float Kc[HOTENDS];
#endif
#define PID_PARAM(param, e) Temperature::param[e]
@ -82,7 +82,7 @@ class Temperature {
#endif
#define PID_PARAM(param, e) Temperature::param
#endif // PID_PARAMS_PER_EXTRUDER
#endif // PID_PARAMS_PER_HOTEND
// Apply the scale factors to the PID values
#define scalePID_i(i) ( (i) * PID_dT )
@ -101,8 +101,8 @@ class Temperature {
#endif
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
static int watch_target_temp[EXTRUDERS];
static millis_t watch_heater_next_ms[EXTRUDERS];
static int watch_target_temp[HOTENDS];
static millis_t watch_heater_next_ms[HOTENDS];
#endif
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_BED_TEMP_PERIOD > 0
@ -127,23 +127,23 @@ class Temperature {
static volatile bool temp_meas_ready;
#if ENABLED(PIDTEMP)
static float temp_iState[EXTRUDERS];
static float temp_dState[EXTRUDERS];
static float pTerm[EXTRUDERS];
static float iTerm[EXTRUDERS];
static float dTerm[EXTRUDERS];
static float temp_iState[HOTENDS];
static float temp_dState[HOTENDS];
static float pTerm[HOTENDS];
static float iTerm[HOTENDS];
static float dTerm[HOTENDS];
#if ENABLED(PID_ADD_EXTRUSION_RATE)
static float cTerm[EXTRUDERS];
static long last_position[EXTRUDERS];
static float cTerm[HOTENDS];
static long last_position[HOTENDS];
static long lpq[LPQ_MAX_LEN];
static int lpq_ptr;
#endif
static float pid_error[EXTRUDERS];
static float temp_iState_min[EXTRUDERS];
static float temp_iState_max[EXTRUDERS];
static bool pid_reset[EXTRUDERS];
static float pid_error[HOTENDS];
static float temp_iState_min[HOTENDS];
static float temp_iState_max[HOTENDS];
static bool pid_reset[HOTENDS];
#endif
#if ENABLED(PIDTEMPBED)
@ -163,10 +163,10 @@ class Temperature {
static unsigned long raw_temp_bed_value;
// Init min and max temp with extreme values to prevent false errors during startup
static int minttemp_raw[EXTRUDERS];
static int maxttemp_raw[EXTRUDERS];
static int minttemp[EXTRUDERS];
static int maxttemp[EXTRUDERS];
static int minttemp_raw[HOTENDS];
static int maxttemp_raw[HOTENDS];
static int minttemp[HOTENDS];
static int maxttemp[HOTENDS];
#ifdef BED_MINTEMP
static int bed_minttemp_raw;
@ -184,7 +184,7 @@ class Temperature {
static millis_t next_auto_fan_check_ms;
#endif
static unsigned char soft_pwm[EXTRUDERS];
static unsigned char soft_pwm[HOTENDS];
#if ENABLED(FAN_SOFT_PWM)
static unsigned char soft_pwm_fan[FAN_COUNT];
@ -230,15 +230,36 @@ class Temperature {
//inline so that there is no performance decrease.
//deg=degreeCelsius
static float degHotend(uint8_t extruder) { return current_temperature[extruder]; }
#if HOTENDS == 1
#define HOTEND_ARG 0
#else
#define HOTEND_ARG hotend
#endif
static float degHotend(uint8_t hotend) {
#if HOTENDS == 1
UNUSED(hotend);
#endif
return current_temperature[HOTEND_ARG];
}
static float degBed() { return current_temperature_bed; }
#if ENABLED(SHOW_TEMP_ADC_VALUES)
static float rawHotendTemp(uint8_t extruder) { return current_temperature_raw[extruder]; }
static float rawHotendTemp(uint8_t hotend) {
#if HOTENDS == 1
UNUSED(hotend);
#endif
return current_temperature_raw[HOTEND_ARG];
}
static float rawBedTemp() { return current_temperature_bed_raw; }
#endif
static float degTargetHotend(uint8_t extruder) { return target_temperature[extruder]; }
static float degTargetHotend(uint8_t hotend) {
#if HOTENDS == 1
UNUSED(hotend);
#endif
return target_temperature[HOTEND_ARG];
}
static float degTargetBed() { return target_temperature_bed; }
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
@ -249,10 +270,13 @@ class Temperature {
static void start_watching_bed();
#endif
static void setTargetHotend(const float& celsius, uint8_t extruder) {
target_temperature[extruder] = celsius;
static void setTargetHotend(const float& celsius, uint8_t hotend) {
#if HOTENDS == 1
UNUSED(hotend);
#endif
target_temperature[HOTEND_ARG] = celsius;
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
start_watching_heater(extruder);
start_watching_heater(HOTEND_ARG);
#endif
}
@ -263,10 +287,20 @@ class Temperature {
#endif
}
static bool isHeatingHotend(uint8_t extruder) { return target_temperature[extruder] > current_temperature[extruder]; }
static bool isHeatingHotend(uint8_t hotend) {
#if HOTENDS == 1
UNUSED(hotend);
#endif
return target_temperature[HOTEND_ARG] > current_temperature[HOTEND_ARG];
}
static bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; }
static bool isCoolingHotend(uint8_t extruder) { return target_temperature[extruder] < current_temperature[extruder]; }
static bool isCoolingHotend(uint8_t hotend) {
#if HOTENDS == 1
UNUSED(hotend);
#endif
return target_temperature[HOTEND_ARG] < current_temperature[HOTEND_ARG];
}
static bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; }
/**
@ -283,7 +317,7 @@ class Temperature {
* Perform auto-tuning for hotend or bed in response to M303
*/
#if HAS_PID_HEATING
static void PID_autotune(float temp, int extruder, int ncycles, bool set_result=false);
static void PID_autotune(float temp, int hotend, int ncycles, bool set_result=false);
#endif
/**
@ -362,8 +396,8 @@ class Temperature {
static void thermal_runaway_protection(TRState* state, millis_t* timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
static TRState thermal_runaway_state_machine[EXTRUDERS];
static millis_t thermal_runaway_timer[EXTRUDERS];
static TRState thermal_runaway_state_machine[HOTENDS];
static millis_t thermal_runaway_timer[HOTENDS];
#endif
#if HAS_THERMALLY_PROTECTED_BED

@ -593,28 +593,28 @@ void lcd_set_home_offsets() {
#if TEMP_SENSOR_0 != 0
void watch_temp_callback_E0() { thermalManager.start_watching_heater(0); }
#endif
#if EXTRUDERS > 1 && TEMP_SENSOR_1 != 0
#if HOTENDS > 1 && TEMP_SENSOR_1 != 0
void watch_temp_callback_E1() { thermalManager.start_watching_heater(1); }
#endif // EXTRUDERS > 1
#if EXTRUDERS > 2 && TEMP_SENSOR_2 != 0
#endif // HOTENDS > 1
#if HOTENDS > 2 && TEMP_SENSOR_2 != 0
void watch_temp_callback_E2() { thermalManager.start_watching_heater(2); }
#endif // EXTRUDERS > 2
#if EXTRUDERS > 3 && TEMP_SENSOR_3 != 0
#endif // HOTENDS > 2
#if HOTENDS > 3 && TEMP_SENSOR_3 != 0
void watch_temp_callback_E3() { thermalManager.start_watching_heater(3); }
#endif // EXTRUDERS > 3
#endif // HOTENDS > 3
#else
#if TEMP_SENSOR_0 != 0
void watch_temp_callback_E0() {}
#endif
#if EXTRUDERS > 1 && TEMP_SENSOR_1 != 0
#if HOTENDS > 1 && TEMP_SENSOR_1 != 0
void watch_temp_callback_E1() {}
#endif // EXTRUDERS > 1
#if EXTRUDERS > 2 && TEMP_SENSOR_2 != 0
#endif // HOTENDS > 1
#if HOTENDS > 2 && TEMP_SENSOR_2 != 0
void watch_temp_callback_E2() {}
#endif // EXTRUDERS > 2
#if EXTRUDERS > 3 && TEMP_SENSOR_3 != 0
#endif // HOTENDS > 2
#if HOTENDS > 3 && TEMP_SENSOR_3 != 0
void watch_temp_callback_E3() {}
#endif // EXTRUDERS > 3
#endif // HOTENDS > 3
#endif
#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
@ -654,28 +654,28 @@ static void lcd_tune_menu() {
// Nozzle:
// Nozzle [1-4]:
//
#if EXTRUDERS == 1
#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 //EXTRUDERS > 1
#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
#if EXTRUDERS > 2
#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
#if EXTRUDERS > 3
#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
#endif // EXTRUDERS > 3
#endif // EXTRUDERS > 2
#endif // EXTRUDERS > 1
#endif // HOTENDS > 3
#endif // HOTENDS > 2
#endif // HOTENDS > 1
//
// Bed:
@ -777,24 +777,24 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
#endif
#if EXTRUDERS > 1
#if HOTENDS > 1
void lcd_preheat_pla1() { _lcd_preheat(1, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
void lcd_preheat_abs1() { _lcd_preheat(1, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
#if EXTRUDERS > 2
#if HOTENDS > 2
void lcd_preheat_pla2() { _lcd_preheat(2, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
void lcd_preheat_abs2() { _lcd_preheat(2, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
#if EXTRUDERS > 3
#if HOTENDS > 3
void lcd_preheat_pla3() { _lcd_preheat(3, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
void lcd_preheat_abs3() { _lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
#endif
#endif
void lcd_preheat_pla0123() {
#if EXTRUDERS > 1
#if HOTENDS > 1
thermalManager.setTargetHotend(plaPreheatHotendTemp, 1);
#if EXTRUDERS > 2
#if HOTENDS > 2
thermalManager.setTargetHotend(plaPreheatHotendTemp, 2);
#if EXTRUDERS > 3
#if HOTENDS > 3
thermalManager.setTargetHotend(plaPreheatHotendTemp, 3);
#endif
#endif
@ -802,11 +802,11 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
lcd_preheat_pla0();
}
void lcd_preheat_abs0123() {
#if EXTRUDERS > 1
#if HOTENDS > 1
thermalManager.setTargetHotend(absPreheatHotendTemp, 1);
#if EXTRUDERS > 2
#if HOTENDS > 2
thermalManager.setTargetHotend(absPreheatHotendTemp, 2);
#if EXTRUDERS > 3
#if HOTENDS > 3
thermalManager.setTargetHotend(absPreheatHotendTemp, 3);
#endif
#endif
@ -814,7 +814,7 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
lcd_preheat_abs0();
}
#endif // EXTRUDERS > 1
#endif // HOTENDS > 1
#if TEMP_SENSOR_BED != 0
void lcd_preheat_pla_bedonly() { _lcd_preheat(0, 0, plaPreheatHPBTemp, plaPreheatFanSpeed); }
@ -826,14 +826,14 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
static void lcd_preheat_pla_menu() {
START_MENU();
MENU_ITEM(back, MSG_PREPARE);
#if EXTRUDERS == 1
#if HOTENDS == 1
MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla0);
#else
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H1, lcd_preheat_pla0);
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H2, lcd_preheat_pla1);
#if EXTRUDERS > 2
#if HOTENDS > 2
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H3, lcd_preheat_pla2);
#if EXTRUDERS > 3
#if HOTENDS > 3
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H4, lcd_preheat_pla3);
#endif
#endif
@ -848,14 +848,14 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
static void lcd_preheat_abs_menu() {
START_MENU();
MENU_ITEM(back, MSG_PREPARE);
#if EXTRUDERS == 1
#if HOTENDS == 1
MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs0);
#else
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H1, lcd_preheat_abs0);
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H2, lcd_preheat_abs1);
#if EXTRUDERS > 2
#if HOTENDS > 2
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H3, lcd_preheat_abs2);
#if EXTRUDERS > 3
#if HOTENDS > 3
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H4, lcd_preheat_abs3);
#endif
#endif
@ -1380,8 +1380,8 @@ static void lcd_control_menu() {
#if ENABLED(PID_AUTOTUNE_MENU)
#if ENABLED(PIDTEMP)
int autotune_temp[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(150);
const int heater_maxtemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP);
int autotune_temp[HOTENDS] = ARRAY_BY_HOTENDS1(150);
const int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP);
#endif
#if ENABLED(PIDTEMPBED)
@ -1409,14 +1409,14 @@ static void lcd_control_menu() {
// Helpers for editing PID Ki & Kd values
// grab the PID value out of the temp variable; scale it; then update the PID driver
void copy_and_scalePID_i(int e) {
#if DISABLED(PID_PARAMS_PER_EXTRUDER)
#if DISABLED(PID_PARAMS_PER_HOTEND)
UNUSED(e);
#endif
PID_PARAM(Ki, e) = scalePID_i(raw_Ki);
thermalManager.updatePID();
}
void copy_and_scalePID_d(int e) {
#if DISABLED(PID_PARAMS_PER_EXTRUDER)
#if DISABLED(PID_PARAMS_PER_HOTEND)
UNUSED(e);
#endif
PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
@ -1435,17 +1435,17 @@ static void lcd_control_menu() {
#endif
_PIDTEMP_FUNCTIONS(0);
#if ENABLED(PID_PARAMS_PER_EXTRUDER)
#if EXTRUDERS > 1
#if ENABLED(PID_PARAMS_PER_HOTEND)
#if HOTENDS > 1
_PIDTEMP_FUNCTIONS(1);
#if EXTRUDERS > 2
#if HOTENDS > 2
_PIDTEMP_FUNCTIONS(2);
#if EXTRUDERS > 3
#if HOTENDS > 3
_PIDTEMP_FUNCTIONS(3);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
#endif //PID_PARAMS_PER_EXTRUDER
#endif //HOTENDS > 3
#endif //HOTENDS > 2
#endif //HOTENDS > 1
#endif //PID_PARAMS_PER_HOTEND
#endif //PIDTEMP
@ -1466,28 +1466,28 @@ static void lcd_control_temperature_menu() {
// Nozzle:
// Nozzle [1-4]:
//
#if EXTRUDERS == 1
#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 //EXTRUDERS > 1
#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
#if EXTRUDERS > 2
#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
#if EXTRUDERS > 3
#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
#endif // EXTRUDERS > 3
#endif // EXTRUDERS > 2
#endif // EXTRUDERS > 1
#endif // HOTENDS > 3
#endif // HOTENDS > 2
#endif // HOTENDS > 1
//
// Bed:
@ -1558,18 +1558,18 @@ static void lcd_control_temperature_menu() {
#define PID_MENU_ITEMS(ELABEL, eindex) _PID_MENU_ITEMS(ELABEL, eindex)
#endif
#if ENABLED(PID_PARAMS_PER_EXTRUDER) && EXTRUDERS > 1
#if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
PID_MENU_ITEMS(MSG_E1, 0);
PID_MENU_ITEMS(MSG_E2, 1);
#if EXTRUDERS > 2
#if HOTENDS > 2
PID_MENU_ITEMS(MSG_E3, 2);
#if EXTRUDERS > 3
#if HOTENDS > 3
PID_MENU_ITEMS(MSG_E4, 3);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#else //!PID_PARAMS_PER_EXTRUDER || EXTRUDERS == 1
#endif //HOTENDS > 3
#endif //HOTENDS > 2
#else //!PID_PARAMS_PER_HOTEND || HOTENDS == 1
PID_MENU_ITEMS("", 0);
#endif //!PID_PARAMS_PER_EXTRUDER || EXTRUDERS == 1
#endif //!PID_PARAMS_PER_HOTEND || HOTENDS == 1
#endif //PIDTEMP

@ -638,10 +638,10 @@ static void lcd_implementation_status_screen() {
//
// Hotend 1 or Bed Temperature
//
#if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
#if HOTENDS > 1 || TEMP_SENSOR_BED != 0
lcd.setCursor(8, 0);
#if EXTRUDERS > 1
#if HOTENDS > 1
lcd.print(LCD_STR_THERMOMETER[0]);
LCD_TEMP_ONLY(thermalManager.degHotend(1), thermalManager.degTargetHotend(1));
#else
@ -649,7 +649,7 @@ static void lcd_implementation_status_screen() {
LCD_TEMP_ONLY(thermalManager.degBed(), thermalManager.degTargetBed());
#endif
#endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
#endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
#else // LCD_WIDTH >= 20
@ -661,15 +661,15 @@ static void lcd_implementation_status_screen() {
//
// Hotend 1 or Bed Temperature
//
#if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
#if HOTENDS > 1 || TEMP_SENSOR_BED != 0
lcd.setCursor(10, 0);
#if EXTRUDERS > 1
#if HOTENDS > 1
LCD_TEMP(thermalManager.degHotend(1), thermalManager.degTargetHotend(1), LCD_STR_THERMOMETER[0]);
#else
LCD_TEMP(thermalManager.degBed(), thermalManager.degTargetBed(), LCD_STR_BEDTEMP[0]);
#endif
#endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
#endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
#endif // LCD_WIDTH >= 20
@ -697,7 +697,7 @@ static void lcd_implementation_status_screen() {
lcd.setCursor(0, 1);
#if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0
#if HOTENDS > 1 && TEMP_SENSOR_BED != 0
// If we both have a 2nd extruder and a heated bed,
// show the heated bed temp on the left,
@ -717,7 +717,7 @@ static void lcd_implementation_status_screen() {
_draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
lcd.print(ftostr4sign(current_position[Y_AXIS]));
#endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
#endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
#endif // LCD_WIDTH >= 20
@ -943,7 +943,7 @@ void lcd_implementation_drawedit(const char* pstr, const char* value=NULL) {
) leds |= LED_C;
#endif // FAN_COUNT > 0
#if EXTRUDERS > 1
#if HOTENDS > 1
if (thermalManager.degTargetHotend(1) > 0) leds |= LED_C;
#endif

Loading…
Cancel
Save