From 4abb5bcbfdc260aed2af6cf4c5a8540bbd105082 Mon Sep 17 00:00:00 2001 From: MagoKimbra Date: Tue, 28 Jul 2015 19:34:46 +0200 Subject: [PATCH 1/4] Add option for SINGLENOZZLE In configuration.h add //#define SINGLENOZZLE When enable this option only hotend is set for more extruder... --- Marlin/Conditionals.h | 25 ++ Marlin/Configuration.h | 16 +- Marlin/Marlin_main.cpp | 72 +++--- Marlin/SanityCheck.h | 51 +--- Marlin/boards.h | 8 +- Marlin/configuration_store.cpp | 33 ++- Marlin/dogm_bitmaps.h | 4 +- Marlin/dogm_lcd_implementation.h | 6 +- Marlin/pins_RAMPS_13.h | 8 +- Marlin/temperature.cpp | 229 +++++++++--------- Marlin/temperature.h | 31 ++- Marlin/ultralcd.cpp | 58 ++--- .../ultralcd_implementation_hitachi_HD44780.h | 24 +- Marlin/ultralcd_st7920_u8glib_rrd.h | 7 +- 14 files changed, 283 insertions(+), 289 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index bed26bffdd55..9aab87411aa4 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -216,6 +216,16 @@ #define CONDITIONALS_H + /** + * SINGLENOZZLE + */ + #ifdef SINGLENOZZLE + #define HOTENDS 1 + #undef TEMP_SENSOR_1_AS_REDUNDANT + #else + #define HOTENDS EXTRUDERS + #endif + #include "pins.h" #ifndef USBCON @@ -408,6 +418,21 @@ #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1) + /** + * ARRAY_BY_HOTENDS based on HOTENDS + */ + #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) + /** * Shorthand for pin tests, used wherever needed */ diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 312ffd4ae896..c6207779aa8e 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -84,11 +84,15 @@ Here are some standard links for getting your machine calibrated: // :[1,2,3,4] #define EXTRUDERS 1 +// This is used for single nozzle and multiple extrusion configuration +// Uncomment below to enable (One Hotend) +//#define SINGLENOZZLE + // 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 @@ -182,9 +186,9 @@ Here are some standard links for getting your machine calibrated: // HEATER_BED_DUTY_CYCLE_DIVIDER intervals. //#define HEATER_BED_DUTY_CYCLE_DIVIDER 4 -// 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=I^2/R -//#define BED_WATTS (12.0*12.0/1.1) // P=I^2/R +// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all hotend) HOTEND_WATTS +//#define HOTEND_WATTS (12.0*12.0/6.7) // P=I^2/R +//#define BED_WATTS (12.0*12.0/1.1) // P=I^2/R //=========================================================================== //============================= PID Settings ================================ @@ -199,7 +203,7 @@ Here are some standard links for getting your machine calibrated: //#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 then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 0597e2c16e45..76729eb70fc5 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -297,17 +297,18 @@ bool target_direction; float z_endstop_adj = 0; #endif -// Extruder offsets -#if EXTRUDERS > 1 - #ifndef EXTRUDER_OFFSET_X - #define EXTRUDER_OFFSET_X { 0 } +// Hotend offset +#if HOTENDS > 1 + #ifndef DUAL_X_CARRIAGE + + #define HOTEND_OFFSET_X { 0 } #endif - #ifndef EXTRUDER_OFFSET_Y - #define EXTRUDER_OFFSET_Y { 0 } + #ifndef HOTEND_OFFSET_Y + #define HOTEND_OFFSET_Y { 0 } #endif - float extruder_offset[][EXTRUDERS] = { - EXTRUDER_OFFSET_X, - EXTRUDER_OFFSET_Y + float hotend_offset[][HOTENDS] = { + HOTEND_OFFSET_X, + HOTEND_OFFSET_Y #ifdef DUAL_X_CARRIAGE , { 0 } // supports offsets in XYZ plane #endif @@ -3361,6 +3362,10 @@ inline void gcode_M104() { if (setTargetedHotend(104)) return; if (marlin_debug_flags & DEBUG_DRYRUN) return; + #if HOTENDS == 1 + if (target_extruder != active_extruder) return; + #endif + if (code_seen('S')) { float temp = code_value(); setTargetHotend(temp, target_extruder); @@ -3461,6 +3466,10 @@ inline void gcode_M109() { if (setTargetedHotend(109)) return; if (marlin_debug_flags & DEBUG_DRYRUN) return; + #if HOTENDS == 1 + if (target_extruder != active_extruder) return; + #endif + LCD_MESSAGEPGM(MSG_HEATING); no_wait_for_cooling = code_seen('S'); @@ -4151,13 +4160,13 @@ inline void gcode_M206() { unknown_command_error(); return; } - for (int i=0; i 1 +#if HOTENDS > 1 /** * M218 - set hotend offset (in mm), T X Y @@ -4165,29 +4174,29 @@ inline void gcode_M206() { inline void gcode_M218() { if (setTargetedHotend(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(); #ifdef 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]); #ifdef 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) @@ -4314,7 +4323,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()); @@ -4324,7 +4333,7 @@ inline void gcode_M226() { updatePID(); SERIAL_PROTOCOL(MSG_OK); - #ifdef PID_PARAMS_PER_EXTRUDER + #ifdef PID_PARAMS_PER_HOTEND SERIAL_PROTOCOL(" e:"); // specify extruder in serial output SERIAL_PROTOCOL(e); #endif // PID_PARAMS_PER_EXTRUDER @@ -4845,7 +4854,7 @@ inline void gcode_M503() { float lastpos[NUM_AXIS], fr60 = feedrate / 60; - for (int i=0; i 1 + for (int i = X_AXIS; i <= Y_AXIS; i++) + current_position[i] += hotend_offset[i][tmp_extruder] - hotend_offset[i][active_extruder]; + #endif // HOTENDS > 1 // Set the new active extruder and position active_extruder = tmp_extruder; #endif // !DUAL_X_CARRIAGE @@ -5557,7 +5565,7 @@ void process_next_command() { break; #endif // FWRETRACT - #if EXTRUDERS > 1 + #if HOTENDS > 1 case 218: // M218 - set hotend offset (in mm), T X Y gcode_M218(); break; @@ -6380,8 +6388,8 @@ void plan_arc( float max_temp = 0.0; if (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, degHotend(cur_extruder)), degTargetHotend(cur_extruder)); + for (int8_t cur_hotend = 0; cur_hotend < HOTENDS; ++cur_hotend) + max_temp = max(max(max_temp, degHotend(cur_hotend)), degTargetHotend(cur_hotend)); #if HAS_TEMP_BED max_temp = max(max(max_temp, degTargetBed()), degBed()); #endif diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 867144c3e8a7..f0fae15489a9 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -281,58 +281,23 @@ #endif /** - * Test Heater, Temp Sensor, and Extruder Pins; Sensor Type must also be set. + * Test required HEATER defines */ - #if EXTRUDERS > 3 + #if HOTENDS > 3 #if !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. - #elif TEMP_SENSOR_3 == 0 - #error TEMP_SENSOR_3 is required with 4 EXTRUDERS. + #error HEATER_3_PIN not defined for this board #endif - #elif EXTRUDERS > 2 + #elif HOTENDS > 2 #if !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. - #elif TEMP_SENSOR_2 == 0 - #error TEMP_SENSOR_2 is required with 3 or more EXTRUDERS. + #error HEATER_2_PIN not defined for this board #endif - #elif EXTRUDERS > 1 - #if !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. - #endif - #endif - - #if EXTRUDERS > 1 || defined(HEATERS_PARALLEL) + #elif HOTENDS > 1 || defined(HEATERS_PARALLEL) #if !HAS_HEATER_1 - #error HEATER_1_PIN not defined for this board. + #error HEATER_1_PIN not defined for this board #endif #endif - - #if TEMP_SENSOR_1 == 0 - #if EXTRUDERS > 1 - #error TEMP_SENSOR_1 is required with 2 or more EXTRUDERS. - #elif ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) - #error TEMP_SENSOR_1 is required with TEMP_SENSOR_1_AS_REDUNDANT. - #endif - #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. + #error HEATER_0_PIN not defined for this board #endif /** diff --git a/Marlin/boards.h b/Marlin/boards.h index f6bbc9d67338..8d3549e73f65 100644 --- a/Marlin/boards.h +++ b/Marlin/boards.h @@ -10,10 +10,10 @@ #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 / 1.4 (Power outputs: Extruder, Fan, Bed) -#define BOARD_RAMPS_13_EEB 34 // RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed) -#define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Fan) -#define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Fan) +#define BOARD_RAMPS_13_EFB 33 // RAMPS 1.3 / 1.4 (Power outputs: Hotend, Fan, Bed) +#define BOARD_RAMPS_13_EEB 34 // RAMPS 1.3 / 1.4 (Power outputs: Hotend0, Hotend1, Bed) +#define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 / 1.4 (Power outputs: Hotend, Fan, Fan) +#define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 / 1.4 (Power outputs: Hotend0, Hotend1, Fan) #define BOARD_RAMPS_13_SF 38 // RAMPS 1.3 / 1.4 (Power outputs: Spindle, Controller Fan) #define BOARD_FELIX2 37 // Felix 2.0+ Electronics Board (RAMPS like) #define BOARD_RIGIDBOARD 42 // Invent-A-Part RigidBoard diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index 559cda013060..452487d612b0 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -205,7 +205,7 @@ void Config_StoreSettings() { for (int e = 0; e < 4; e++) { #ifdef 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)); @@ -371,9 +371,9 @@ void Config_RetrieveSettings() { EEPROM_READ_VAR(i, absPreheatFanSpeed); #ifdef PIDTEMP - for (int e = 0; e < 4; e++) { // 4 = max extruders currently supported by Marlin + for (int e = 0; e < 4; e++) { // 4 = max hotends 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)); @@ -526,8 +526,8 @@ void Config_ResetDefault() { #endif #ifdef PIDTEMP - #ifdef PID_PARAMS_PER_EXTRUDER - for (int e = 0; e < EXTRUDERS; e++) + #ifdef PID_PARAMS_PER_HOTEND + for (int e = 0; e < HOTENDS; e++) #else int e = 0; // only need to write once #endif @@ -565,16 +565,11 @@ void Config_ResetDefault() { #endif volumetric_enabled = false; - filament_size[0] = DEFAULT_NOMINAL_FILAMENT_DIA; - #if EXTRUDERS > 1 - filament_size[1] = DEFAULT_NOMINAL_FILAMENT_DIA; - #if EXTRUDERS > 2 - filament_size[2] = DEFAULT_NOMINAL_FILAMENT_DIA; - #if EXTRUDERS > 3 - filament_size[3] = DEFAULT_NOMINAL_FILAMENT_DIA; - #endif - #endif - #endif + + for (short i = 0; i < EXTRUDERS; i++) { + filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA; + } + calculate_volumetric_multipliers(); SERIAL_ECHO_START; @@ -742,9 +737,9 @@ void Config_PrintSettings(bool forReplay) { SERIAL_ECHOLNPGM("PID settings:"); } #ifdef 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", (unsigned long)i); SERIAL_ECHOPAIR(" P", PID_PARAM(Kp, i)); @@ -757,8 +752,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 diff --git a/Marlin/dogm_bitmaps.h b/Marlin/dogm_bitmaps.h index 8c8356785a2f..7cb18bbaa37e 100644 --- a/Marlin/dogm_bitmaps.h +++ b/Marlin/dogm_bitmaps.h @@ -82,7 +82,7 @@ // When only one extruder is selected, the "1" on the symbol will not // be displayed. -#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 @@ -132,7 +132,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 diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 3fa9c33b1f09..be2b4ad8cff3 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -307,11 +307,11 @@ static void lcd_implementation_status_screen() { } #endif - // Extruders - for (int i=0; i= EXTRUDERS + if (hotend >= HOTENDS #if !HAS_TEMP_BED - || extruder < 0 + || hotend < 0 #endif ) { SERIAL_ECHOLN(MSG_PID_BAD_EXTRUDER_NUM); @@ -221,10 +222,10 @@ void PID_autotune(float temp, int extruder, int ncycles) { disable_all_heaters(); // switch off all heaters. - 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; // PID Tuning loop for (;;) { @@ -234,7 +235,7 @@ void PID_autotune(float temp, int extruder, int ncycles) { if (temp_meas_ready) { // temp sample ready updateTemperaturesFromRawValues(); - input = (extruder<0)?current_temperature_bed:current_temperature[extruder]; + input = (hotend<0)?current_temperature_bed:current_temperature[hotend]; max = max(max, input); min = min(min, input); @@ -249,10 +250,10 @@ void PID_autotune(float temp, int extruder, int ncycles) { if (heating && input > temp) { if (ms > t2 + 5000) { heating = false; - 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; t1 = ms; t_high = t1 - t2; max = temp; @@ -265,7 +266,7 @@ void PID_autotune(float temp, int extruder, int ncycles) { t2 = ms; t_low = t2 - t1; if (cycles > 0) { - long max_pow = extruder < 0 ? MAX_BED_POWER : PID_MAX; + long max_pow = hotend < 0 ? MAX_BED_POWER : PID_MAX; bias += (d*(t_high - t_low))/(t_low + t_high); bias = constrain(bias, 20, max_pow - 20); d = (bias > max_pow / 2) ? max_pow - 1 - bias : bias; @@ -304,10 +305,10 @@ void PID_autotune(float temp, int extruder, int ncycles) { */ } } - 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; cycles++; min = temp; } @@ -321,12 +322,12 @@ void PID_autotune(float temp, int extruder, int ncycles) { // Every 2 seconds... if (ms > temp_ms + 2000) { int p; - if (extruder < 0) { + if (hotend < 0) { p = soft_pwm_bed; SERIAL_PROTOCOLPGM(MSG_B); } else { - p = soft_pwm[extruder]; + p = soft_pwm[hotend]; SERIAL_PROTOCOLPGM(MSG_T); } @@ -343,7 +344,7 @@ void PID_autotune(float temp, int extruder, int ncycles) { } if (cycles > ncycles) { SERIAL_PROTOCOLLNPGM(MSG_PID_AUTOTUNE_FINISHED); - const char *estring = extruder < 0 ? "bed" : ""; + const char *estring = hotend < 0 ? "bed" : ""; SERIAL_PROTOCOLPGM("#define DEFAULT_"); SERIAL_PROTOCOL(estring); SERIAL_PROTOCOLPGM("Kp "); SERIAL_PROTOCOLLN(Kp); SERIAL_PROTOCOLPGM("#define DEFAULT_"); SERIAL_PROTOCOL(estring); SERIAL_PROTOCOLPGM("Ki "); SERIAL_PROTOCOLLN(Ki); SERIAL_PROTOCOLPGM("#define DEFAULT_"); SERIAL_PROTOCOL(estring); SERIAL_PROTOCOLPGM("Kd "); SERIAL_PROTOCOLLN(Kd); @@ -355,7 +356,7 @@ void PID_autotune(float temp, int extruder, int ncycles) { void updatePID() { #ifdef 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); } #endif @@ -418,7 +419,7 @@ void checkExtruderAutoFans() { fanState |= 8; } #endif - + // update extruder auto fan states #if HAS_AUTO_FAN_0 setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, (fanState & 1) != 0); @@ -602,8 +603,8 @@ void 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++) { #ifdef 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); @@ -638,21 +639,21 @@ void manage_heater() { } #endif - } // Extruders Loop + } // Hotends Loop #if HAS_AUTO_FAN if (ms > next_auto_fan_check_ms) { // only need to check fan state very infrequently checkExtruderAutoFans(); next_auto_fan_check_ms = ms + 2500; } - #endif + #endif // Control the extruder rate based on the width sensor #ifdef FILAMENT_SENSOR if (filament_sensor) { meas_shift_index = delay_index1 - meas_delay_cm; if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1; //loop around buffer if needed - + // Get the delayed info and add 100 to reconstitute to a percent of // the nominal filament diameter then square it to get an area meas_shift_index = constrain(meas_shift_index, 0, MAX_MEASUREMENT_DELAY); @@ -718,7 +719,7 @@ static float analog2temp(int raw, uint8_t e) { SERIAL_ERRORLNPGM(MSG_INVALID_EXTRUDER_NUM); kill(PSTR(MSG_KILLED)); return 0.0; - } + } #ifdef HEATER_0_USES_MAX6675 if (e == 0) return 0.25 * raw; @@ -756,8 +757,8 @@ static float analog2tempBed(int raw) { for (i = 1; i < BEDTEMPTABLE_LEN; i++) { if (PGM_RD_W(BEDTEMPTABLE[i][0]) > raw) { - celsius = PGM_RD_W(BEDTEMPTABLE[i-1][1]) + - (raw - PGM_RD_W(BEDTEMPTABLE[i-1][0])) * + celsius = PGM_RD_W(BEDTEMPTABLE[i-1][1]) + + (raw - PGM_RD_W(BEDTEMPTABLE[i-1][0])) * (float)(PGM_RD_W(BEDTEMPTABLE[i][1]) - PGM_RD_W(BEDTEMPTABLE[i-1][1])) / (float)(PGM_RD_W(BEDTEMPTABLE[i][0]) - PGM_RD_W(BEDTEMPTABLE[i-1][0])); break; @@ -781,7 +782,7 @@ static void updateTemperaturesFromRawValues() { #ifdef 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] = analog2temp(current_temperature_raw[e], e); } current_temperature_bed = analog2tempBed(current_temperature_bed_raw); @@ -814,7 +815,7 @@ static void updateTemperaturesFromRawValues() { if (temp < MEASURED_LOWER_LIMIT) temp = filament_width_nominal; //assume sensor cut out else if (temp > MEASURED_UPPER_LIMIT) temp = MEASURED_UPPER_LIMIT; return filament_width_nominal / temp * 100; - } + } #endif @@ -829,10 +830,10 @@ void tp_init() { MCUCR=BIT(JTD); MCUCR=BIT(JTD); #endif - - // Finish init of mult extruder arrays - for (int e = 0; e < EXTRUDERS; e++) { - // populate with the first value + + // Finish init of mult hotends arrays + for (int e = 0; e < HOTENDS; e++) { + // populate with the first value maxttemp[e] = maxttemp[0]; #ifdef PIDTEMP temp_iState_min[e] = 0.0; @@ -841,7 +842,7 @@ void tp_init() { #ifdef PIDTEMPBED temp_iState_min_bed = 0.0; temp_iState_max_bed = PID_BED_INTEGRAL_DRIVE_MAX / bedKi; - #endif //PIDTEMPBED + #endif // PIDTEMPBED } #if HAS_HEATER_0 @@ -858,7 +859,7 @@ void tp_init() { #endif #if HAS_HEATER_BED SET_OUTPUT(HEATER_BED_PIN); - #endif + #endif #if HAS_FAN SET_OUTPUT(FAN_PIN); #ifdef FAST_PWM_FAN @@ -879,10 +880,10 @@ void tp_init() { pinMode(SS_PIN, OUTPUT); digitalWrite(SS_PIN, HIGH); #endif - + OUT_WRITE(MAX6675_SS,HIGH); - #endif //HEATER_0_USES_MAX6675 + #endif // HEATER_0_USES_MAX6675 #ifdef DIDR2 #define ANALOG_SELECT(pin) do{ if (pin < 8) DIDR0 |= BIT(pin); else DIDR2 |= BIT(pin - 8); }while(0) @@ -932,7 +933,7 @@ void tp_init() { // Interleave temperature interrupt with millies interrupt OCR0B = 128; TIMSK0 |= BIT(OCIE0B); - + // Wait for temperature measurement to settle delay(250); @@ -959,30 +960,30 @@ void tp_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) { @@ -1001,7 +1002,7 @@ void tp_init() { bed_maxttemp_raw += OVERSAMPLENR; #endif } - #endif //BED_MAXTEMP + #endif // BED_MAXTEMP } #ifdef THERMAL_PROTECTION_HOTENDS @@ -1024,8 +1025,7 @@ void tp_init() { void thermal_runaway_protection(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; SERIAL_ECHOPGM("Thermal Thermal Runaway Running. Heater ID: "); @@ -1041,7 +1041,7 @@ void tp_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) @@ -1079,7 +1079,7 @@ void tp_init() { #endif // THERMAL_PROTECTION_HOTENDS || THERMAL_PROTECTION_BED void disable_all_heaters() { - for (int i=0; i 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 @@ -1126,7 +1126,7 @@ void disable_all_heaters() { if (ms < next_max6675_ms) return max6675_temp; - + next_max6675_ms = ms + MAX6675_HEAT_INTERVAL; max6675_temp = 0; @@ -1171,7 +1171,7 @@ void disable_all_heaters() { return max6675_temp; } -#endif //HEATER_0_USES_MAX6675 +#endif // HEATER_0_USES_MAX6675 /** * Stages in the ISR loop @@ -1224,7 +1224,6 @@ static void set_current_temp_raw() { * - Step the babysteps value for each axis towards 0 */ ISR(TIMER0_COMPB_vect) { - static unsigned char temp_count = 0; static TempState temp_state = StartupDelay; static unsigned char pwm_count = BIT(SOFT_PWM_SCALE); @@ -1242,11 +1241,11 @@ ISR(TIMER0_COMPB_vect) { // Statics per heater ISR_STATICS(0); - #if (EXTRUDERS > 1) || defined(HEATERS_PARALLEL) + #if (HOTENDS > 1) || defined(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 @@ -1258,7 +1257,7 @@ ISR(TIMER0_COMPB_vect) { #if HAS_FILAMENT_SENSOR static unsigned long raw_filwidth_value = 0; #endif - + #ifndef SLOW_PWM_HEATERS /** * standard PWM modulation @@ -1270,13 +1269,13 @@ ISR(TIMER0_COMPB_vect) { } 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 @@ -1294,11 +1293,11 @@ ISR(TIMER0_COMPB_vect) { } 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 @@ -1355,13 +1354,13 @@ ISR(TIMER0_COMPB_vect) { if (slow_pwm_count == 0) { - SLOW_PWM_ROUTINE(0); // EXTRUDER 0 - #if EXTRUDERS > 1 - SLOW_PWM_ROUTINE(1); // EXTRUDER 1 - #if EXTRUDERS > 2 - SLOW_PWM_ROUTINE(2); // EXTRUDER 2 - #if EXTRUDERS > 3 - SLOW_PWM_ROUTINE(3); // EXTRUDER 3 + SLOW_PWM_ROUTINE(0); // HOTEND 0 + #if HOTENDS > 1 + SLOW_PWM_ROUTINE(1); // HOTEND 1 + #if HOTENDS > 2 + SLOW_PWM_ROUTINE(2); // HOTEND 2 + #if HOTENDS > 3 + SLOW_PWM_ROUTINE(3); // HOTEND 3 #endif #endif #endif @@ -1371,13 +1370,13 @@ ISR(TIMER0_COMPB_vect) { } // slow_pwm_count == 0 - PWM_OFF_ROUTINE(0); // EXTRUDER 0 - #if EXTRUDERS > 1 - PWM_OFF_ROUTINE(1); // EXTRUDER 1 - #if EXTRUDERS > 2 - PWM_OFF_ROUTINE(2); // EXTRUDER 2 - #if EXTRUDERS > 3 - PWM_OFF_ROUTINE(3); // EXTRUDER 3 + PWM_OFF_ROUTINE(0); // HOTEND 0 + #if HOTENDS > 1 + PWM_OFF_ROUTINE(1); // HOTEND 1 + #if HOTENDS > 2 + PWM_OFF_ROUTINE(2); // HOTEND 2 + #if HOTENDS > 3 + PWM_OFF_ROUTINE(3); // HOTEND 3 #endif #endif #endif @@ -1391,7 +1390,7 @@ ISR(TIMER0_COMPB_vect) { WRITE_FAN(soft_pwm_fan > 0 ? 1 : 0); } if (soft_pwm_fan < pwm_count) WRITE_FAN(0); - #endif //FAN_SOFT_PWM + #endif // FAN_SOFT_PWM pwm_count += BIT(SOFT_PWM_SCALE); pwm_count &= 0x7f; @@ -1401,13 +1400,13 @@ ISR(TIMER0_COMPB_vect) { slow_pwm_count++; slow_pwm_count &= 0x7f; - // EXTRUDER 0 - if (state_timer_heater_0 > 0) state_timer_heater_0--; - #if EXTRUDERS > 1 // EXTRUDER 1 + // HOTEND 0 + if (state_timer_heater_0 > 0) state_timer_heater_0--; + #if HOTENDS > 1 // HOTEND 1 if (state_timer_heater_1 > 0) state_timer_heater_1--; - #if EXTRUDERS > 2 // EXTRUDER 2 + #if HOTENDS > 2 // HOTEND 2 if (state_timer_heater_2 > 0) state_timer_heater_2--; - #if EXTRUDERS > 3 // EXTRUDER 3 + #if HOTENDS > 3 // HOTEND 3 if (state_timer_heater_3 > 0) state_timer_heater_3--; #endif #endif @@ -1550,7 +1549,7 @@ ISR(TIMER0_COMPB_vect) { 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 @@ -1560,7 +1559,7 @@ ISR(TIMER0_COMPB_vect) { 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 @@ -1570,7 +1569,7 @@ ISR(TIMER0_COMPB_vect) { 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 diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 6ab35d52e9c3..3ccb566f088a 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -60,7 +60,7 @@ extern float current_temperature_bed; #ifdef PIDTEMP #ifdef PID_PARAMS_PER_EXTRUDER - extern float Kp[EXTRUDERS], Ki[EXTRUDERS], Kd[EXTRUDERS], Kc[EXTRUDERS]; // one param per extruder + extern float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS], Kc[HOTENDS]; // one param per extruder #define PID_PARAM(param,e) param[e] // use macro to point to array value #else extern float Kp, Ki, Kd, Kc; // one param per extruder - saves 20 or 36 bytes of ram (inc array pointer) @@ -84,34 +84,39 @@ extern float current_temperature_bed; //high level conversion routines, for use outside of temperature.cpp //inline so that there is no performance decrease. //deg=degreeCelsius +#if HOTENDS <= 1 + #define HOTEND_ARG 0 +#else + #define HOTEND_ARG hotend +#endif -FORCE_INLINE float degHotend(uint8_t extruder) { return current_temperature[extruder]; } +FORCE_INLINE float degHotend(uint8_t hotend) { return current_temperature[HOTEND_ARG]; } FORCE_INLINE float degBed() { return current_temperature_bed; } #ifdef SHOW_TEMP_ADC_VALUES - FORCE_INLINE float rawHotendTemp(uint8_t extruder) { return current_temperature_raw[extruder]; } + FORCE_INLINE float rawHotendTemp(uint8_t hotend) { return current_temperature_raw[HOTEND_ARG]; } FORCE_INLINE float rawBedTemp() { return current_temperature_bed_raw; } #endif -FORCE_INLINE float degTargetHotend(uint8_t extruder) { return target_temperature[extruder]; } +FORCE_INLINE float degTargetHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG]; } FORCE_INLINE float degTargetBed() { return target_temperature_bed; } #ifdef THERMAL_PROTECTION_HOTENDS void start_watching_heater(int e=0); #endif -FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) { - target_temperature[extruder] = celsius; +FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t hotend) { + target_temperature[HOTEND_ARG] = celsius; #ifdef THERMAL_PROTECTION_HOTENDS - start_watching_heater(extruder); + start_watching_heater(HOTEND_ARG); #endif } FORCE_INLINE void setTargetBed(const float &celsius) { target_temperature_bed = celsius; } -FORCE_INLINE bool isHeatingHotend(uint8_t extruder) { return target_temperature[extruder] > current_temperature[extruder]; } +FORCE_INLINE bool isHeatingHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG] > current_temperature[HOTEND_ARG]; } FORCE_INLINE bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; } -FORCE_INLINE bool isCoolingHotend(uint8_t extruder) { return target_temperature[extruder] < current_temperature[extruder]; } +FORCE_INLINE bool isCoolingHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG] < current_temperature[HOTEND_ARG]; } FORCE_INLINE bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; } #define HOTEND_ROUTINES(NR) \ @@ -121,17 +126,17 @@ FORCE_INLINE bool isCoolingBed() { return target_temperature_bed < current_tempe FORCE_INLINE bool isHeatingHotend##NR() { return isHeatingHotend(NR); } \ FORCE_INLINE bool isCoolingHotend##NR() { return isCoolingHotend(NR); } HOTEND_ROUTINES(0); -#if EXTRUDERS > 1 +#if HOTENDS > 1 HOTEND_ROUTINES(1); #else #define setTargetHotend1(c) do{}while(0) #endif -#if EXTRUDERS > 2 +#if HOTENDS > 2 HOTEND_ROUTINES(2); #else #define setTargetHotend2(c) do{}while(0) #endif -#if EXTRUDERS > 3 +#if HOTENDS > 3 HOTEND_ROUTINES(3); #else #define setTargetHotend3(c) do{}while(0) @@ -141,7 +146,7 @@ int getHeaterPower(int heater); void disable_all_heaters(); void updatePID(); -void PID_autotune(float temp, int extruder, int ncycles); +void PID_autotune(float temp, int hotend, int ncycles); void setExtruderAutoFanState(int pin, bool state); void checkExtruderAutoFans(); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 30c174031adf..ae7959c08b60 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -849,20 +849,20 @@ static void lcd_control_menu() { } void copy_and_scalePID_i_E1() { copy_and_scalePID_i(0); } void copy_and_scalePID_d_E1() { copy_and_scalePID_d(0); } - #ifdef PID_PARAMS_PER_EXTRUDER - #if EXTRUDERS > 1 + #ifdef PID_PARAMS_PER_HOTEND + #if HOTENDS > 1 void copy_and_scalePID_i_E2() { copy_and_scalePID_i(1); } void copy_and_scalePID_d_E2() { copy_and_scalePID_d(1); } - #if EXTRUDERS > 2 + #if HOTENDS > 2 void copy_and_scalePID_i_E3() { copy_and_scalePID_i(2); } void copy_and_scalePID_d_E3() { copy_and_scalePID_d(2); } - #if EXTRUDERS > 3 + #if HOTENDS > 3 void copy_and_scalePID_i_E4() { copy_and_scalePID_i(3); } void copy_and_scalePID_d_E4() { copy_and_scalePID_d(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 @@ -885,21 +885,15 @@ static void lcd_control_temperature_menu() { #if TEMP_SENSOR_0 != 0 MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15); #endif - #if EXTRUDERS > 1 - #if TEMP_SENSOR_1 != 0 - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE MSG_N2, &target_temperature[1], 0, HEATER_1_MAXTEMP - 15); - #endif - #if EXTRUDERS > 2 - #if TEMP_SENSOR_2 != 0 - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE MSG_N3, &target_temperature[2], 0, HEATER_2_MAXTEMP - 15); - #endif - #if EXTRUDERS > 3 - #if TEMP_SENSOR_3 != 0 - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE MSG_N4, &target_temperature[3], 0, HEATER_3_MAXTEMP - 15); - #endif - #endif // EXTRUDERS > 3 - #endif // EXTRUDERS > 2 - #endif // EXTRUDERS > 1 + #if HOTENDS > 1 && TEMP_SENSOR_1 != 0 + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE MSG_N2, &target_temperature[1], 0, HEATER_1_MAXTEMP - 15); + #if HOTENDS > 2 && TEMP_SENSOR_2 != 0 + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE MSG_N3, &target_temperature[2], 0, HEATER_2_MAXTEMP - 15); + #if HOTENDS > 3 && TEMP_SENSOR_3 != 0 + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE MSG_N4, &target_temperature[3], 0, HEATER_3_MAXTEMP - 15); + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 // // Bed @@ -937,8 +931,8 @@ static void lcd_control_temperature_menu() { #ifdef PID_ADD_EXTRUSION_RATE MENU_ITEM_EDIT(float3, MSG_PID_C, &PID_PARAM(Kc,0), 1, 9990); #endif//PID_ADD_EXTRUSION_RATE - #ifdef PID_PARAMS_PER_EXTRUDER - #if EXTRUDERS > 1 + #ifdef PID_PARAMS_PER_HOTEND + #if HOTENDS > 1 // set up temp variables - undo the default scaling raw_Ki = unscalePID_i(PID_PARAM(Ki,1)); raw_Kd = unscalePID_d(PID_PARAM(Kd,1)); @@ -950,7 +944,7 @@ static void lcd_control_temperature_menu() { MENU_ITEM_EDIT(float3, MSG_PID_C MSG_E2, &PID_PARAM(Kc,1), 1, 9990); #endif//PID_ADD_EXTRUSION_RATE - #if EXTRUDERS > 2 + #if HOTENDS > 2 // set up temp variables - undo the default scaling raw_Ki = unscalePID_i(PID_PARAM(Ki,2)); raw_Kd = unscalePID_d(PID_PARAM(Kd,2)); @@ -962,7 +956,7 @@ static void lcd_control_temperature_menu() { MENU_ITEM_EDIT(float3, MSG_PID_C MSG_E3, &PID_PARAM(Kc,2), 1, 9990); #endif//PID_ADD_EXTRUSION_RATE - #if EXTRUDERS > 3 + #if HOTENDS > 3 // set up temp variables - undo the default scaling raw_Ki = unscalePID_i(PID_PARAM(Ki,3)); raw_Kd = unscalePID_d(PID_PARAM(Kd,3)); @@ -973,11 +967,11 @@ static void lcd_control_temperature_menu() { #ifdef PID_ADD_EXTRUSION_RATE MENU_ITEM_EDIT(float3, MSG_PID_C MSG_E4, &PID_PARAM(Kc,3), 1, 9990); #endif//PID_ADD_EXTRUSION_RATE - #endif//EXTRUDERS > 3 - #endif//EXTRUDERS > 2 - #endif//EXTRUDERS > 1 - #endif //PID_PARAMS_PER_EXTRUDER - #endif//PIDTEMP + #endif// HOTENDS > 3 + #endif// HOTENDS > 2 + #endif// HOTENDS > 1 + #endif // PID_PARAMS_PER_HOTEND + #endif// PIDTEMP // // Preheat PLA conf diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index ab4fb101fc84..398925a10d94 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -456,10 +456,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(degHotend(1), degTargetHotend(1)); #else @@ -467,7 +467,7 @@ static void lcd_implementation_status_screen() { LCD_TEMP_ONLY(degBed(), degTargetBed()); #endif - #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 + #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0 #else // LCD_WIDTH >= 20 @@ -479,15 +479,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(degHotend(1), degTargetHotend(1), LCD_STR_THERMOMETER[0]); #else LCD_TEMP(degBed(), degTargetBed(), LCD_STR_BEDTEMP[0]); #endif - #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 + #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0 #endif // LCD_WIDTH >= 20 @@ -506,18 +506,18 @@ static void lcd_implementation_status_screen() { lcd.print(itostr3(card.percentDone())); else lcd_printPGM(PSTR("---")); - lcd.print('%'); + lcd.print('%'); #endif // SDSUPPORT #else // LCD_WIDTH >= 20 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, + // If we both have a 2nd hotend and a heated bed, // show the heated bed temp on the left, - // since the first line is filled with extruder temps + // since the first line is filled with hotend temps LCD_TEMP(degBed(), degTargetBed(), LCD_STR_BEDTEMP[0]); #else @@ -534,7 +534,7 @@ static void lcd_implementation_status_screen() { else lcd_printPGM(PSTR("---")); - #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 + #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0 #endif // LCD_WIDTH >= 20 @@ -740,7 +740,7 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const if (target_temperature_bed > 0) leds |= LED_A; if (target_temperature[0] > 0) leds |= LED_B; if (fanSpeed) leds |= LED_C; - #if EXTRUDERS > 1 + #if HOTENDS > 1 if (target_temperature[1] > 0) leds |= LED_C; #endif if (leds != ledsprev) { diff --git a/Marlin/ultralcd_st7920_u8glib_rrd.h b/Marlin/ultralcd_st7920_u8glib_rrd.h index 3181ea2657f1..8c5227ef314d 100644 --- a/Marlin/ultralcd_st7920_u8glib_rrd.h +++ b/Marlin/ultralcd_st7920_u8glib_rrd.h @@ -24,8 +24,7 @@ static void ST7920_SWSPI_SND_8BIT(uint8_t val) { uint8_t i; - for( i=0; i<8; i++ ) - { + for( i = 0; i < 8; i++ ) { WRITE(ST7920_CLK_PIN,0); #if F_CPU == 20000000 __asm__("nop\n\t"); @@ -64,12 +63,12 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo ST7920_WRITE_BYTE(0x01); //clear CGRAM ram u8g_Delay(15); //delay for CGRAM clear ST7920_WRITE_BYTE(0x3E); //extended mode + GDRAM active - for(y=0;y Date: Tue, 28 Jul 2015 19:38:49 +0200 Subject: [PATCH 2/4] Fix --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 76729eb70fc5..a78788c69fa1 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4336,7 +4336,7 @@ inline void gcode_M226() { #ifdef PID_PARAMS_PER_HOTEND SERIAL_PROTOCOL(" e:"); // specify extruder in serial output SERIAL_PROTOCOL(e); - #endif // PID_PARAMS_PER_EXTRUDER + #endif // PID_PARAMS_PER_HOTEND SERIAL_PROTOCOL(" p:"); SERIAL_PROTOCOL(PID_PARAM(Kp, e)); SERIAL_PROTOCOL(" i:"); From 4aec4a6015b21a6c90e83f8401e360880d4f8b75 Mon Sep 17 00:00:00 2001 From: MagoKimbra Date: Wed, 29 Jul 2015 08:40:38 +0200 Subject: [PATCH 3/4] Update SanityCheck.h --- Marlin/SanityCheck.h | 52 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index f0fae15489a9..84a7f639d9db 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -281,23 +281,65 @@ #endif /** - * Test required HEATER defines + * Test Heater, Temp Sensor; Sensor Type must also be set. */ #if HOTENDS > 3 #if !HAS_HEATER_3 - #error HEATER_3_PIN not defined for this board + #error HEATER_3_PIN not defined for this board. + #elif !PIN_EXISTS(TEMP_3) + #error TEMP_3_PIN not defined for this board. #endif #elif HOTENDS > 2 #if !HAS_HEATER_2 - #error HEATER_2_PIN not defined for this board + #error HEATER_2_PIN not defined for this board. + #elif !PIN_EXISTS(TEMP_2) + #error TEMP_2_PIN not defined for this board. #endif - #elif HOTENDS > 1 || defined(HEATERS_PARALLEL) + #elif HOTENDS > 1 + #if !PIN_EXISTS(TEMP_1) + #error TEMP_1_PIN not defined for this board. + #endif + #endif + + #if HOTENDS > 1 || defined(HEATERS_PARALLEL) #if !HAS_HEATER_1 - #error HEATER_1_PIN not defined for this board + #error HEATER_1_PIN not defined for this board. + #endif + #endif + + #if TEMP_SENSOR_1 == 0 + #if HOTENDS > 1 + #error TEMP_SENSOR_1 is required with 2 or more EXTRUDERS. + #elif ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) + #error TEMP_SENSOR_1 is required with TEMP_SENSOR_1_AS_REDUNDANT. #endif #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. + #endif + + /** + * 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 + + #if !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. #endif /** From 9bf884c7d9f361847de8a31ce5a4b1a6ef8e3b5d Mon Sep 17 00:00:00 2001 From: MagoKimbra Date: Wed, 29 Jul 2015 09:24:12 +0200 Subject: [PATCH 4/4] Fix HOTEND_WATTS --- Marlin/Marlin_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index a78788c69fa1..ed5d7f306968 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3410,8 +3410,8 @@ inline void gcode_M105() { #endif SERIAL_PROTOCOLPGM(" @:"); - #ifdef EXTRUDER_WATTS - SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(target_extruder))/127); + #ifdef HOTEND_WATTS + SERIAL_PROTOCOL((HOTEND_WATTS * getHeaterPower(target_extruder))/127); SERIAL_PROTOCOLCHAR('W'); #else SERIAL_PROTOCOL(getHeaterPower(target_extruder));