From f0c36f170143cb0342af1eb45c50388c355d81c6 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Sun, 2 Jul 2017 21:53:08 +0200 Subject: [PATCH] LIN_ADV --- Firmware/Configuration.h | 3 +- Firmware/ConfigurationStore.cpp | 38 -- Firmware/Configuration_adv.h | 53 ++- Firmware/Configuration_prusa.h | 419 ++++++++++++++++++ Firmware/Marlin.h | 4 + Firmware/Marlin_main.cpp | 183 ++++---- Firmware/langtool.pl | 3 +- Firmware/language_all.cpp | 196 ++++++-- Firmware/language_all.h | 27 +- Firmware/language_cz.h | 11 +- Firmware/language_de.h | 26 +- Firmware/language_en.h | 21 +- Firmware/language_es.h | 11 +- Firmware/language_it.h | 9 + Firmware/language_nl.h | 24 +- Firmware/language_pl.h | 11 +- Firmware/le.sh | 29 ++ Firmware/mesh_bed_calibration.cpp | 337 +++++++++----- Firmware/mesh_bed_calibration.h | 12 +- Firmware/pins.h | 2 - Firmware/planner.cpp | 95 ++-- Firmware/planner.h | 21 +- Firmware/stepper.cpp | 340 +++++--------- Firmware/stepper.h | 33 +- Firmware/stepper_indirection.h | 119 ----- Firmware/ultralcd.cpp | 293 ++++++++++-- Firmware/ultralcd.h | 9 +- .../variants/1_75mm_MK1-RAMBo10a-E3Dv6full.h | 404 +++++++++++++++++ .../variants/1_75mm_MK1-RAMBo13a-E3Dv6full.h | 404 +++++++++++++++++ ...5mm_MK2-MultiMaterial-RAMBo10a-E3Dv6full.h | 401 +++++++++++++++++ ...5mm_MK2-MultiMaterial-RAMBo13a-E3Dv6full.h | 403 +++++++++++++++++ .../variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 44 -- 32 files changed, 3130 insertions(+), 855 deletions(-) create mode 100644 Firmware/Configuration_prusa.h create mode 100644 Firmware/le.sh delete mode 100644 Firmware/stepper_indirection.h create mode 100644 Firmware/variants/1_75mm_MK1-RAMBo10a-E3Dv6full.h create mode 100644 Firmware/variants/1_75mm_MK1-RAMBo13a-E3Dv6full.h create mode 100644 Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo10a-E3Dv6full.h create mode 100644 Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo13a-E3Dv6full.h diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index f1fd9dfd2..cb77e4d91 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -5,11 +5,10 @@ #include "Configuration_prusa.h" // Firmware version -#define FW_version "3.0.11-L01" +#define FW_version "3.0.12-RC2" #define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC_LEN 10 - // The total size of the EEPROM is // 4096 for the Atmega2560 #define EEPROM_TOP 4096 diff --git a/Firmware/ConfigurationStore.cpp b/Firmware/ConfigurationStore.cpp index 989dcb2a0..f7f64094c 100644 --- a/Firmware/ConfigurationStore.cpp +++ b/Firmware/ConfigurationStore.cpp @@ -124,19 +124,6 @@ void Config_StoreSettings() EEPROM_WRITE_VAR(i, filament_size[2]); #endif #endif -// - // Linear Advance - // - - #if defined(LIN_ADVANCE) - EEPROM_WRITE_VAR(i, extruder_advance_k); - EEPROM_WRITE_VAR(i, advance_ed_ratio); - #else - dummy = 0.0f; - EEPROM_WRITE_VAR(i, dummy); - EEPROM_WRITE_VAR(i, dummy); - #endif - /*MYSERIAL.print("Top address used:\n"); MYSERIAL.print(i); MYSERIAL.print("\n"); @@ -272,14 +259,6 @@ void Config_PrintSettings() SERIAL_ECHOLNPGM("Filament settings: Disabled"); } #endif - - #if defined(LIN_ADVANCE) - SERIAL_ECHO_START; - SERIAL_ECHOLNPGM("Linear Advance:"); - SERIAL_ECHOPAIR(" M900 K", extruder_advance_k); - SERIAL_ECHOPAIR(" R", advance_ed_ratio); - SERIAL_ECHO('\n'); - #endif } #endif @@ -370,18 +349,6 @@ void Config_RetrieveSettings() #endif calculate_volumetric_multipliers(); // Call updatePID (similar to when we have processed M301) - // - // Linear Advance - // - - #if defined(LIN_ADVANCE) - EEPROM_READ_VAR(i, extruder_advance_k); - EEPROM_READ_VAR(i, advance_ed_ratio); - #else - EEPROM_READ_VAR(i, dummy); - EEPROM_READ_VAR(i, dummy); - #endif - updatePID(); SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Stored settings retrieved"); @@ -465,11 +432,6 @@ void Config_ResetDefault() #endif #endif calculate_volumetric_multipliers(); - -#if defined(LIN_ADVANCE) - extruder_advance_k = LIN_ADVANCE_K; - advance_ed_ratio = LIN_ADVANCE_E_D_RATIO; -#endif SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded"); diff --git a/Firmware/Configuration_adv.h b/Firmware/Configuration_adv.h index 54e74ba0a..4936de47c 100644 --- a/Firmware/Configuration_adv.h +++ b/Firmware/Configuration_adv.h @@ -265,24 +265,45 @@ #endif #endif -// extruder advance constant (s2/mm3) -// -// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2 -// -// Hooke's law says: force = k * distance -// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant -// so: v ^ 2 is proportional to number of steps we advance the extruder -//#define ADVANCE +/** + * Implementation of linear pressure control + * + * Assumption: advance = k * (delta velocity) + * K=0 means advance disabled. + * See Marlin documentation for calibration instructions. + */ +#define LIN_ADVANCE -#ifdef ADVANCE - #define EXTRUDER_ADVANCE_K .006 +#ifdef LIN_ADVANCE + #define LIN_ADVANCE_K 0 //Try around 45 for PLA, around 25 for ABS. - #define D_FILAMENT 1.75 - #define STEPS_MM_E 174.6 - #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) - #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA) - -#endif // ADVANCE + /** + * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. + * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. + * While this is harmless for normal printing (the fluid nature of the filament will + * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. + * + * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio + * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures + * if the slicer is using variable widths or layer heights within one print! + * + * This option sets the default E:D ratio at startup. Use `M900` to override this value. + * + * Example: `M900 W0.4 H0.2 D1.75`, where: + * - W is the extrusion width in mm + * - H is the layer height in mm + * - D is the filament diameter in mm + * + * Example: `M900 R0.0458` to set the ratio directly. + * + * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. + * + * Slic3r (including Prusa Slic3r) produces Gcode compatible with the automatic mode. + * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. + */ + #define LIN_ADVANCE_E_D_RATIO 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) + // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 +#endif // Arc interpretation settings: #define MM_PER_ARC_SEGMENT 1 diff --git a/Firmware/Configuration_prusa.h b/Firmware/Configuration_prusa.h new file mode 100644 index 000000000..474d2e9e1 --- /dev/null +++ b/Firmware/Configuration_prusa.h @@ -0,0 +1,419 @@ +#ifndef CONFIGURATION_PRUSA_H +#define CONFIGURATION_PRUSA_H + +/*------------------------------------ +GENERAL SETTINGS +*------------------------------------*/ + +// Printer revision +#define FILAMENT_SIZE "1_75mm_MK2" +#define NOZZLE_TYPE "E3Dv6full" + +// Developer flag +#define DEVELOPER + +// Printer name +#define CUSTOM_MENDEL_NAME "Prusa i3 MK2" + +// Electronics +#define MOTHERBOARD BOARD_RAMBO_MINI_1_3 + +// Prusa Single extruder multiple material suport +//#define SNMM + +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + + +/*------------------------------------ +AXIS SETTINGS +*------------------------------------*/ + +// Steps per unit {X,Y,Z,E} +#ifdef SNMM +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,140} +#else +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,161.3} +#endif + + +// Endstop inverting +const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. + +// Home position +#define MANUAL_X_HOME_POS 0 +#define MANUAL_Y_HOME_POS -2.2 +#define MANUAL_Z_HOME_POS 0.15 + +// Travel limits after homing +#define X_MAX_POS 250 +#define X_MIN_POS 0 +#define Y_MAX_POS 210 +#define Y_MIN_POS -2.2 +#define Z_MAX_POS 210 +#define Z_MIN_POS 0.15 + +// Canceled home position +#define X_CANCEL_POS 50 +#define Y_CANCEL_POS 190 + +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + +#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) + +#define DEFAULT_MAX_FEEDRATE {500, 500, 12, 120} // (mm/sec) +#define DEFAULT_MAX_ACCELERATION {9000,9000,500,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. + +#define DEFAULT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for retracts + + +#define MANUAL_FEEDRATE {3000, 3000, 1000, 100} // set the speeds for manual moves (mm/min) + +#define Z_AXIS_ALWAYS_ON 1 + +/*------------------------------------ +EXTRUDER SETTINGS +*------------------------------------*/ + +// Mintemps +#define HEATER_0_MINTEMP 15 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define BED_MINTEMP 15 + +// Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else +#define HEATER_0_MAXTEMP 305 +#endif +#define HEATER_1_MAXTEMP 305 +#define HEATER_2_MAXTEMP 305 +#define BED_MAXTEMP 150 + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else +// Define PID constants for extruder +//#define DEFAULT_Kp 40.925 //orig +//#define DEFAULT_Ki 4.875 //orig +//#define DEFAULT_Kd 86.085 //orig + +#define DEFAULT_Kp 22.39 //205C +#define DEFAULT_Ki 1.98 //205C +#define DEFAULT_Kd 63.27 //205C + +//#define DEFAULT_Kp 23.68 //255C +//#define DEFAULT_Ki 1.98 //255C +//#define DEFAULT_Kd 70.80 //255C +#endif + +// Extrude mintemp +#define EXTRUDE_MINTEMP 130 + +// Extruder cooling fans +#define EXTRUDER_0_AUTO_FAN_PIN 8 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed + + + + + + +#ifdef SNMM +//#define BOWDEN_LENGTH 408 +#define BOWDEN_LENGTH 433 //default total length for filament fast loading part; max length for extrusion is 465 mm!; this length can be adjusted in service menu +#define FIL_LOAD_LENGTH 102 //length for loading filament into the nozzle +#define FIL_COOLING 10 //length for cooling moves +#define E_MOTOR_LOW_CURRENT 350 // current for PRUSAY code +#define E_MOTOR_HIGH_CURRENT 700 //current for unloading filament, stop print, PRUSAY ramming +#endif //SNMM + +//#define DIS //for measuring bed heigth and PINDa detection heigth relative to auto home point, experimental function + + +/*------------------------------------ +CHANGE FILAMENT SETTINGS +*------------------------------------*/ + +// Filament change configuration +#define FILAMENTCHANGEENABLE +#ifdef FILAMENTCHANGEENABLE +#define FILAMENTCHANGE_XPOS 0 +#define FILAMENTCHANGE_YPOS -2.2 +#define FILAMENTCHANGE_ZADD 20 +#define FILAMENTCHANGE_FIRSTRETRACT -2 +#define FILAMENTCHANGE_FINALRETRACT -80 + +#define FILAMENTCHANGE_FIRSTFEED 70 +#define FILAMENTCHANGE_FINALFEED 50 +#define FILAMENTCHANGE_RECFEED 5 + +#define FILAMENTCHANGE_XYFEED 50 +#define FILAMENTCHANGE_EFEED 20 +#define FILAMENTCHANGE_RFEED 400 +#define FILAMENTCHANGE_EXFEED 2 +#define FILAMENTCHANGE_ZFEED 15 + +#endif + +/*------------------------------------ +ADDITIONAL FEATURES SETTINGS +*------------------------------------*/ + +// Define Prusa filament runout sensor +#define FILAMENT_RUNOUT_SUPPORT + +#ifdef FILAMENT_RUNOUT_SUPPORT +#define FILAMENT_RUNOUT_SENSOR 1 +#endif + +// temperature runaway +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 + +#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 +#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 + +/*------------------------------------ +MOTOR CURRENT SETTINGS +*------------------------------------*/ + +// Motor Current setting for BIG RAMBo +#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +#define DIGIPOT_MOTOR_CURRENT_LOUD {135,135,135,135,135} + +// Motor Current settings for RAMBo mini PWM value = MotorCurrentSetting * 255 / range +#if MOTHERBOARD == 102 || MOTHERBOARD == 302 +#define MOTOR_CURRENT_PWM_RANGE 2000 +#define DEFAULT_PWM_MOTOR_CURRENT {270, 830, 450} // {XY,Z,E} +#define DEFAULT_PWM_MOTOR_CURRENT_LOUD {540, 830, 500} // {XY,Z,E} +#endif + +/*------------------------------------ +BED SETTINGS +*------------------------------------*/ + +// Define Mesh Bed Leveling system to enable it +#define MESH_BED_LEVELING +#ifdef MESH_BED_LEVELING + +#define MBL_Z_STEP 0.01 + +// Mesh definitions +#define MESH_MIN_X 35 +#define MESH_MAX_X 238 +#define MESH_MIN_Y 6 +#define MESH_MAX_Y 202 + +// Mesh upsample definition +#define MESH_NUM_X_POINTS 7 +#define MESH_NUM_Y_POINTS 7 +// Mesh measure definition +#define MESH_MEAS_NUM_X_POINTS 3 +#define MESH_MEAS_NUM_Y_POINTS 3 + +#define MESH_HOME_Z_CALIB 0.2 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. + +#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right +#define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind +#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) +#endif + +// Bed Temperature Control +// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis +// +// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. +// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating. +// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. +// If your configuration is significantly different than this and you don't understand the issues involved, you probably +// shouldn't use bed PID until someone else verifies your hardware works. +// If this is enabled, find your own PID constants below. +#define PIDTEMPBED +// +//#define BED_LIMIT_SWITCHING + +// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option. +// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis) +// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did, +// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED) +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +// Bed temperature compensation settings +#define BED_OFFSET 10 +#define BED_OFFSET_START 40 +#define BED_OFFSET_CENTER 50 + + +#ifdef PIDTEMPBED +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else +//#define DEFAULT_bedKp 126.13 //orig +//#define DEFAULT_bedKi 4.30 //orig +//#define DEFAULT_bedKd 924.76 //orig + +#define DEFAULT_bedKp 59.24 //55C +#define DEFAULT_bedKi 2.62 //55C +#define DEFAULT_bedKd 334.88 //55C + +//#define DEFAULT_bedKp 107.61 //100C +//#define DEFAULT_bedKi 4.7 //100C +//#define DEFAULT_bedKd 609.26 //100C +#endif + +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from pidautotune +// #define DEFAULT_bedKp 97.1 +// #define DEFAULT_bedKi 1.41 +// #define DEFAULT_bedKd 1675.16 + +// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + + +/*----------------------------------- +PREHEAT SETTINGS +*------------------------------------*/ + +#define PLA_PREHEAT_HOTEND_TEMP 215 +#define PLA_PREHEAT_HPB_TEMP 55 +#define PLA_PREHEAT_FAN_SPEED 0 + +#define ABS_PREHEAT_HOTEND_TEMP 255 +#define ABS_PREHEAT_HPB_TEMP 100 +#define ABS_PREHEAT_FAN_SPEED 0 + +#define HIPS_PREHEAT_HOTEND_TEMP 220 +#define HIPS_PREHEAT_HPB_TEMP 100 +#define HIPS_PREHEAT_FAN_SPEED 0 + +#define PP_PREHEAT_HOTEND_TEMP 254 +#define PP_PREHEAT_HPB_TEMP 100 +#define PP_PREHEAT_FAN_SPEED 0 + +#define PET_PREHEAT_HOTEND_TEMP 240 +#define PET_PREHEAT_HPB_TEMP 90 +#define PET_PREHEAT_FAN_SPEED 0 + +#define FLEX_PREHEAT_HOTEND_TEMP 230 +#define FLEX_PREHEAT_HPB_TEMP 50 +#define FLEX_PREHEAT_FAN_SPEED 0 + +/*------------------------------------ +THERMISTORS SETTINGS +*------------------------------------*/ + +// +//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table +// +//// Temperature sensor settings: +// -2 is thermocouple with MAX6675 (only for sensor 0) +// -1 is thermocouple with AD595 +// 0 is not used +// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) +// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) +// 3 is Mendel-parts thermistor (4.7k pullup) +// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! +// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) +// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) +// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) +// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) +// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) +// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) +// 10 is 100k RS thermistor 198-961 (4.7k pullup) +// 11 is 100k beta 3950 1% thermistor (4.7k pullup) +// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 20 is the PT100 circuit found in the Ultimainboard V2.x +// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 +// +// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k +// (but gives greater accuracy and more stable PID) +// 51 is 100k thermistor - EPCOS (1k pullup) +// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) +// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) +// +// 1047 is Pt1000 with 4k7 pullup +// 1010 is Pt1000 with 1k pullup (non standard) +// 147 is Pt100 with 4k7 pullup +// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier +// 110 is Pt100 with 1k pullup (non standard) + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 148 +#else +#define TEMP_SENSOR_0 5 +#endif +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 148 +#else +#define TEMP_SENSOR_BED 1 +#endif + +#define STACK_GUARD_TEST_VALUE 0xA2A2 + +#define MAX_BED_TEMP_CALIBRATION 50 +#define MAX_HOTEND_TEMP_CALIBRATION 50 + +#define MAX_E_STEPS_PER_UNIT 250 +#define MIN_E_STEPS_PER_UNIT 100 + +#define Z_BABYSTEP_MIN -3999 +#define Z_BABYSTEP_MAX 0 + +#define PINDA_PREHEAT_X 70 +#define PINDA_PREHEAT_Y -3 +#define PINDA_PREHEAT_Z 1 +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + +#define PING_TIME 60 //time in s +#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes +#define PING_ALLERT_PERIOD 60 //time in s + +#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release + +#define DEFAULT_PID_TEMP 210 +#define DEFAULT_PID_BED_TEMP 55 + +#ifdef SNMM +#define DEFAULT_RETRACTION 4 //used for PINDA temp calibration and pause print +#else +#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print +#endif +#endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index c0af3f07f..e17768518 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -299,6 +299,7 @@ extern unsigned int heating_status_counter; extern bool custom_message; extern unsigned int custom_message_type; extern unsigned int custom_message_state; +extern char snmm_filaments_used; extern unsigned long PingTime; @@ -323,6 +324,9 @@ extern unsigned long start_pause_print; extern bool mesh_bed_leveling_flag; extern bool mesh_bed_run_from_menu; +extern float distance_from_min[3]; +extern float angleDiff; + extern void calculate_volumetric_multipliers(); // Similar to the default Arduino delay function, diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index fcfae087e..a7fa31a44 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -75,10 +75,6 @@ #define VERSION_STRING "1.0.2" -#ifdef AUTOMATIC_CURRENT_CONTROL - bool auto_current_control = 0; -#endif - #include "ultralcd.h" @@ -97,7 +93,6 @@ // PRUSA CODES // P F - Returns FW versions // P R - Returns revision of printer -// P Y - Starts filament allignment process for multicolor // G0 -> G1 // G1 - Coordinated Movement X Y Z E @@ -204,6 +199,7 @@ // M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) // M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] // M605 - Set dual x-carriage movement mode: S [ X R ] +// M900 - Set LIN_ADVANCE options, if enabled. See Configuration_adv.h for details. // M907 - Set digital trimpot motor current using axis codes. // M908 - Control digital trimpot directly. // M350 - Set microstepping mode. @@ -212,7 +208,6 @@ // M928 - Start SD logging (M928 filename.g) - ended by M29 // M999 - Restart after being stopped by error -// M900 - Set and/or Get advance K factor and WH/D ratio (Requires LIN_ADVANCE) //Stepper Movement Variables //=========================================================================== @@ -291,6 +286,10 @@ bool custom_message; bool loading_flag = false; unsigned int custom_message_type; unsigned int custom_message_state; +char snmm_filaments_used = 0; + +float distance_from_min[3]; +float angleDiff; bool volumetric_enabled = false; float filament_size[EXTRUDERS] = { DEFAULT_NOMINAL_FILAMENT_DIA @@ -1603,22 +1602,6 @@ void get_command() #endif //SDSUPPORT } -#define WITHIN(V,L,H) ((V) >= (L) && (V) <= (H)) -#define NUMERIC(a) WITHIN(a, '0', '9') -#define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-') - -static char *current_command, // The command currently being executed - *current_command_args, // The address where arguments begin - *seen_pointer; // Set by code_seen(), used by the code_value functions - -inline bool code_has_value() { - int i = 1; - char c = seen_pointer[i]; - while (c == ' ') c = seen_pointer[++i]; - if (c == '-' || c == '+') c = seen_pointer[++i]; - if (c == '.') c = seen_pointer[++i]; - return NUMERIC(c); -} // Return True if a character was found static inline bool code_seen(char code) { return (strchr_pointer = strchr(CMDBUFFER_CURRENT_STRING, code)) != NULL; } @@ -1627,7 +1610,15 @@ static inline float code_value() { return strtod(strchr_pointer+1, NULL); static inline long code_value_long() { return strtol(strchr_pointer+1, NULL, 10); } static inline int16_t code_value_short() { return int16_t(strtol(strchr_pointer+1, NULL, 10)); }; static inline uint8_t code_value_uint8() { return uint8_t(strtol(strchr_pointer+1, NULL, 10)); }; -static inline bool code_value_bool() { return !code_has_value() || code_value_uint8() > 0; } + +static inline float code_value_float() { + char* e = strchr(strchr_pointer, 'E'); + if (!e) return strtod(strchr_pointer + 1, NULL); + *e = 0; + float ret = strtod(strchr_pointer + 1, NULL); + *e = 'E'; + return ret; +} #define DEFINE_PGM_READ_ANY(type, reader) \ static inline type pgm_read_any(const type *p) \ @@ -1814,6 +1805,39 @@ static float probe_pt(float x, float y, float z_before) { #endif // #ifdef ENABLE_AUTO_BED_LEVELING +#ifdef LIN_ADVANCE + /** + * M900: Set and/or Get advance K factor and WH/D ratio + * + * K Set advance K factor + * R Set ratio directly (overrides WH/D) + * W H D Set ratio from WH/D + */ + inline void gcode_M900() { + st_synchronize(); + + const float newK = code_seen('K') ? code_value_float() : -1; + if (newK >= 0) extruder_advance_k = newK; + + float newR = code_seen('R') ? code_value_float() : -1; + if (newR < 0) { + const float newD = code_seen('D') ? code_value_float() : -1, + newW = code_seen('W') ? code_value_float() : -1, + newH = code_seen('H') ? code_value_float() : -1; + if (newD >= 0 && newW >= 0 && newH >= 0) + newR = newD ? (newW * newH) / (sq(newD * 0.5) * M_PI) : 0; + } + if (newR >= 0) advance_ed_ratio = newR; + + SERIAL_ECHO_START; + SERIAL_ECHOPGM("Advance K="); + SERIAL_ECHOLN(extruder_advance_k); + SERIAL_ECHOPGM(" E/D="); + const float ratio = advance_ed_ratio; + if (ratio) SERIAL_ECHOLN(ratio); else SERIAL_ECHOLNPGM("Auto"); + } +#endif // LIN_ADVANCE + void homeaxis(int axis) { #define HOMEAXIS_DO(LETTER) \ ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1)) @@ -2026,7 +2050,13 @@ void process_commands() float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD; int8_t SilentMode; #endif - if(code_seen("PRUSA")){ + if (code_seen("M117")) { //moved to highest priority place to be able to to print strings which includes "G", "PRUSA" and "^" + starpos = (strchr(strchr_pointer + 5, '*')); + if (starpos != NULL) + *(starpos) = '\0'; + lcd_setstatus(strchr_pointer + 5); + } + else if(code_seen("PRUSA")){ if (code_seen("Ping")) { //PRUSA Ping if (farm_mode) { PingTime = millis(); @@ -2316,12 +2346,11 @@ void process_commands() prepare_arc_move(false); } break; - case 4: // G4 dwell - LCD_MESSAGERPGM(MSG_DWELL); + case 4: // G4 dwell codenum = 0; if(code_seen('P')) codenum = code_value(); // milliseconds to wait if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait - + if(codenum != 0) LCD_MESSAGERPGM(MSG_DWELL); st_synchronize(); codenum += millis(); // keep track of when we started waiting previous_millis_cmd = millis(); @@ -2448,7 +2477,7 @@ void process_commands() plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder); st_synchronize(); #endif // defined (Z_RAISE_BEFORE_HOMING) && (Z_RAISE_BEFORE_HOMING > 0) - #ifdef MESH_BED_LEVELING // If Mesh bed leveling, moxve X&Y to safe position for home + #if (defined(MESH_BED_LEVELING) && !defined(MK1BP)) // If Mesh bed leveling, moxve X&Y to safe position for home if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] )) { homeaxis(X_AXIS); @@ -2554,7 +2583,7 @@ void process_commands() // and correct the current_position to match the transformed coordinate system. world2machine_update_current(); -#ifdef MESH_BED_LEVELING +#if (defined(MESH_BED_LEVELING) && !defined(MK1BP)) if (code_seen(axis_codes[X_AXIS]) || code_seen(axis_codes[Y_AXIS]) || code_seen('W') || code_seen(axis_codes[Z_AXIS])) { } @@ -2771,7 +2800,7 @@ void process_commands() clean_up_after_endstop_move(); } break; - + case 75: { @@ -2944,6 +2973,9 @@ void process_commands() */ case 80: +#ifdef MK1BP + break; +#endif //MK1BP case_G80: { mesh_bed_leveling_flag = true; @@ -3672,14 +3704,15 @@ void process_commands() calibration_status_store(CALIBRATION_STATUS_ASSEMBLED); eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0); // Complete XYZ calibration. - BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level); - uint8_t point_too_far_mask = 0; - clean_up_after_endstop_move(); + uint8_t point_too_far_mask = 0; + BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level, point_too_far_mask); + clean_up_after_endstop_move(); // Print head up. current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], homing_feedrate[Z_AXIS]/40, active_extruder); st_synchronize(); if (result >= 0) { + point_too_far_mask = 0; // Second half: The fine adjustment. // Let the planner use the uncorrected coordinates. mbl.reset(); @@ -4318,6 +4351,7 @@ Sigma_Exit: #endif } } + snmm_filaments_used = 0; break; case 85: // M85 if(code_seen('S')) { @@ -4357,12 +4391,12 @@ Sigma_Exit: SERIAL_PROTOCOLRPGM(MSG_M115_REPORT); } break; - case 117: // M117 display message +/* case 117: // M117 display message starpos = (strchr(strchr_pointer + 5,'*')); if(starpos!=NULL) *(starpos)='\0'; lcd_setstatus(strchr_pointer + 5); - break; + break;*/ case 114: // M114 SERIAL_PROTOCOLPGM("X:"); SERIAL_PROTOCOL(current_position[X_AXIS]); @@ -4468,7 +4502,7 @@ Sigma_Exit: tmp_extruder = active_extruder; if(code_seen('T')) { tmp_extruder = code_value(); - if(tmp_extruder >= EXTRUDERS) { + if(tmp_extruder >= EXTRUDERS) { SERIAL_ECHO_START; SERIAL_ECHO(MSG_M200_INVALID_EXTRUDER); break; @@ -5357,34 +5391,13 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp if(lcd_commands_type == 0) lcd_commands_type = LCD_COMMAND_LONG_PAUSE_RESUME; } break; - - case 900: { - - st_synchronize(); - - const float newK = code_seen('K') ? code_value() : -1; - if (newK >= 0) extruder_advance_k = newK; - - float newR = code_seen('R') ? code_value() : -1; - if (newR < 0) { - const float newD = code_seen('D') ? code_value() : -1, - newW = code_seen('W') ? code_value() : -1, - newH = code_seen('H') ? code_value() : -1; - if (newD >= 0 && newW >= 0 && newH >= 0) - newR = newD ? (newW * newH) / (sq(newD * 0.5) * M_PI) : 0; - } - if (newR >= 0) advance_ed_ratio = newR; - - SERIAL_ECHO_START; - SERIAL_ECHOPAIR("Advance K=", extruder_advance_k); - SERIAL_ECHOPGM(" E/D="); - const float ratio = advance_ed_ratio; - if (ratio) SERIAL_ECHO(ratio); else SERIAL_ECHOPGM("Auto"); - SERIAL_ECHO('\n'); - - } - break; + #ifdef LIN_ADVANCE + case 900: // M900: Set LIN_ADVANCE options. + gcode_M900(); + break; + #endif + case 907: // M907 Set digital trimpot motor current using axis codes. { #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1 @@ -5485,13 +5498,19 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp case 702: { #ifdef SNMM - extr_unload_all(); + if (code_seen('U')) { + extr_unload_used(); //unload all filaments which were used in current print + } + else if (code_seen('C')) { + extr_unload(); //unload just current filament + } + else { + extr_unload_all(); //unload all filaments + } #else custom_message = true; custom_message_type = 2; lcd_setstatuspgm(MSG_UNLOADING_FILAMENT); - current_position[E_AXIS] += 3; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); current_position[E_AXIS] -= 80; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 7000 / 60, active_extruder); st_synchronize(); @@ -5518,13 +5537,24 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp int index; for (index = 1; *(strchr_pointer + index) == ' ' || *(strchr_pointer + index) == '\t'; index++); - if (*(strchr_pointer + index) < '0' || *(strchr_pointer + index) > '9') { + if ((*(strchr_pointer + index) < '0' || *(strchr_pointer + index) > '9') && *(strchr_pointer + index) != '?') { SERIAL_ECHOLNPGM("Invalid T code."); } else { - tmp_extruder = code_value(); + if (*(strchr_pointer + index) == '?') { + tmp_extruder = choose_extruder_menu(); + } + else { + tmp_extruder = code_value(); + } + snmm_filaments_used |= (1 << tmp_extruder); //for stop print #ifdef SNMM - snmm_extruder = tmp_extruder; + #ifdef LIN_ADVANCE + if (snmm_extruder != tmp_extruder) + clear_current_adv_vars(); //Check if the selected extruder is not the active one and reset LIN_ADVANCE variables if so. + #endif + + snmm_extruder = tmp_extruder; st_synchronize(); delay(100); @@ -5535,8 +5565,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp pinMode(E_MUX0_PIN, OUTPUT); pinMode(E_MUX1_PIN, OUTPUT); - pinMode(E_MUX2_PIN, OUTPUT); - + delay(100); SERIAL_ECHO_START; SERIAL_ECHO("T:"); @@ -5545,26 +5574,22 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp case 1: WRITE(E_MUX0_PIN, HIGH); WRITE(E_MUX1_PIN, LOW); - WRITE(E_MUX2_PIN, LOW); - + break; case 2: WRITE(E_MUX0_PIN, LOW); WRITE(E_MUX1_PIN, HIGH); - WRITE(E_MUX2_PIN, LOW); - + break; case 3: WRITE(E_MUX0_PIN, HIGH); WRITE(E_MUX1_PIN, HIGH); - WRITE(E_MUX2_PIN, LOW); - + break; default: WRITE(E_MUX0_PIN, LOW); WRITE(E_MUX1_PIN, LOW); - WRITE(E_MUX2_PIN, LOW); - + break; } delay(100); diff --git a/Firmware/langtool.pl b/Firmware/langtool.pl index c482d5d95..1c9f1cb93 100644 --- a/Firmware/langtool.pl +++ b/Firmware/langtool.pl @@ -180,6 +180,7 @@ print $fh < // Language indices into their particular symbol tables. END ; @@ -242,7 +243,7 @@ $filename = 'language_all.cpp'; open($fh, '>', $filename) or die "Could not open file '$filename' $!"; print $fh <<'END' -#include + #include "Configuration_prusa.h" #include "language_all.h" diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 19f5b7812..a7877f17c 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -1,4 +1,4 @@ -#include + #include "Configuration_prusa.h" #include "language_all.h" @@ -27,9 +27,21 @@ const char * const MSG_ADJUSTZ_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_ADJUSTZ_NL }; -const char MSG_ADVANCE_K_EN[] PROGMEM = "Advance K"; -const char * const MSG_ADVANCE_K_LANG_TABLE[1] PROGMEM = { - MSG_ADVANCE_K_EN +const char MSG_ALL_EN[] PROGMEM = "All"; +const char MSG_ALL_CZ[] PROGMEM = "Vse"; +const char MSG_ALL_IT[] PROGMEM = "Tutti"; +const char MSG_ALL_ES[] PROGMEM = "Todos"; +const char MSG_ALL_PL[] PROGMEM = "Wszystko"; +const char MSG_ALL_DE[] PROGMEM = "Alle"; +const char MSG_ALL_NL[] PROGMEM = "Alle"; +const char * const MSG_ALL_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_ALL_EN, + MSG_ALL_CZ, + MSG_ALL_IT, + MSG_ALL_ES, + MSG_ALL_PL, + MSG_ALL_DE, + MSG_ALL_NL }; const char MSG_AMAX_EN[] PROGMEM = "Amax "; @@ -666,6 +678,23 @@ const char * const MSG_CHANGING_FILAMENT_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_CHANGING_FILAMENT_NL }; +const char MSG_CHOOSE_EXTRUDER_EN[] PROGMEM = "Choose extruder:"; +const char MSG_CHOOSE_EXTRUDER_CZ[] PROGMEM = "Vyberte extruder:"; +const char MSG_CHOOSE_EXTRUDER_IT[] PROGMEM = "Seleziona estrusore:"; +const char MSG_CHOOSE_EXTRUDER_ES[] PROGMEM = "Elegir extrusor:"; +const char MSG_CHOOSE_EXTRUDER_PL[] PROGMEM = "Wybierz ekstruder"; +const char MSG_CHOOSE_EXTRUDER_DE[] PROGMEM = "Waehlen Sie Extruder"; +const char MSG_CHOOSE_EXTRUDER_NL[] PROGMEM = "Kies Extruder"; +const char * const MSG_CHOOSE_EXTRUDER_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_CHOOSE_EXTRUDER_EN, + MSG_CHOOSE_EXTRUDER_CZ, + MSG_CHOOSE_EXTRUDER_IT, + MSG_CHOOSE_EXTRUDER_ES, + MSG_CHOOSE_EXTRUDER_PL, + MSG_CHOOSE_EXTRUDER_DE, + MSG_CHOOSE_EXTRUDER_NL +}; + const char MSG_CLEAN_NOZZLE_E_EN[] PROGMEM = "E calibration finished. Please clean the nozzle. Click when done."; const char MSG_CLEAN_NOZZLE_E_CZ[] PROGMEM = "E kalibrace ukoncena. Prosim ocistete trysku. Po te potvrdte tlacitkem."; const char MSG_CLEAN_NOZZLE_E_IT[] PROGMEM = "Calibrazione E terminata. Si prega di pulire l'ugello. Click per continuare."; @@ -788,6 +817,23 @@ const char * const MSG_COUNT_X_LANG_TABLE[1] PROGMEM = { MSG_COUNT_X_EN }; +const char MSG_CURRENT_EN[] PROGMEM = "Current"; +const char MSG_CURRENT_CZ[] PROGMEM = "Pouze aktualni"; +const char MSG_CURRENT_IT[] PROGMEM = "Attuale"; +const char MSG_CURRENT_ES[] PROGMEM = "Actual"; +const char MSG_CURRENT_PL[] PROGMEM = "Tylko aktualne"; +const char MSG_CURRENT_DE[] PROGMEM = "Aktuelles"; +const char MSG_CURRENT_NL[] PROGMEM = "Actueel"; +const char * const MSG_CURRENT_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_CURRENT_EN, + MSG_CURRENT_CZ, + MSG_CURRENT_IT, + MSG_CURRENT_ES, + MSG_CURRENT_PL, + MSG_CURRENT_DE, + MSG_CURRENT_NL +}; + const char MSG_DISABLE_STEPPERS_EN[] PROGMEM = "Disable steppers"; const char MSG_DISABLE_STEPPERS_CZ[] PROGMEM = "Vypnout motory"; const char MSG_DISABLE_STEPPERS_IT[] PROGMEM = "Disabilit motori"; @@ -906,6 +952,76 @@ const char * const MSG_EXTERNAL_RESET_LANG_TABLE[1] PROGMEM = { MSG_EXTERNAL_RESET_EN }; +const char MSG_EXTRUDER_EN[] PROGMEM = "Extruder"; +const char MSG_EXTRUDER_IT[] PROGMEM = "Estrusore"; +const char MSG_EXTRUDER_ES[] PROGMEM = "Extrusor"; +const char MSG_EXTRUDER_PL[] PROGMEM = "Ekstruder"; +const char * const MSG_EXTRUDER_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_EXTRUDER_EN, + MSG_EXTRUDER_EN, + MSG_EXTRUDER_IT, + MSG_EXTRUDER_ES, + MSG_EXTRUDER_PL, + MSG_EXTRUDER_EN, + MSG_EXTRUDER_EN +}; + +const char MSG_EXTRUDER_1_EN[] PROGMEM = "Extruder 1"; +const char MSG_EXTRUDER_1_IT[] PROGMEM = "Estrusore 1"; +const char MSG_EXTRUDER_1_ES[] PROGMEM = "Extrusor 1"; +const char MSG_EXTRUDER_1_PL[] PROGMEM = "Ekstruder 1"; +const char * const MSG_EXTRUDER_1_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_EXTRUDER_1_EN, + MSG_EXTRUDER_1_EN, + MSG_EXTRUDER_1_IT, + MSG_EXTRUDER_1_ES, + MSG_EXTRUDER_1_PL, + MSG_EXTRUDER_1_EN, + MSG_EXTRUDER_1_EN +}; + +const char MSG_EXTRUDER_2_EN[] PROGMEM = "Extruder 2"; +const char MSG_EXTRUDER_2_IT[] PROGMEM = "Estrusore 2"; +const char MSG_EXTRUDER_2_ES[] PROGMEM = "Extrusor 2"; +const char MSG_EXTRUDER_2_PL[] PROGMEM = "Ekstruder 2"; +const char * const MSG_EXTRUDER_2_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_EXTRUDER_2_EN, + MSG_EXTRUDER_2_EN, + MSG_EXTRUDER_2_IT, + MSG_EXTRUDER_2_ES, + MSG_EXTRUDER_2_PL, + MSG_EXTRUDER_2_EN, + MSG_EXTRUDER_2_EN +}; + +const char MSG_EXTRUDER_3_EN[] PROGMEM = "Extruder 3"; +const char MSG_EXTRUDER_3_IT[] PROGMEM = "Estrusore 3"; +const char MSG_EXTRUDER_3_ES[] PROGMEM = "Extrusor 3"; +const char MSG_EXTRUDER_3_PL[] PROGMEM = "Ekstruder 3"; +const char * const MSG_EXTRUDER_3_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_EXTRUDER_3_EN, + MSG_EXTRUDER_3_EN, + MSG_EXTRUDER_3_IT, + MSG_EXTRUDER_3_ES, + MSG_EXTRUDER_3_PL, + MSG_EXTRUDER_3_EN, + MSG_EXTRUDER_3_EN +}; + +const char MSG_EXTRUDER_4_EN[] PROGMEM = "Extruder 4"; +const char MSG_EXTRUDER_4_IT[] PROGMEM = "Estrusore 4"; +const char MSG_EXTRUDER_4_ES[] PROGMEM = "Extrusor 4"; +const char MSG_EXTRUDER_4_PL[] PROGMEM = "Ekstruder 4"; +const char * const MSG_EXTRUDER_4_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_EXTRUDER_4_EN, + MSG_EXTRUDER_4_EN, + MSG_EXTRUDER_4_IT, + MSG_EXTRUDER_4_ES, + MSG_EXTRUDER_4_PL, + MSG_EXTRUDER_4_EN, + MSG_EXTRUDER_4_EN +}; + const char MSG_E_CAL_KNOB_EN[] PROGMEM = "Rotate knob until mark reaches extruder body. Click when done."; const char MSG_E_CAL_KNOB_CZ[] PROGMEM = "Otacejte tlacitkem dokud znacka nedosahne tela extruderu. Potvrdte tlacitkem."; const char MSG_E_CAL_KNOB_IT[] PROGMEM = "Girare la manopola affinche' il segno raggiunga il corpo dell'estrusore. Click per continuare."; @@ -923,11 +1039,6 @@ const char * const MSG_E_CAL_KNOB_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_E_CAL_KNOB_NL }; -const char MSG_E_D_RATIO_EN[] PROGMEM = "E-D Ratio"; -const char * const MSG_E_D_RATIO_LANG_TABLE[1] PROGMEM = { - MSG_E_D_RATIO_EN -}; - const char MSG_Enqueing_EN[] PROGMEM = "enqueing \""; const char * const MSG_Enqueing_LANG_TABLE[1] PROGMEM = { MSG_Enqueing_EN @@ -1089,32 +1200,6 @@ const char * const MSG_FIL_ADJUSTING_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_FIL_ADJUSTING_NL }; -const char MSG_FIL_LOADED_CHECK_EN[] PROGMEM = "Is filament loaded?"; -const char MSG_FIL_LOADED_CHECK_DE[] PROGMEM = "Ist Filament eingelegt?"; -const char MSG_FIL_LOADED_CHECK_NL[] PROGMEM = "Is filament ingestoken?"; -const char * const MSG_FIL_LOADED_CHECK_LANG_TABLE[LANG_NUM] PROGMEM = { - MSG_FIL_LOADED_CHECK_EN, - MSG_FIL_LOADED_CHECK_EN, - MSG_FIL_LOADED_CHECK_EN, - MSG_FIL_LOADED_CHECK_EN, - MSG_FIL_LOADED_CHECK_EN, - MSG_FIL_LOADED_CHECK_DE, - MSG_FIL_LOADED_CHECK_NL -}; - -const char MSG_FIL_TUNING_EN[] PROGMEM = "Rotate the knob to adjust filament."; -const char MSG_FIL_TUNING_DE[] PROGMEM = "Knopf drehen um Filament einzustellen."; -const char MSG_FIL_TUNING_NL[] PROGMEM = "Knop draaien om filament in te stellen."; -const char * const MSG_FIL_TUNING_LANG_TABLE[LANG_NUM] PROGMEM = { - MSG_FIL_TUNING_EN, - MSG_FIL_TUNING_EN, - MSG_FIL_TUNING_EN, - MSG_FIL_TUNING_EN, - MSG_FIL_TUNING_EN, - MSG_FIL_TUNING_DE, - MSG_FIL_TUNING_NL -}; - const char MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION_EN[] PROGMEM = "Iteration "; const char MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION_CZ[] PROGMEM = "Iterace "; const char MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION_IT[] PROGMEM = "Reiterazione "; @@ -2276,8 +2361,8 @@ const char MSG_PREPARE_FILAMENT_CZ[] PROGMEM = "Pripravte filament"; const char MSG_PREPARE_FILAMENT_IT[] PROGMEM = "Preparare filamento"; const char MSG_PREPARE_FILAMENT_ES[] PROGMEM = "Preparar filamento"; const char MSG_PREPARE_FILAMENT_PL[] PROGMEM = "Przygotuj filament"; -const char MSG_PREPARE_FILAMENT_DE[] PROGMEM = "Filament vorbereiten"; -const char MSG_PREPARE_FILAMENT_NL[] PROGMEM = "Filament voorbereden"; +const char MSG_PREPARE_FILAMENT_DE[] PROGMEM = "Filam. bereithalten"; +const char MSG_PREPARE_FILAMENT_NL[] PROGMEM = "Filam. voorbereiden"; const char * const MSG_PREPARE_FILAMENT_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_PREPARE_FILAMENT_EN, MSG_PREPARE_FILAMENT_CZ, @@ -3473,8 +3558,8 @@ const char MSG_UNLOAD_ALL_CZ[] PROGMEM = "Vyjmout vse"; const char MSG_UNLOAD_ALL_IT[] PROGMEM = "Rilasciare tutti"; const char MSG_UNLOAD_ALL_ES[] PROGMEM = "Soltar todos fil."; const char MSG_UNLOAD_ALL_PL[] PROGMEM = "Wyjac wszystkie"; -const char MSG_UNLOAD_ALL_DE[] PROGMEM = "Alle entnehmen"; -const char MSG_UNLOAD_ALL_NL[] PROGMEM = "Alle uithalen"; +const char MSG_UNLOAD_ALL_DE[] PROGMEM = "Alles entladen"; +const char MSG_UNLOAD_ALL_NL[] PROGMEM = "Alle ontladen"; const char * const MSG_UNLOAD_ALL_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_UNLOAD_ALL_EN, MSG_UNLOAD_ALL_CZ, @@ -3507,8 +3592,8 @@ const char MSG_UNLOAD_FILAMENT_1_CZ[] PROGMEM = "Vyjmout filam. 1"; const char MSG_UNLOAD_FILAMENT_1_IT[] PROGMEM = "Rilasciare fil. 1"; const char MSG_UNLOAD_FILAMENT_1_ES[] PROGMEM = "Soltar fil. 1"; const char MSG_UNLOAD_FILAMENT_1_PL[] PROGMEM = "Wyjac filament 1"; -const char MSG_UNLOAD_FILAMENT_1_DE[] PROGMEM = "Filament 1 entnehmen"; -const char MSG_UNLOAD_FILAMENT_1_NL[] PROGMEM = "Filament 1 uithalen"; +const char MSG_UNLOAD_FILAMENT_1_DE[] PROGMEM = "Filam. 1 entladen"; +const char MSG_UNLOAD_FILAMENT_1_NL[] PROGMEM = "Filam. 1 ontladen"; const char * const MSG_UNLOAD_FILAMENT_1_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_UNLOAD_FILAMENT_1_EN, MSG_UNLOAD_FILAMENT_1_CZ, @@ -3524,8 +3609,8 @@ const char MSG_UNLOAD_FILAMENT_2_CZ[] PROGMEM = "Vyjmout filam. 2"; const char MSG_UNLOAD_FILAMENT_2_IT[] PROGMEM = "Rilasciare fil. 1"; const char MSG_UNLOAD_FILAMENT_2_ES[] PROGMEM = "Soltar fil. 2"; const char MSG_UNLOAD_FILAMENT_2_PL[] PROGMEM = "Wyjac filament 2"; -const char MSG_UNLOAD_FILAMENT_2_DE[] PROGMEM = "Filament 2 entnehmen"; -const char MSG_UNLOAD_FILAMENT_2_NL[] PROGMEM = "Filament 2 uithalen"; +const char MSG_UNLOAD_FILAMENT_2_DE[] PROGMEM = "Filam. 2 entladen"; +const char MSG_UNLOAD_FILAMENT_2_NL[] PROGMEM = "Filam. 2 ontladen"; const char * const MSG_UNLOAD_FILAMENT_2_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_UNLOAD_FILAMENT_2_EN, MSG_UNLOAD_FILAMENT_2_CZ, @@ -3541,8 +3626,8 @@ const char MSG_UNLOAD_FILAMENT_3_CZ[] PROGMEM = "Vyjmout filam. 3"; const char MSG_UNLOAD_FILAMENT_3_IT[] PROGMEM = "Rilasciare fil. 1"; const char MSG_UNLOAD_FILAMENT_3_ES[] PROGMEM = "Soltar fil. 3"; const char MSG_UNLOAD_FILAMENT_3_PL[] PROGMEM = "Wyjac filament 3"; -const char MSG_UNLOAD_FILAMENT_3_DE[] PROGMEM = "Filament 3 entnehmen"; -const char MSG_UNLOAD_FILAMENT_3_NL[] PROGMEM = "Filament 3 uithalen"; +const char MSG_UNLOAD_FILAMENT_3_DE[] PROGMEM = "Filam. 3 entladen"; +const char MSG_UNLOAD_FILAMENT_3_NL[] PROGMEM = "Filam. 3 ontladen"; const char * const MSG_UNLOAD_FILAMENT_3_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_UNLOAD_FILAMENT_3_EN, MSG_UNLOAD_FILAMENT_3_CZ, @@ -3558,8 +3643,8 @@ const char MSG_UNLOAD_FILAMENT_4_CZ[] PROGMEM = "Vyjmout filam. 4"; const char MSG_UNLOAD_FILAMENT_4_IT[] PROGMEM = "Rilasciare fil. 1"; const char MSG_UNLOAD_FILAMENT_4_ES[] PROGMEM = "Soltar fil. 4"; const char MSG_UNLOAD_FILAMENT_4_PL[] PROGMEM = "Wyjac filament 4"; -const char MSG_UNLOAD_FILAMENT_4_DE[] PROGMEM = "Filament 4 entnehmen"; -const char MSG_UNLOAD_FILAMENT_4_NL[] PROGMEM = "Filament 4 uithalen"; +const char MSG_UNLOAD_FILAMENT_4_DE[] PROGMEM = "Filam. 4 entladen"; +const char MSG_UNLOAD_FILAMENT_4_NL[] PROGMEM = "Filam. 4 ontladen"; const char * const MSG_UNLOAD_FILAMENT_4_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_UNLOAD_FILAMENT_4_EN, MSG_UNLOAD_FILAMENT_4_CZ, @@ -3586,6 +3671,23 @@ const char * const MSG_USB_PRINTING_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_USB_PRINTING_EN }; +const char MSG_USED_EN[] PROGMEM = "Used during print"; +const char MSG_USED_CZ[] PROGMEM = "Pouzite behem tisku"; +const char MSG_USED_IT[] PROGMEM = "Usati nella stampa"; +const char MSG_USED_ES[] PROGMEM = "Usado en impresion"; +const char MSG_USED_PL[] PROGMEM = "Uzyte przy druku"; +const char MSG_USED_DE[] PROGMEM = "Benutzt beim Druck"; +const char MSG_USED_NL[] PROGMEM = "Gebruikt bij print"; +const char * const MSG_USED_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_USED_EN, + MSG_USED_CZ, + MSG_USED_IT, + MSG_USED_ES, + MSG_USED_PL, + MSG_USED_DE, + MSG_USED_NL +}; + const char MSG_USERWAIT_EN[] PROGMEM = "Wait for user..."; const char MSG_USERWAIT_IT[] PROGMEM = "Attendendo utente"; const char MSG_USERWAIT_ES[] PROGMEM = "Esperando ordenes"; diff --git a/Firmware/language_all.h b/Firmware/language_all.h index 22c8a882e..277039d13 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -1,6 +1,7 @@ #ifndef LANGUAGE_ALL_H #define LANGUAGE_ALL_H +#include // Language indices into their particular symbol tables. #define LANG_ID_EN 0 #define LANG_ID_CZ 1 @@ -30,8 +31,8 @@ extern const char* const MSG_ACTIVE_EXTRUDER_LANG_TABLE[1]; #define MSG_ACTIVE_EXTRUDER LANG_TABLE_SELECT_EXPLICIT(MSG_ACTIVE_EXTRUDER_LANG_TABLE, 0) extern const char* const MSG_ADJUSTZ_LANG_TABLE[LANG_NUM]; #define MSG_ADJUSTZ LANG_TABLE_SELECT(MSG_ADJUSTZ_LANG_TABLE) -extern const char* const MSG_ADVANCE_K_LANG_TABLE[1]; -#define MSG_ADVANCE_K LANG_TABLE_SELECT_EXPLICIT(MSG_ADVANCE_K_LANG_TABLE, 0) +extern const char* const MSG_ALL_LANG_TABLE[LANG_NUM]; +#define MSG_ALL LANG_TABLE_SELECT(MSG_ALL_LANG_TABLE) extern const char* const MSG_AMAX_LANG_TABLE[1]; #define MSG_AMAX LANG_TABLE_SELECT_EXPLICIT(MSG_AMAX_LANG_TABLE, 0) extern const char* const MSG_AUTHOR_LANG_TABLE[1]; @@ -122,6 +123,8 @@ extern const char* const MSG_CHANGE_SUCCESS_LANG_TABLE[LANG_NUM]; #define MSG_CHANGE_SUCCESS LANG_TABLE_SELECT(MSG_CHANGE_SUCCESS_LANG_TABLE) extern const char* const MSG_CHANGING_FILAMENT_LANG_TABLE[LANG_NUM]; #define MSG_CHANGING_FILAMENT LANG_TABLE_SELECT(MSG_CHANGING_FILAMENT_LANG_TABLE) +extern const char* const MSG_CHOOSE_EXTRUDER_LANG_TABLE[LANG_NUM]; +#define MSG_CHOOSE_EXTRUDER LANG_TABLE_SELECT(MSG_CHOOSE_EXTRUDER_LANG_TABLE) extern const char* const MSG_CLEAN_NOZZLE_E_LANG_TABLE[LANG_NUM]; #define MSG_CLEAN_NOZZLE_E LANG_TABLE_SELECT(MSG_CLEAN_NOZZLE_E_LANG_TABLE) extern const char* const MSG_CNG_SDCARD_LANG_TABLE[1]; @@ -142,6 +145,8 @@ extern const char* const MSG_CORRECTLY_LANG_TABLE[LANG_NUM]; #define MSG_CORRECTLY LANG_TABLE_SELECT(MSG_CORRECTLY_LANG_TABLE) extern const char* const MSG_COUNT_X_LANG_TABLE[1]; #define MSG_COUNT_X LANG_TABLE_SELECT_EXPLICIT(MSG_COUNT_X_LANG_TABLE, 0) +extern const char* const MSG_CURRENT_LANG_TABLE[LANG_NUM]; +#define MSG_CURRENT LANG_TABLE_SELECT(MSG_CURRENT_LANG_TABLE) extern const char* const MSG_DISABLE_STEPPERS_LANG_TABLE[LANG_NUM]; #define MSG_DISABLE_STEPPERS LANG_TABLE_SELECT(MSG_DISABLE_STEPPERS_LANG_TABLE) extern const char* const MSG_DWELL_LANG_TABLE[LANG_NUM]; @@ -176,10 +181,18 @@ extern const char* const MSG_ERR_STOPPED_LANG_TABLE[1]; #define MSG_ERR_STOPPED LANG_TABLE_SELECT_EXPLICIT(MSG_ERR_STOPPED_LANG_TABLE, 0) extern const char* const MSG_EXTERNAL_RESET_LANG_TABLE[1]; #define MSG_EXTERNAL_RESET LANG_TABLE_SELECT_EXPLICIT(MSG_EXTERNAL_RESET_LANG_TABLE, 0) +extern const char* const MSG_EXTRUDER_LANG_TABLE[LANG_NUM]; +#define MSG_EXTRUDER LANG_TABLE_SELECT(MSG_EXTRUDER_LANG_TABLE) +extern const char* const MSG_EXTRUDER_1_LANG_TABLE[LANG_NUM]; +#define MSG_EXTRUDER_1 LANG_TABLE_SELECT(MSG_EXTRUDER_1_LANG_TABLE) +extern const char* const MSG_EXTRUDER_2_LANG_TABLE[LANG_NUM]; +#define MSG_EXTRUDER_2 LANG_TABLE_SELECT(MSG_EXTRUDER_2_LANG_TABLE) +extern const char* const MSG_EXTRUDER_3_LANG_TABLE[LANG_NUM]; +#define MSG_EXTRUDER_3 LANG_TABLE_SELECT(MSG_EXTRUDER_3_LANG_TABLE) +extern const char* const MSG_EXTRUDER_4_LANG_TABLE[LANG_NUM]; +#define MSG_EXTRUDER_4 LANG_TABLE_SELECT(MSG_EXTRUDER_4_LANG_TABLE) extern const char* const MSG_E_CAL_KNOB_LANG_TABLE[LANG_NUM]; #define MSG_E_CAL_KNOB LANG_TABLE_SELECT(MSG_E_CAL_KNOB_LANG_TABLE) -extern const char* const MSG_E_D_RATIO_LANG_TABLE[1]; -#define MSG_E_D_RATIO LANG_TABLE_SELECT_EXPLICIT(MSG_E_D_RATIO_LANG_TABLE, 0) extern const char* const MSG_Enqueing_LANG_TABLE[1]; #define MSG_Enqueing LANG_TABLE_SELECT_EXPLICIT(MSG_Enqueing_LANG_TABLE, 0) extern const char* const MSG_FACTOR_LANG_TABLE[1]; @@ -206,10 +219,6 @@ extern const char* const MSG_FILE_SAVED_LANG_TABLE[1]; #define MSG_FILE_SAVED LANG_TABLE_SELECT_EXPLICIT(MSG_FILE_SAVED_LANG_TABLE, 0) extern const char* const MSG_FIL_ADJUSTING_LANG_TABLE[LANG_NUM]; #define MSG_FIL_ADJUSTING LANG_TABLE_SELECT(MSG_FIL_ADJUSTING_LANG_TABLE) -extern const char* const MSG_FIL_LOADED_CHECK_LANG_TABLE[LANG_NUM]; -#define MSG_FIL_LOADED_CHECK LANG_TABLE_SELECT(MSG_FIL_LOADED_CHECK_LANG_TABLE) -extern const char* const MSG_FIL_TUNING_LANG_TABLE[LANG_NUM]; -#define MSG_FIL_TUNING LANG_TABLE_SELECT(MSG_FIL_TUNING_LANG_TABLE) extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION_LANG_TABLE[LANG_NUM]; #define MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION LANG_TABLE_SELECT(MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION_LANG_TABLE) extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_LANG_TABLE[LANG_NUM]; @@ -596,6 +605,8 @@ extern const char* const MSG_UNLOAD_FILAMENT_4_LANG_TABLE[LANG_NUM]; #define MSG_UNLOAD_FILAMENT_4 LANG_TABLE_SELECT(MSG_UNLOAD_FILAMENT_4_LANG_TABLE) extern const char* const MSG_USB_PRINTING_LANG_TABLE[LANG_NUM]; #define MSG_USB_PRINTING LANG_TABLE_SELECT(MSG_USB_PRINTING_LANG_TABLE) +extern const char* const MSG_USED_LANG_TABLE[LANG_NUM]; +#define MSG_USED LANG_TABLE_SELECT(MSG_USED_LANG_TABLE) extern const char* const MSG_USERWAIT_LANG_TABLE[LANG_NUM]; #define MSG_USERWAIT LANG_TABLE_SELECT(MSG_USERWAIT_LANG_TABLE) extern const char* const MSG_VMIN_LANG_TABLE[1]; diff --git a/Firmware/language_cz.h b/Firmware/language_cz.h index 896d3f1bb..5f2e36af5 100644 --- a/Firmware/language_cz.h +++ b/Firmware/language_cz.h @@ -292,4 +292,13 @@ #define MSG_TEMP_CALIBRATION_DONE "Teplotni kalibrace dokoncena. Pokracujte stiskem tlacitka." #define MSG_TEMP_CALIBRATION_ON "Tepl. kal. [ON]" #define MSG_TEMP_CALIBRATION_OFF "Tepl. kal. [OFF]" -#define MSG_PREPARE_FILAMENT "Pripravte filament" \ No newline at end of file +#define MSG_PREPARE_FILAMENT "Pripravte filament" +#define MSG_ALL "Vse" +#define MSG_USED "Pouzite behem tisku" +#define MSG_CURRENT "Pouze aktualni" +#define MSG_CHOOSE_EXTRUDER "Vyberte extruder:" +#define MSG_EXTRUDER "Extruder" +#define MSG_EXTRUDER_1 "Extruder 1" +#define MSG_EXTRUDER_2 "Extruder 2" +#define MSG_EXTRUDER_3 "Extruder 3" +#define MSG_EXTRUDER_4 "Extruder 4" \ No newline at end of file diff --git a/Firmware/language_de.h b/Firmware/language_de.h index 86ab94753..9a20facea 100644 --- a/Firmware/language_de.h +++ b/Firmware/language_de.h @@ -35,7 +35,7 @@ #define MSG_CONTROL "Einstellungen" #define MSG_MIN " \002 Min" #define MSG_MAX " \002 Max" -#define MSG_FACTOR " \002 Fact" +#define MSG_FACTOR " \002 Fakt" #define MSG_TEMPERATURE "Temperatur" #define MSG_MOTION "Bewegung" #define MSG_VOLUMETRIC "Filament" @@ -249,8 +249,6 @@ #define(length=20, lines=4) MSG_FILAMENT_LOADING_T3 "Filament in extruder 4 einlegen. Klicken wenn fertig." #define(length=20, lines=1) MSG_CHANGE_EXTR "Wechsel extruder" -#define(length=20, lines=2) MSG_FIL_LOADED_CHECK "Ist Filament eingelegt?" -#define(length=20, lines=3) MSG_FIL_TUNING "Knopf drehen um Filament einzustellen." #define(length=20, lines=4) MSG_FIL_ADJUSTING "Einstellen Filament. Bitte warten." #define(length=20, lines=8) MSG_CONFIRM_NOZZLE_CLEAN_FIL_ADJ "Filamente sind jetzt eingestellt. Bitte reinigen Sie die Duese zur Kalibrierung. Klicken wenn sauber." #define(length=20, lines=4) MSG_STACK_ERROR "Error - static memory has been overwritten" @@ -297,4 +295,24 @@ #define(length=20, lines=3) MSG_TEMP_CALIBRATION_DONE "Die PINDA Temperaturkalibrierung ist beendet. Klicke um fortzufahren." #define(length=20) MSG_TEMP_CALIBRATION_ON "PINDA T.Kal. [ON]" #define(length=20) MSG_TEMP_CALIBRATION_OFF "PINDA T.Kal.[OFF]" -#define(length=20, lines=1) MSG_PREPARE_FILAMENT "Filament vorbereiten" + +#define(length=20) MSG_LOAD_ALL "Alle laden" +#define(length=20) MSG_LOAD_FILAMENT_1 "Filament 1 laden" +#define(length=20) MSG_LOAD_FILAMENT_2 "Filament 2 laden" +#define(length=20) MSG_LOAD_FILAMENT_3 "Filament 3 laden" +#define(length=20) MSG_LOAD_FILAMENT_4 "Filament 4 laden" +#define(length=20) MSG_UNLOAD_FILAMENT_1 "Filam. 1 entladen" +#define(length=20) MSG_UNLOAD_FILAMENT_2 "Filam. 2 entladen" +#define(length=20) MSG_UNLOAD_FILAMENT_3 "Filam. 3 entladen" +#define(length=20) MSG_UNLOAD_FILAMENT_4 "Filam. 4 entladen" +#define(length=20) MSG_UNLOAD_ALL "Alles entladen" +#define(length=20) MSG_PREPARE_FILAMENT "Filam. bereithalten" +#define(length=20) MSG_ALL "Alle" +#define(length=20) MSG_USED "Benutzt beim Druck" +#define(length=20) MSG_CURRENT "Aktuelles" +#define(length=20) MSG_CHOOSE_EXTRUDER "Waehlen Sie Extruder" +#define(length=20) MSG_EXTRUDER "Extruder" +#define(length=20) MSG_EXTRUDER_1 "Extruder 1" +#define(length=20) MSG_EXTRUDER_2 "Extruder 2" +#define(length=20) MSG_EXTRUDER_3 "Extruder 3" +#define(length=20) MSG_EXTRUDER_4 "Extruder 4" diff --git a/Firmware/language_en.h b/Firmware/language_en.h index 060eea9e8..f1215c823 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -46,11 +46,6 @@ #define MSG_REFRESH "\xF8" "Refresh" #define MSG_WATCH "Info screen" #define MSG_TUNE "Tune" - -//Linear Advance option -#define MSG_ADVANCE_K "Advance K" -#define MSG_E_D_RATIO "E-D Ratio" - #define MSG_PAUSE_PRINT "Pause print" #define MSG_RESUME_PRINT "Resume print" #define MSG_STOP_PRINT "Stop print" @@ -253,8 +248,7 @@ #define(length=20, lines=4) MSG_FILAMENT_LOADING_T2 "Insert filament into extruder 3. Click when done." #define(length=20, lines=4) MSG_FILAMENT_LOADING_T3 "Insert filament into extruder 4. Click when done." #define(length=20, lines=1) MSG_CHANGE_EXTR "Change extruder" -#define(length=20, lines=2) MSG_FIL_LOADED_CHECK "Is filament loaded?" -#define(length=20, lines=3) MSG_FIL_TUNING "Rotate the knob to adjust filament." + #define(length=20, lines=4) MSG_FIL_ADJUSTING "Adjusting filaments. Please wait." #define(length=20,lines=8) MSG_CONFIRM_NOZZLE_CLEAN_FIL_ADJ "Filaments are now adjusted. Please clean the nozzle for calibration. Click when done." #define(length=20, lines=4) MSG_STACK_ERROR "Error - static memory has been overwritten" @@ -267,7 +261,7 @@ #define(length=20, lines=8) MSG_CLEAN_NOZZLE_E "E calibration finished. Please clean the nozzle. Click when done." #define(length=20, lines=3) MSG_WAITING_TEMP "Waiting for nozzle and bed cooling" #define(length=20, lines=2) MSG_FILAMENT_CLEAN "Is color clear?" -#define(length=20) MSG_UNLOADING_FILAMENT "Unloading filament" +#define(length=20, lines=1) MSG_UNLOADING_FILAMENT "Unloading filament" #define(length=20, lines=10) MSG_PAPER "Place a sheet of paper under the nozzle during the calibration of first 4 points. If the nozzle catches the paper, power off the printer immediately." #define(length=20) MSG_BED_CORRECTION_MENU "Bed level correct" @@ -293,7 +287,6 @@ #define(length=20, lines=1) MSG_PID_BED_FINISHED "PID bed cal. done " #define(length=20, lines=1) MSG_PID_BED_RUNNING "PID bed cal. " - #define(length=20, lines=1) MSG_CALIBRATE_PINDA "PINDA Temp. cal." #define(length=20, lines=1) MSG_CALIBRATION_PINDA_MENU "PINDA Temp. cal." #define(length=20, lines=4) MSG_PINDA_NOT_CALIBRATED "PINDA temperature calibration has not been run yet" @@ -303,3 +296,13 @@ #define(length=20, lines=1) MSG_TEMP_CALIBRATION_ON "PINDA T.cal. [ON]" #define(length=20, lines=1) MSG_TEMP_CALIBRATION_OFF "PINDA T.cal.[OFF]" #define(length=20, lines=1) MSG_PREPARE_FILAMENT "Prepare new filament" +#define(length=19, lines=1) MSG_ALL "All" +#define(length=19, lines=1) MSG_USED "Used during print" +#define(length=19, lines=1) MSG_CURRENT "Current" +#define(length=20, lines=1) MSG_CHOOSE_EXTRUDER "Choose extruder:" +#define(length=17, lines=1) MSG_EXTRUDER "Extruder" +#define(length=17, lines=1) MSG_EXTRUDER_1 "Extruder 1" +#define(length=17, lines=1) MSG_EXTRUDER_2 "Extruder 2" +#define(length=17, lines=1) MSG_EXTRUDER_3 "Extruder 3" +#define(length=17, lines=1) MSG_EXTRUDER_4 "Extruder 4" + diff --git a/Firmware/language_es.h b/Firmware/language_es.h index b3e929e4a..d44cda831 100644 --- a/Firmware/language_es.h +++ b/Firmware/language_es.h @@ -286,4 +286,13 @@ #define MSG_UNLOAD_FILAMENT_3 "Soltar fil. 3" #define MSG_UNLOAD_FILAMENT_4 "Soltar fil. 4" #define MSG_UNLOAD_ALL "Soltar todos fil." -#define MSG_PREPARE_FILAMENT "Preparar filamento" \ No newline at end of file +#define MSG_PREPARE_FILAMENT "Preparar filamento" +#define MSG_ALL "Todos" +#define MSG_USED "Usado en impresion" +#define MSG_CURRENT "Actual" +#define MSG_CHOOSE_EXTRUDER "Elegir extrusor:" +#define MSG_EXTRUDER "Extrusor" +#define MSG_EXTRUDER_1 "Extrusor 1" +#define MSG_EXTRUDER_2 "Extrusor 2" +#define MSG_EXTRUDER_3 "Extrusor 3" +#define MSG_EXTRUDER_4 "Extrusor 4" \ No newline at end of file diff --git a/Firmware/language_it.h b/Firmware/language_it.h index 451481573..0f138b71b 100644 --- a/Firmware/language_it.h +++ b/Firmware/language_it.h @@ -278,3 +278,12 @@ #define MSG_UNLOAD_FILAMENT_4 "Rilasciare fil. 1" #define MSG_UNLOAD_ALL "Rilasciare tutti" #define MSG_PREPARE_FILAMENT "Preparare filamento" +#define MSG_ALL "Tutti" +#define MSG_USED "Usati nella stampa" +#define MSG_CURRENT "Attuale" +#define MSG_CHOOSE_EXTRUDER "Seleziona estrusore:" +#define MSG_EXTRUDER "Estrusore" +#define MSG_EXTRUDER_1 "Estrusore 1" +#define MSG_EXTRUDER_2 "Estrusore 2" +#define MSG_EXTRUDER_3 "Estrusore 3" +#define MSG_EXTRUDER_4 "Estrusore 4" \ No newline at end of file diff --git a/Firmware/language_nl.h b/Firmware/language_nl.h index 12fd74876..e20814f88 100644 --- a/Firmware/language_nl.h +++ b/Firmware/language_nl.h @@ -248,8 +248,6 @@ #define(length=20, lines=4) MSG_FILAMENT_LOADING_T3 "Steek filament in de extruder 4. Klik als klaar." #define(length=20, lines=1) MSG_CHANGE_EXTR "Wissel extruder" -#define(length=20, lines=2) MSG_FIL_LOADED_CHECK "Is filament ingestoken?" -#define(length=20, lines=3) MSG_FIL_TUNING "Knop draaien om filament in te stellen." #define(length=20, lines=4) MSG_FIL_ADJUSTING "Aanpassen filamenten. Even geduld aub." #define(length=20, lines=8) MSG_CONFIRM_NOZZLE_CLEAN_FIL_ADJ "Filamenten zijn nu ingesteld. Reinig het tuit voor de kalibratie. Klik als klaar." #define(length=20, lines=4) MSG_STACK_ERROR "Error - static memory has been overwritten" @@ -296,4 +294,24 @@ #define(length=20, lines=3) MSG_TEMP_CALIBRATION_DONE "PINDA temperatuur calibratie is klaar. Klik om door te gaan." #define(length=20) MSG_TEMP_CALIBRATION_ON "PINDA T.kal. [ON]" #define(length=20) MSG_TEMP_CALIBRATION_OFF "PINDA T.kal.[OFF]" -#define(length=20, lines=1) MSG_PREPARE_FILAMENT "Filament voorbereden" + +#define(length=20) MSG_LOAD_ALL "Alle laden" +#define(length=20) MSG_LOAD_FILAMENT_1 "Filament 1 laden" +#define(length=20) MSG_LOAD_FILAMENT_2 "Filament 2 laden" +#define(length=20) MSG_LOAD_FILAMENT_3 "Filament 3 laden" +#define(length=20) MSG_LOAD_FILAMENT_4 "Filament 4 laden" +#define(length=20) MSG_UNLOAD_FILAMENT_1 "Filam. 1 ontladen" +#define(length=20) MSG_UNLOAD_FILAMENT_2 "Filam. 2 ontladen" +#define(length=20) MSG_UNLOAD_FILAMENT_3 "Filam. 3 ontladen" +#define(length=20) MSG_UNLOAD_FILAMENT_4 "Filam. 4 ontladen" +#define(length=20) MSG_UNLOAD_ALL "Alle ontladen" +#define(length=20) MSG_PREPARE_FILAMENT "Filam. voorbereiden" +#define(length=20) MSG_ALL "Alle" +#define(length=20) MSG_USED "Gebruikt bij print" +#define(length=20) MSG_CURRENT "Actueel" +#define(length=20) MSG_CHOOSE_EXTRUDER "Kies Extruder" +#define(length=20) MSG_EXTRUDER "Extruder" +#define(length=20) MSG_EXTRUDER_1 "Extruder 1" +#define(length=20) MSG_EXTRUDER_2 "Extruder 2" +#define(length=20) MSG_EXTRUDER_3 "Extruder 3" +#define(length=20) MSG_EXTRUDER_4 "Extruder 4" diff --git a/Firmware/language_pl.h b/Firmware/language_pl.h index 3207ce0c9..3cd283ded 100644 --- a/Firmware/language_pl.h +++ b/Firmware/language_pl.h @@ -289,4 +289,13 @@ #define MSG_UNLOAD_FILAMENT_3 "Wyjac filament 3" #define MSG_UNLOAD_FILAMENT_4 "Wyjac filament 4" #define MSG_UNLOAD_ALL "Wyjac wszystkie" -#define MSG_PREPARE_FILAMENT "Przygotuj filament" \ No newline at end of file +#define MSG_PREPARE_FILAMENT "Przygotuj filament" +#define MSG_ALL "Wszystko" +#define MSG_USED "Uzyte przy druku" +#define MSG_CURRENT "Tylko aktualne" +#define MSG_CHOOSE_EXTRUDER "Wybierz ekstruder" +#define MSG_EXTRUDER "Ekstruder" +#define MSG_EXTRUDER_1 "Ekstruder 1" +#define MSG_EXTRUDER_2 "Ekstruder 2" +#define MSG_EXTRUDER_3 "Ekstruder 3" +#define MSG_EXTRUDER_4 "Ekstruder 4" \ No newline at end of file diff --git a/Firmware/le.sh b/Firmware/le.sh new file mode 100644 index 000000000..57646735e --- /dev/null +++ b/Firmware/le.sh @@ -0,0 +1,29 @@ +# line ending management script +# CRLF - windows default ('\r\n') +# LF - unix default ('\n') +# arguments: +# ?crlf - print all .cpp and .h files with CRLF line endings +# ?lf - print all .cpp and .h files with LF line endings +# crlf - replace line endings in all .cpp and .h files to CRLF +# lf - replace line endings in all .cpp and .h files to LF + +if [ "$1" == "?crlf" ] || [ $# -eq 0 ]; then + echo 'cpp and h files with CRLF line endings:' + find {*.cpp,*.h} -not -type d -exec file "{}" ";" | grep CRLF | sed 's/:.*//g' +elif [ "$1" == "?lf" ]; then + echo 'cpp and h files with LF line endings:' + find {*.cpp,*.h} -not -type d -exec file "{}" ";" | grep -v CRLF | sed 's/:.*//g' +fi +if [ "$1" == "crlf" ]; then + echo 'replacing LF with CRLF in all cpp and h files:' + find {*.cpp,*.h} -not -type d -exec file "{}" ";" | grep -v CRLF | sed 's/:.*//g' | while read fn; do + echo "$fn" + sed -i 's/$/\r/g' $fn + done +elif [ "$1" == "lf" ]; then + echo 'replacing CRLF with LF in all cpp and h files:' + find {*.cpp,*.h} -not -type d -exec file "{}" ";" | grep CRLF | sed 's/:.*//g' | while read fn; do + echo "$fn" + sed -i 's/\r\n/\n/g' $fn + done +fi diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index c91f92a0a..9c3f8f6b2 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -29,11 +29,6 @@ float world2machine_shift[2]; #define MACHINE_AXIS_SCALE_X 1.f #define MACHINE_AXIS_SCALE_Y 1.f -// 0.12 degrees equals to an offset of 0.5mm on 250mm length. -#define BED_SKEW_ANGLE_MILD (0.12f * M_PI / 180.f) -// 0.25 degrees equals to an offset of 1.1mm on 250mm length. -#define BED_SKEW_ANGLE_EXTREME (0.25f * M_PI / 180.f) - #define BED_CALIBRATION_POINT_OFFSET_MAX_EUCLIDIAN (0.8f) #define BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_X (0.8f) #define BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_Y (1.5f) @@ -48,6 +43,11 @@ float world2machine_shift[2]; // by the Least Squares fitting and the X coordinate will be weighted low. #define Y_MIN_POS_CALIBRATION_POINT_OUT_OF_REACH (Y_MIN_POS - 0.5f) +// 0.12 degrees equals to an offset of 0.5mm on 250mm length. +const float bed_skew_angle_mild = (0.12f * M_PI / 180.f); +// 0.25 degrees equals to an offset of 1.1mm on 250mm length. +const float bed_skew_angle_extreme = (0.25f * M_PI / 180.f); + // Positions of the bed reference points in the machine coordinates, referenced to the P.I.N.D.A sensor. // The points are ordered in a zig-zag fashion to speed up the calibration. const float bed_ref_points[] PROGMEM = { @@ -75,15 +75,21 @@ const float bed_ref_points_4[] PROGMEM = { static inline float sqr(float x) { return x * x; } +static inline bool point_on_1st_row(const uint8_t i, const uint8_t npts) +{ + if (npts == 4) return (i == 0); + else return (i < 3); +} + // Weight of a point coordinate in a least squares optimization. // The first row of points may not be fully reachable // and the y values may be shortened a bit by the bed carriage // pulling the belt up. -static inline float point_weight_x(const uint8_t i, const float &y) +static inline float point_weight_x(const uint8_t i, const uint8_t npts, const float &y) { float w = 1.f; - if (i < 3) { - if (y >= Y_MIN_POS_CALIBRATION_POINT_ACCURATE) { + if (point_on_1st_row(i, npts)) { + if (y >= Y_MIN_POS_CALIBRATION_POINT_ACCURATE) { w = WEIGHT_FIRST_ROW_X_HIGH; } else if (y < Y_MIN_POS_CALIBRATION_POINT_OUT_OF_REACH) { // If the point is fully outside, give it some weight. @@ -101,10 +107,10 @@ static inline float point_weight_x(const uint8_t i, const float &y) // The first row of points may not be fully reachable // and the y values may be shortened a bit by the bed carriage // pulling the belt up. -static inline float point_weight_y(const uint8_t i, const float &y) +static inline float point_weight_y(const uint8_t i, const uint8_t npts, const float &y) { float w = 1.f; - if (i < 3) { + if (point_on_1st_row(i, npts)) { if (y >= Y_MIN_POS_CALIBRATION_POINT_ACCURATE) { w = WEIGHT_FIRST_ROW_Y_HIGH; } else if (y < Y_MIN_POS_CALIBRATION_POINT_OUT_OF_REACH) { @@ -138,6 +144,8 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( ) { if (verbosity_level >= 10) { + SERIAL_ECHOLNPGM("calculate machine skew and offset LS"); + // Show the initial state, before the fitting. SERIAL_ECHOPGM("X vector, initial: "); MYSERIAL.print(vec_x[0], 5); @@ -210,7 +218,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( (c == 0) ? 1.f : ((c == 2) ? (-s1 * measured_pts[2 * i]) : (-c2 * measured_pts[2 * i + 1])); - float w = point_weight_x(i, measured_pts[2 * i + 1]); + float w = point_weight_x(i, npts, measured_pts[2 * i + 1]); acc += a * b * w; } // Second for the residuum in the y axis. @@ -225,7 +233,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( (c == 1) ? 1.f : ((c == 2) ? ( c1 * measured_pts[2 * i]) : (-s2 * measured_pts[2 * i + 1])); - float w = point_weight_y(i, measured_pts[2 * i + 1]); + float w = point_weight_y(i, npts, measured_pts[2 * i + 1]); acc += a * b * w; } } @@ -241,7 +249,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( ((r == 2) ? (-s1 * measured_pts[2 * i]) : (-c2 * measured_pts[2 * i + 1]))); float fx = c1 * measured_pts[2 * i] - s2 * measured_pts[2 * i + 1] + cntr[0] - pgm_read_float(true_pts + i * 2); - float w = point_weight_x(i, measured_pts[2 * i + 1]); + float w = point_weight_x(i, npts, measured_pts[2 * i + 1]); acc += j * fx * w; } { @@ -251,7 +259,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( ((r == 2) ? ( c1 * measured_pts[2 * i]) : (-s2 * measured_pts[2 * i + 1]))); float fy = s1 * measured_pts[2 * i] + c2 * measured_pts[2 * i + 1] + cntr[1] - pgm_read_float(true_pts + i * 2 + 1); - float w = point_weight_y(i, measured_pts[2 * i + 1]); + float w = point_weight_y(i, npts, measured_pts[2 * i + 1]); acc += j * fy * w; } } @@ -278,8 +286,8 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( if (verbosity_level >= 20) { SERIAL_ECHOPGM("iteration: "); - MYSERIAL.print(iter, 0); - SERIAL_ECHOPGM("correction vector: "); + MYSERIAL.print(int(iter)); + SERIAL_ECHOPGM("; correction vector: "); MYSERIAL.print(h[0], 5); SERIAL_ECHOPGM(", "); MYSERIAL.print(h[1], 5); @@ -308,13 +316,13 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( BedSkewOffsetDetectionResultType result = BED_SKEW_OFFSET_DETECTION_PERFECT; { - float angleDiff = fabs(a2 - a1); - if (angleDiff > BED_SKEW_ANGLE_MILD) - result = (angleDiff > BED_SKEW_ANGLE_EXTREME) ? + angleDiff = fabs(a2 - a1); + if (angleDiff > bed_skew_angle_mild) + result = (angleDiff > bed_skew_angle_extreme) ? BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME : BED_SKEW_OFFSET_DETECTION_SKEW_MILD; - if (fabs(a1) > BED_SKEW_ANGLE_EXTREME || - fabs(a2) > BED_SKEW_ANGLE_EXTREME) + if (fabs(a1) > bed_skew_angle_extreme || + fabs(a2) > bed_skew_angle_extreme) result = BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME; } @@ -357,19 +365,36 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( float errX = sqr(pgm_read_float(true_pts + i * 2) - x); float errY = sqr(pgm_read_float(true_pts + i * 2 + 1) - y); float err = sqrt(errX + errY); - if (i < 3) { - float w = point_weight_y(i, measured_pts[2 * i + 1]); - if (sqrt(errX) > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_X || - (w != 0.f && sqrt(errY) > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_Y)) - result = BED_SKEW_OFFSET_DETECTION_FITTING_FAILED; - } else { - if (err > BED_CALIBRATION_POINT_OFFSET_MAX_EUCLIDIAN) - result = BED_SKEW_OFFSET_DETECTION_FITTING_FAILED; + if (verbosity_level >= 10) { + SERIAL_ECHOPGM("point #"); + MYSERIAL.print(int(i)); + SERIAL_ECHOLNPGM(":"); + } + + if (point_on_1st_row(i, npts)) { + if(verbosity_level >= 20) SERIAL_ECHOPGM("Point on first row"); + float w = point_weight_y(i, npts, measured_pts[2 * i + 1]); + if (sqrt(errX) > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_X || + (w != 0.f && sqrt(errY) > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_Y)) { + result = BED_SKEW_OFFSET_DETECTION_FITTING_FAILED; + if (verbosity_level >= 20) { + SERIAL_ECHOPGM(", weigth Y: "); + MYSERIAL.print(w); + if (sqrt(errX) > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_X) SERIAL_ECHOPGM(", error X > max. error X"); + if (w != 0.f && sqrt(errY) > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_Y) SERIAL_ECHOPGM(", error Y > max. error Y"); + } + } + } + else { + if(verbosity_level >=20 ) SERIAL_ECHOPGM("Point not on first row"); + if (err > BED_CALIBRATION_POINT_OFFSET_MAX_EUCLIDIAN) { + result = BED_SKEW_OFFSET_DETECTION_FITTING_FAILED; + if(verbosity_level >= 20) SERIAL_ECHOPGM(", error > max. error euclidian"); + } } if (verbosity_level >= 10) { - SERIAL_ECHOPGM("point #"); - MYSERIAL.print(int(i)); - SERIAL_ECHOPGM(" measured: ("); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("measured: ("); MYSERIAL.print(measured_pts[i * 2], 5); SERIAL_ECHOPGM(", "); MYSERIAL.print(measured_pts[i * 2 + 1], 5); @@ -381,18 +406,30 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( MYSERIAL.print(pgm_read_float(true_pts + i * 2), 5); SERIAL_ECHOPGM(", "); MYSERIAL.print(pgm_read_float(true_pts + i * 2 + 1), 5); - SERIAL_ECHOPGM("), error: "); + SERIAL_ECHOLNPGM(")"); + SERIAL_ECHOPGM("error: "); MYSERIAL.print(err); SERIAL_ECHOPGM(", error X: "); - MYSERIAL.print(errX); + MYSERIAL.print(sqrt(errX)); SERIAL_ECHOPGM(", error Y: "); - MYSERIAL.print(errY); - SERIAL_ECHOLNPGM(""); + MYSERIAL.print(sqrt(errY)); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOLNPGM(""); } } + if (verbosity_level >= 20) { + SERIAL_ECHOLNPGM("Max. errors:"); + SERIAL_ECHOPGM("Max. error X:"); + MYSERIAL.println(BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_X); + SERIAL_ECHOPGM("Max. error Y:"); + MYSERIAL.println(BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_Y); + SERIAL_ECHOPGM("Max. error euclidian:"); + MYSERIAL.println(BED_CALIBRATION_POINT_OFFSET_MAX_EUCLIDIAN); + SERIAL_ECHOLNPGM(""); + } #if 0 - if (result == BED_SKEW_OFFSET_DETECTION_PERFECT && fabs(a1) < BED_SKEW_ANGLE_MILD && fabs(a2) < BED_SKEW_ANGLE_MILD) { + if (result == BED_SKEW_OFFSET_DETECTION_PERFECT && fabs(a1) < bed_skew_angle_mild && fabs(a2) < bed_skew_angle_mild) { if (verbosity_level > 0) SERIAL_ECHOLNPGM("Very little skew detected. Disabling skew correction."); // Just disable the skew correction. @@ -419,7 +456,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( for (int8_t i = 0; i < npts; ++ i) { float x = vec_x[0] * measured_pts[i * 2] + vec_y[0] * measured_pts[i * 2 + 1]; float y = vec_x[1] * measured_pts[i * 2] + vec_y[1] * measured_pts[i * 2 + 1]; - float w = point_weight_x(i, y); + float w = point_weight_x(i, npts, y); cntr[0] += w * (pgm_read_float(true_pts + i * 2) - x); wx += w; if (verbosity_level >= 20) { @@ -434,7 +471,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( SERIAL_ECHOLNPGM("wx:"); MYSERIAL.print(wx); } - w = point_weight_y(i, y); + w = point_weight_y(i, npts, y); cntr[1] += w * (pgm_read_float(true_pts + i * 2 + 1) - y); wy += w; @@ -532,6 +569,13 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( MYSERIAL.print(sqrt(sqr(measured_pts[i * 2] - x) + sqr(measured_pts[i * 2 + 1] - y))); SERIAL_ECHOLNPGM(""); } + if (verbosity_level >= 20) { + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOLNPGM("Calculate offset and skew returning result:"); + MYSERIAL.print(int(result)); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOLNPGM(""); + } delay_keep_alive(100); } @@ -623,7 +667,7 @@ static inline bool vec_undef(const float v[2]) void world2machine_initialize() { -// SERIAL_ECHOLNPGM("world2machine_initialize()"); + //SERIAL_ECHOLNPGM("world2machine_initialize"); float cntr[2] = { eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER+0)), eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER+4)) @@ -639,7 +683,7 @@ void world2machine_initialize() bool reset = false; if (vec_undef(cntr) || vec_undef(vec_x) || vec_undef(vec_y)) { - // SERIAL_ECHOLNPGM("Undefined bed correction matrix."); + SERIAL_ECHOLNPGM("Undefined bed correction matrix."); reset = true; } else { @@ -744,9 +788,9 @@ static inline void update_current_position_z() } // At the current position, find the Z stop. -inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter) +inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, int verbosity_level) { -// SERIAL_ECHOLNPGM("find_bed_induction_sensor_point_z 1"); + if(verbosity_level >= 10) SERIAL_ECHOLNPGM("find bed induction sensor point z"); bool endstops_enabled = enable_endstops(true); bool endstop_z_enabled = enable_z_endstop(false); float z = 0.f; @@ -799,8 +843,9 @@ error: #define FIND_BED_INDUCTION_SENSOR_POINT_Y_RADIUS (6.f) #define FIND_BED_INDUCTION_SENSOR_POINT_XY_STEP (1.f) #define FIND_BED_INDUCTION_SENSOR_POINT_Z_STEP (0.2f) -inline bool find_bed_induction_sensor_point_xy() +inline bool find_bed_induction_sensor_point_xy(int verbosity_level) { + if(verbosity_level >= 10) MYSERIAL.println("find bed induction sensor point xy"); float feedrate = homing_feedrate[X_AXIS] / 60.f; bool found = false; @@ -811,14 +856,22 @@ inline bool find_bed_induction_sensor_point_xy() float y1 = current_position[Y_AXIS] + FIND_BED_INDUCTION_SENSOR_POINT_Y_RADIUS; uint8_t nsteps_y; uint8_t i; - if (x0 < X_MIN_POS) - x0 = X_MIN_POS; - if (x1 > X_MAX_POS) - x1 = X_MAX_POS; - if (y0 < Y_MIN_POS_FOR_BED_CALIBRATION) - y0 = Y_MIN_POS_FOR_BED_CALIBRATION; - if (y1 > Y_MAX_POS) - y1 = Y_MAX_POS; + if (x0 < X_MIN_POS) { + x0 = X_MIN_POS; + if (verbosity_level >= 20) SERIAL_ECHOLNPGM("X searching radius lower than X_MIN. Clamping was done."); + } + if (x1 > X_MAX_POS) { + x1 = X_MAX_POS; + if (verbosity_level >= 20) SERIAL_ECHOLNPGM("X searching radius higher than X_MAX. Clamping was done."); + } + if (y0 < Y_MIN_POS_FOR_BED_CALIBRATION) { + y0 = Y_MIN_POS_FOR_BED_CALIBRATION; + if (verbosity_level >= 20) SERIAL_ECHOLNPGM("Y searching radius lower than Y_MIN. Clamping was done."); + } + if (y1 > Y_MAX_POS) { + y1 = Y_MAX_POS; + if (verbosity_level >= 20) SERIAL_ECHOLNPGM("Y searching radius higher than X_MAX. Clamping was done."); + } nsteps_y = int(ceil((y1 - y0) / FIND_BED_INDUCTION_SENSOR_POINT_XY_STEP)); enable_endstops(false); @@ -1238,12 +1291,13 @@ canceled: #define IMPROVE_BED_INDUCTION_SENSOR_POINT3_SEARCH_RADIUS (4.f) #define IMPROVE_BED_INDUCTION_SENSOR_POINT3_SEARCH_STEP_FINE_Y (0.1f) inline bool improve_bed_induction_sensor_point3(int verbosity_level) -{ +{ float center_old_x = current_position[X_AXIS]; float center_old_y = current_position[Y_AXIS]; float a, b; bool result = true; + if (verbosity_level >= 20) MYSERIAL.println("Improve bed induction sensor point3"); // Was the sensor point detected too far in the minus Y axis? // If yes, the center of the induction point cannot be reached by the machine. { @@ -1578,8 +1632,8 @@ inline void scan_bed_induction_sensor_point() #define MESH_BED_CALIBRATION_SHOW_LCD -BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level) -{ +BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level, uint8_t &too_far_mask) +{ // Don't let the manage_inactivity() function remove power from the motors. refresh_cmd_timeout(); @@ -1596,45 +1650,33 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level // SERIAL_ECHOLNPGM("find_bed_offset_and_skew verbosity level: "); // SERIAL_ECHO(int(verbosity_level)); // SERIAL_ECHOPGM(""); - + while (iteration < 3) { SERIAL_ECHOPGM("Iteration: "); MYSERIAL.println(int(iteration + 1)); - - if (iteration > 0) { - // Cache the current correction matrix. - world2machine_initialize(); - vec_x[0] = world2machine_rotation_and_skew[0][0]; - vec_x[1] = world2machine_rotation_and_skew[1][0]; - vec_y[0] = world2machine_rotation_and_skew[0][1]; - vec_y[1] = world2machine_rotation_and_skew[1][1]; - cntr[0] = world2machine_shift[0]; - cntr[1] = world2machine_shift[1]; - if (verbosity_level >= 20) { - SERIAL_ECHOPGM("vec_x[0]:"); - MYSERIAL.print(vec_x[0], 5); - SERIAL_ECHOLNPGM(""); - SERIAL_ECHOPGM("vec_x[1]:"); - MYSERIAL.print(vec_x[1], 5); - SERIAL_ECHOLNPGM(""); - SERIAL_ECHOPGM("vec_y[0]:"); - MYSERIAL.print(vec_y[0], 5); - SERIAL_ECHOLNPGM(""); - SERIAL_ECHOPGM("vec_y[1]:"); - MYSERIAL.print(vec_y[1], 5); - SERIAL_ECHOLNPGM(""); - SERIAL_ECHOPGM("cntr[0]:"); - MYSERIAL.print(cntr[0], 5); - SERIAL_ECHOLNPGM(""); - SERIAL_ECHOPGM("cntr[1]:"); - MYSERIAL.print(cntr[1], 5); - SERIAL_ECHOLNPGM(""); - } - // and reset the correction matrix, so the planner will not do anything. - world2machine_reset(); + if (verbosity_level >= 20) { + SERIAL_ECHOLNPGM("Vectors: "); + + SERIAL_ECHOPGM("vec_x[0]:"); + MYSERIAL.print(vec_x[0], 5); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("vec_x[1]:"); + MYSERIAL.print(vec_x[1], 5); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("vec_y[0]:"); + MYSERIAL.print(vec_y[0], 5); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("vec_y[1]:"); + MYSERIAL.print(vec_y[1], 5); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("cntr[0]:"); + MYSERIAL.print(cntr[0], 5); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("cntr[1]:"); + MYSERIAL.print(cntr[1], 5); + SERIAL_ECHOLNPGM(""); } - #ifdef MESH_BED_CALIBRATION_SHOW_LCD uint8_t next_line; lcd_display_message_fullscreen_P(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1, next_line); @@ -1643,7 +1685,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level #endif /* MESH_BED_CALIBRATION_SHOW_LCD */ // Collect the rear 2x3 points. - current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; + current_position[Z_AXIS] = MESH_HOME_Z_SEARCH + FIND_BED_INDUCTION_SENSOR_POINT_Z_STEP * iteration * 0.3; for (int k = 0; k < 4; ++k) { // Don't let the manage_inactivity() function remove power from the motors. refresh_cmd_timeout(); @@ -1672,10 +1714,10 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level delay_keep_alive(5000); } // Go to the measurement point position. - if (iteration == 0) { + //if (iteration == 0) { current_position[X_AXIS] = pgm_read_float(bed_ref_points_4 + k * 2); current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + k * 2 + 1); - } + /*} else { // if first iteration failed, count corrected point coordinates as initial // Use the coorrected coordinate, which is a result of find_bed_offset_and_skew(). @@ -1687,21 +1729,24 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level if (current_position[Y_AXIS] < Y_MIN_POS_FOR_BED_CALIBRATION) current_position[Y_AXIS] = Y_MIN_POS_FOR_BED_CALIBRATION; - } + }*/ if (verbosity_level >= 20) { - SERIAL_ECHOPGM("corrected current_position[X_AXIS]:"); + SERIAL_ECHOPGM("current_position[X_AXIS]:"); MYSERIAL.print(current_position[X_AXIS], 5); SERIAL_ECHOLNPGM(""); - SERIAL_ECHOPGM("corrected current_position[Y_AXIS]:"); + SERIAL_ECHOPGM("current_position[Y_AXIS]:"); MYSERIAL.print(current_position[Y_AXIS], 5); SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("current_position[Z_AXIS]:"); + MYSERIAL.print(current_position[Z_AXIS], 5); + SERIAL_ECHOLNPGM(""); } go_to_current(homing_feedrate[X_AXIS] / 60.f); if (verbosity_level >= 10) delay_keep_alive(3000); - if (!find_bed_induction_sensor_point_xy()) + if (!find_bed_induction_sensor_point_xy(verbosity_level)) return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND; #if 1 @@ -1734,22 +1779,30 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level MYSERIAL.println(current_position[X_AXIS]); MYSERIAL.println(current_position[Y_AXIS]); } - //pt[0] = (pt[0] * iteration) / (iteration + 1); - //pt[0] += (current_position[X_AXIS]/(iteration + 1)); //count average - //pt[1] = (pt[1] * iteration) / (iteration + 1); - //pt[1] += (current_position[Y_AXIS] / (iteration + 1)); + pt[0] = (pt[0] * iteration) / (iteration + 1); + pt[0] += (current_position[X_AXIS]/(iteration + 1)); //count average + pt[1] = (pt[1] * iteration) / (iteration + 1); + pt[1] += (current_position[Y_AXIS] / (iteration + 1)); - pt[0] += current_position[X_AXIS]; - if(iteration > 0) pt[0] = pt[0] / 2; - - pt[1] += current_position[Y_AXIS]; - if (iteration > 0) pt[1] = pt[1] / 2; + //pt[0] += current_position[X_AXIS]; + //if(iteration > 0) pt[0] = pt[0] / 2; + + //pt[1] += current_position[Y_AXIS]; + //if (iteration > 0) pt[1] = pt[1] / 2; + + if (verbosity_level >= 20) { + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("pt[0]:"); + MYSERIAL.println(pt[0]); + SERIAL_ECHOPGM("pt[1]:"); + MYSERIAL.println(pt[1]); + } if (current_position[Y_AXIS] < Y_MIN_POS) current_position[Y_AXIS] = Y_MIN_POS; // Start searching for the other points at 3mm above the last point. - current_position[Z_AXIS] += 3.f; + current_position[Z_AXIS] += 3.f + FIND_BED_INDUCTION_SENSOR_POINT_Z_STEP * iteration * 0.3; //cntr[0] += pt[0]; //cntr[1] += pt[1]; if (verbosity_level >= 10 && k == 0) { @@ -1775,6 +1828,15 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level } } + if (pts[1] < Y_MIN_POS_CALIBRATION_POINT_OUT_OF_REACH) { + too_far_mask |= 1 << 1; //front center point is out of reach + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("WARNING: Front point not reachable. Y coordinate:"); + MYSERIAL.print(pts[1]); + SERIAL_ECHOPGM(" < "); + MYSERIAL.println(Y_MIN_POS_CALIBRATION_POINT_OUT_OF_REACH); + } + result = calculate_machine_skew_and_offset_LS(pts, 4, bed_ref_points_4, vec_x, vec_y, cntr, verbosity_level); if (result >= 0) { world2machine_update(vec_x, vec_y, cntr); @@ -1811,6 +1873,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level // Correct the current_position to match the transformed coordinate system after world2machine_rotation_and_skew and world2machine_shift were set. world2machine_update_current(); + if (verbosity_level >= 20) { // Test the positions. Are the positions reproducible? Now the calibration is active in the planner. delay_keep_alive(3000); @@ -1826,7 +1889,8 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level } } return result; - } + } + if (result == BED_SKEW_OFFSET_DETECTION_FITTING_FAILED && too_far_mask == 2) return result; //if fitting failed and front center point is out of reach, terminate calibration and inform user iteration++; } return result; @@ -1848,6 +1912,8 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8 float *cntr = vec_y + 2; memset(pts, 0, sizeof(float) * 7 * 7); + if (verbosity_level >= 10) SERIAL_ECHOLNPGM("Improving bed offset and skew"); + // Cache the current correction matrix. world2machine_initialize(); vec_x[0] = world2machine_rotation_and_skew[0][0]; @@ -1893,7 +1959,7 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8 delay_keep_alive(5000); current_position[Y_AXIS] = Y_MIN_POS; go_to_current(homing_feedrate[X_AXIS] / 60.f); - SERIAL_ECHOLNPGM("At Y-4"); + SERIAL_ECHOLNPGM("At Y_MIN_POS"); delay_keep_alive(5000); } // Go to the measurement point. @@ -1901,8 +1967,15 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8 current_position[X_AXIS] = vec_x[0] * pgm_read_float(bed_ref_points+mesh_point*2) + vec_y[0] * pgm_read_float(bed_ref_points+mesh_point*2+1) + cntr[0]; current_position[Y_AXIS] = vec_x[1] * pgm_read_float(bed_ref_points+mesh_point*2) + vec_y[1] * pgm_read_float(bed_ref_points+mesh_point*2+1) + cntr[1]; // The calibration points are very close to the min Y. - if (current_position[Y_AXIS] < Y_MIN_POS_FOR_BED_CALIBRATION) + if (current_position[Y_AXIS] < Y_MIN_POS_FOR_BED_CALIBRATION){ current_position[Y_AXIS] = Y_MIN_POS_FOR_BED_CALIBRATION; + if (verbosity_level >= 20) { + SERIAL_ECHOPGM("Calibration point "); + SERIAL_ECHO(mesh_point); + SERIAL_ECHOPGM("lower than Ymin. Y coordinate clamping was used."); + SERIAL_ECHOLNPGM(""); + } + } go_to_current(homing_feedrate[X_AXIS]/60); // Find its Z position by running the normal vertical search. if (verbosity_level >= 10) @@ -1983,6 +2056,7 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8 if (verbosity_level >= 5) { // Test the positions. Are the positions reproducible? + current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; for (int8_t mesh_point = 0; mesh_point < 9; ++ mesh_point) { // Don't let the manage_inactivity() function remove power from the motors. refresh_cmd_timeout(); @@ -2017,7 +2091,17 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8 // In case of success, update the too_far_mask from the calculated points. for (uint8_t mesh_point = 0; mesh_point < 3; ++ mesh_point) { float y = vec_x[1] * pgm_read_float(bed_ref_points+mesh_point*2) + vec_y[1] * pgm_read_float(bed_ref_points+mesh_point*2+1) + cntr[1]; - if (y < Y_MIN_POS_CALIBRATION_POINT_OUT_OF_REACH) + distance_from_min[mesh_point] = (y - Y_MIN_POS_CALIBRATION_POINT_OUT_OF_REACH); + if (verbosity_level >= 20) { + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("Distance from min:"); + MYSERIAL.print(distance_from_min[mesh_point]); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("y:"); + MYSERIAL.print(y); + SERIAL_ECHOLNPGM(""); + } + if (y < Y_MIN_POS_CALIBRATION_POINT_OUT_OF_REACH) too_far_mask |= 1 << mesh_point; } } @@ -2042,6 +2126,7 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8 if (verbosity_level >= 5) { // Test the positions. Are the positions reproducible? Now the calibration is active in the planner. delay_keep_alive(3000); + current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; for (int8_t mesh_point = 0; mesh_point < 9; ++ mesh_point) { // Don't let the manage_inactivity() function remove power from the motors. refresh_cmd_timeout(); @@ -2346,4 +2431,34 @@ void babystep_undo() void babystep_reset() { babystepLoadZ = 0; -} \ No newline at end of file +} + +void count_xyz_details() { + float a1, a2; + float cntr[2] = { + eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER + 0)), + eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER + 4)) + }; + float vec_x[2] = { + eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_X + 0)), + eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_X + 4)) + }; + float vec_y[2] = { + eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y + 0)), + eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y + 4)) + }; + a2 = -1 * asin(vec_y[0] / MACHINE_AXIS_SCALE_Y); + a1 = asin(vec_x[1] / MACHINE_AXIS_SCALE_X); + angleDiff = fabs(a2 - a1); + for (uint8_t mesh_point = 0; mesh_point < 3; ++mesh_point) { + float y = vec_x[1] * pgm_read_float(bed_ref_points + mesh_point * 2) + vec_y[1] * pgm_read_float(bed_ref_points + mesh_point * 2 + 1) + cntr[1]; + distance_from_min[mesh_point] = (y - Y_MIN_POS_CALIBRATION_POINT_OUT_OF_REACH); + } +} + +/*countDistanceFromMin() { + +}*/ + + + diff --git a/Firmware/mesh_bed_calibration.h b/Firmware/mesh_bed_calibration.h index 102fa48dd..ee18087cc 100644 --- a/Firmware/mesh_bed_calibration.h +++ b/Firmware/mesh_bed_calibration.h @@ -6,6 +6,9 @@ // is built properly, the end stops are at the correct positions and the axes are perpendicular. extern const float bed_ref_points[] PROGMEM; +extern const float bed_skew_angle_mild; +extern const float bed_skew_angle_extreme; + // Is the world2machine correction activated? enum World2MachineCorrectionMode { @@ -140,8 +143,8 @@ inline bool world2machine_clamp(float &x, float &y) return clamped; } -extern bool find_bed_induction_sensor_point_z(float minimum_z = -10.f, uint8_t n_iter = 3); -extern bool find_bed_induction_sensor_point_xy(); +extern bool find_bed_induction_sensor_point_z(float minimum_z = -10.f, uint8_t n_iter = 3, int verbosity_level = 0); +extern bool find_bed_induction_sensor_point_xy(int verbosity_level = 0); extern void go_home_with_z_lift(); // Positive or zero: ok @@ -150,14 +153,14 @@ enum BedSkewOffsetDetectionResultType { // Detection failed, some point was not found. BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND = -1, BED_SKEW_OFFSET_DETECTION_FITTING_FAILED = -2, - + // Detection finished with success. BED_SKEW_OFFSET_DETECTION_PERFECT = 0, BED_SKEW_OFFSET_DETECTION_SKEW_MILD = 1, BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME = 2 }; -extern BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level); +extern BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level, uint8_t &too_far_mask); extern BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8_t verbosity_level, uint8_t &too_far_mask); extern bool sample_mesh_and_store_reference(); @@ -178,5 +181,6 @@ extern void babystep_undo(); // Reset the current babystep counter without moving the axes. extern void babystep_reset(); +extern void count_xyz_details(); #endif /* MESH_BED_CALIBRATION_H */ diff --git a/Firmware/pins.h b/Firmware/pins.h index 9a979fdd3..68375db79 100644 --- a/Firmware/pins.h +++ b/Firmware/pins.h @@ -67,7 +67,6 @@ #define E_MUX0_PIN 17 #define E_MUX1_PIN 16 -#define E_MUX2_PIN 84 #endif @@ -229,7 +228,6 @@ #define E_MUX0_PIN 17 #define E_MUX1_PIN 16 -#define E_MUX2_PIN 84 #endif diff --git a/Firmware/planner.cpp b/Firmware/planner.cpp index 6686d08d5..896a0fedf 100644 --- a/Firmware/planner.cpp +++ b/Firmware/planner.cpp @@ -57,22 +57,12 @@ #include "temperature.h" #include "ultralcd.h" #include "language.h" -#include "Configuration_prusa.h" #ifdef MESH_BED_LEVELING #include "mesh_bed_leveling.h" #include "mesh_bed_calibration.h" #endif -#define UNEAR_ZERO(x) ((x) < 0.000001) - -#if defined(LIN_ADVANCE) - float extruder_advance_k = LIN_ADVANCE_K, - advance_ed_ratio = LIN_ADVANCE_E_D_RATIO, - position_float[NUM_AXIS] = { 0 }; -#endif - - //=========================================================================== //=============================public variables ============================ //=========================================================================== @@ -136,6 +126,12 @@ float extrude_min_temp=EXTRUDE_MINTEMP; static char meas_sample; //temporary variable to hold filament measurement sample #endif +#ifdef LIN_ADVANCE + float extruder_advance_k = LIN_ADVANCE_K, + advance_ed_ratio = LIN_ADVANCE_E_D_RATIO, + position_float[NUM_AXIS] = { 0 }; +#endif + // Returns the index of the next block in the ring buffer // NOTE: Removed modulo (%) operator, which uses an expensive divide and multiplication. static inline int8_t next_block_index(int8_t block_index) { @@ -421,11 +417,9 @@ void plan_init() { block_buffer_head = 0; block_buffer_tail = 0; memset(position, 0, sizeof(position)); // clear position - - #if defined(LIN_ADVANCE) - memset(position_float, 0, sizeof(position_float)); + #ifdef LIN_ADVANCE + memset(position_float, 0, sizeof(position)); // clear position #endif - previous_speed[0] = 0.0; previous_speed[1] = 0.0; previous_speed[2] = 0.0; @@ -690,17 +684,11 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate #else target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]); #endif // ENABLE_MESH_BED_LEVELING - - #if defined(LIN_ADVANCE) - const float mm_D_float = sqrt(sq(target[X_AXIS] - position_float[X_AXIS]) + sq(target[Y_AXIS] - position_float[Y_AXIS])); - #endif - - long de = target[E_AXIS] - position[E_AXIS]; - target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]); - #if defined(LIN_ADVANCE) - float de_float = target[E_AXIS] - position_float[E_AXIS]; + #ifdef LIN_ADVANCE + const float mm_D_float = sqrt(sq(x - position_float[X_AXIS]) + sq(y - position_float[Y_AXIS])); + float de_float = e - position_float[E_AXIS]; #endif #ifdef PREVENT_DANGEROUS_EXTRUDE @@ -709,13 +697,10 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate if(degHotend(active_extruder)axis_steps_per_unit[E_AXIS]*EXTRUDE_MAXLENGTH) { position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part - - #if defined(LIN_ADVANCE) + #ifdef LIN_ADVANCE position_float[E_AXIS] = e; de_float = 0; #endif - SERIAL_ECHO_START; SERIAL_ECHOLNRPGM(MSG_ERR_LONG_EXTRUDE_STOP); } @@ -1152,7 +1135,7 @@ Having the real displacement of the head, we can calculate the total movement le previous_nominal_speed = block->nominal_speed; previous_safe_speed = safe_speed; - #if defined(LIN_ADVANCE) + #ifdef LIN_ADVANCE // // Use LIN_ADVANCE for blocks if all these are true: @@ -1169,24 +1152,20 @@ Having the real displacement of the head, we can calculate the total movement le // The math is good, but we must avoid retract moves with advance! // de_float > 0.0 : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves) // - - float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT; - - - block->use_advance_lead = delta_mm[E_AXIS] + block->use_advance_lead = block->steps_e && (block->steps_x || block->steps_y) && extruder_advance_k - && (uint32_t)delta_mm[E_AXIS] != block->step_event_count + && (uint32_t)block->steps_e != block->step_event_count && de_float > 0.0; if (block->use_advance_lead) block->abs_adv_steps_multiplier8 = lround( extruder_advance_k - * (UNEAR_ZERO(advance_ed_ratio) ? de_float / mm_D_float : advance_ed_ratio) // Use the fixed ratio, if set + * ((advance_ed_ratio < 0.000001) ? de_float / mm_D_float : advance_ed_ratio) // Use the fixed ratio, if set * (block->nominal_speed / (float)block->nominal_rate) - * tmp1[E_AXIS] * 256.0 + * axis_steps_per_unit[E_AXIS] * 256.0 ); - #endif - + #endif + // Precalculate the division, so when all the trapezoids in the planner queue get recalculated, the division is not repeated. block->speed_factor = block->nominal_rate / block->nominal_speed; calculate_trapezoid_for_block(block, block->entry_speed, safe_speed); @@ -1196,12 +1175,11 @@ Having the real displacement of the head, we can calculate the total movement le // Update position memcpy(position, target, sizeof(target)); // position[] = target[] - - #if defined(LIN_ADVANCE) - position_float[X_AXIS] = target[X_AXIS]; - position_float[Y_AXIS] = target[Y_AXIS]; - position_float[Z_AXIS] = target[Z_AXIS]; - position_float[E_AXIS] = target[E_AXIS]; + #ifdef LIN_ADVANCE + position_float[X_AXIS] = x; + position_float[Y_AXIS] = y; + position_float[Z_AXIS] = z; + position_float[E_AXIS] = e; #endif // Recalculate the trapezoids to maximize speed at the segment transitions while respecting @@ -1260,16 +1238,14 @@ void plan_set_position(float x, float y, float z, const float &e) #else position[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]); #endif // ENABLE_MESH_BED_LEVELING - position[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]); - - #if defined(LIN_ADVANCE) - position_float[X_AXIS] = position[X_AXIS]; - position_float[Y_AXIS] = position[Y_AXIS]; - position_float[Z_AXIS] = position[Z_AXIS]; - position_float[E_AXIS] = position[E_AXIS]; + position[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]); + #ifdef LIN_ADVANCE + position_float[X_AXIS] = x; + position_float[Y_AXIS] = y; + position_float[Z_AXIS] = z; + position_float[E_AXIS] = e; #endif - - st_set_position(position_float[X_AXIS], position_float[Y_AXIS], position_float[Z_AXIS], position_float[E_AXIS]); + st_set_position(position[X_AXIS], position[Y_AXIS], position[Z_AXIS], position[E_AXIS]); previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest. previous_speed[0] = 0.0; previous_speed[1] = 0.0; @@ -1287,12 +1263,7 @@ void plan_set_z_position(const float &z) void plan_set_e_position(const float &e) { position[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]); - - #if defined(LIN_ADVANCE) - position_float[E_AXIS] = e; - #endif st_set_e_position(position[E_AXIS]); - previous_speed[E_AXIS] = 0.0; } #ifdef PREVENT_DANGEROUS_EXTRUDE @@ -1321,4 +1292,4 @@ void planner_queue_min_reset() { g_cntr_planner_queue_min = moves_planned(); } -#endif /* PLANNER_DIAGNOSTICS */ \ No newline at end of file +#endif /* PLANNER_DIAGNOSTICS */ diff --git a/Firmware/planner.h b/Firmware/planner.h index 1ceb34d79..0858bda30 100644 --- a/Firmware/planner.h +++ b/Firmware/planner.h @@ -42,12 +42,6 @@ enum BlockFlag { BLOCK_FLAG_START_FROM_FULL_HALT = 4, }; - #if defined(LIN_ADVANCE) - extern float extruder_advance_k; - extern float advance_ed_ratio; - extern float position_float[NUM_AXIS]; - #endif - // This struct is used when buffering the setup for each linear movement "nominal" values are as specified in // the source g-code and may never actually be reached if acceleration management is active. typedef struct { @@ -61,12 +55,6 @@ typedef struct { // accelerate_until and decelerate_after are set by calculate_trapezoid_for_block() and they need to be synchronized with the stepper interrupt controller. long accelerate_until; // The index of the step event on which to stop acceleration long decelerate_after; // The index of the step event on which to start decelerating - - // Advance extrusion - #if defined(LIN_ADVANCE) - bool use_advance_lead; - uint32_t abs_adv_steps_multiplier8; // Factorised by 2^8 to avoid float - #endif // Fields used by the motion planner to manage acceleration // float speed_x, speed_y, speed_z, speed_e; // Nominal mm/sec for each axis @@ -100,8 +88,17 @@ typedef struct { // Pre-calculated division for the calculate_trapezoid_for_block() routine to run faster. float speed_factor; + + #ifdef LIN_ADVANCE + bool use_advance_lead; + unsigned long abs_adv_steps_multiplier8; // Factorised by 2^8 to avoid float + #endif } block_t; +#ifdef LIN_ADVANCE + extern float extruder_advance_k, advance_ed_ratio; +#endif + #ifdef ENABLE_AUTO_BED_LEVELING // this holds the required transform to compensate for bed level extern matrix_3x3 plan_bed_level_matrix; diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index 8cb9f9cc3..1fce528d3 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -88,48 +88,26 @@ int8_t SilentMode; volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0}; volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1}; +#ifdef LIN_ADVANCE -#if defined(LIN_ADVANCE) + uint16_t ADV_NEVER = 65535; - constexpr uint16_t ADV_NEVER = 65535; + static uint16_t nextMainISR = 0; + static uint16_t nextAdvanceISR = ADV_NEVER; + static uint16_t eISR_Rate = ADV_NEVER; - uint16_t nextMainISR = 0, - nextAdvanceISR = ADV_NEVER, - eISR_Rate = ADV_NEVER; + static volatile int e_steps; //Extrusion steps to be executed by the stepper + static int final_estep_rate; //Speed of extruder at cruising speed + static int current_estep_rate; //The current speed of the extruder + static int current_adv_steps; //The current pretension of filament expressed in steps - #if defined(LIN_ADVANCE) - volatile int e_steps[EXTRUDERS]; - int final_estep_rate, - current_estep_rate[EXTRUDERS], - current_adv_steps[EXTRUDERS]; - #endif - - #define ADV_RATE(T, L) (e_steps[TOOL_E_INDEX] ? (T) * (L) / abs(e_steps[TOOL_E_INDEX]) : ADV_NEVER) + #define ADV_RATE(T, L) (e_steps ? (T) * (L) / abs(e_steps) : ADV_NEVER) + #define _NEXT_ISR(T) nextMainISR = T +#else + #define _NEXT_ISR(T) OCR1A = T #endif -// Macros for bit masks -#define TEST(n,b) (((n)&_BV(b))!=0) -#define SBI(n,b) (n |= _BV(b)) -#define CBI(n,b) (n &= ~_BV(b)) -#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (_BV(b)) - -unsigned char last_direction_bits = 0; - -// -// The direction of a single motor -// -static FORCE_INLINE bool motor_direction(AxisEnum axis) { return TEST(last_direction_bits, axis); } - -#define TOOL_E_INDEX current_block->active_extruder - -// Macros to contrain values -#define NOLESS(v,n) do{ if (v < n) v = n; }while(0) -#define NOMORE(v,n) do{ if (v > n) v = n; }while(0) - - -#define _ENABLE_ISRs() do { cli(); SBI(TIMSK0, OCIE0B); ENABLE_STEPPER_DRIVER_INTERRUPT(); } while(0) - //=========================================================================== //=============================functions ============================ //=========================================================================== @@ -350,62 +328,27 @@ FORCE_INLINE void trapezoid_generator_reset() { step_loops_nominal = step_loops; acc_step_rate = current_block->initial_rate; acceleration_time = calc_timer(acc_step_rate); - OCR1A = acceleration_time; - -// SERIAL_ECHO_START; -// SERIAL_ECHOPGM("advance :"); -// SERIAL_ECHO(current_block->advance/256.0); -// SERIAL_ECHOPGM("advance rate :"); -// SERIAL_ECHO(current_block->advance_rate/256.0); -// SERIAL_ECHOPGM("initial advance :"); -// SERIAL_ECHO(current_block->initial_advance/256.0); -// SERIAL_ECHOPGM("final advance :"); -// SERIAL_ECHOLN(current_block->final_advance/256.0); - - #if defined(LIN_ADVANCE) - if (current_block->use_advance_lead) { - current_estep_rate[current_block->active_extruder] = ((unsigned long)acc_step_rate * current_block->abs_adv_steps_multiplier8) >> 17; - final_estep_rate = (current_block->nominal_rate * current_block->abs_adv_steps_multiplier8) >> 17; - } - #endif - + _NEXT_ISR(acceleration_time); + + #ifdef LIN_ADVANCE + if (current_block->use_advance_lead) { + current_estep_rate = ((unsigned long)acc_step_rate * current_block->abs_adv_steps_multiplier8) >> 17; + final_estep_rate = (current_block->nominal_rate * current_block->abs_adv_steps_multiplier8) >> 17; + } + #endif } -/** - * Stepper Driver Interrupt - * - * Directly pulses the stepper motors at high frequency. - * Timer 1 runs at a base frequency of 2MHz, with this ISR using OCR1A compare mode. - * - * OCR1A Frequency - * 1 2 MHz - * 50 40 KHz - * 100 20 KHz - capped max rate - * 200 10 KHz - nominal max rate - * 2000 1 KHz - sleep rate - * 4000 500 Hz - init rate - */ +// "The Stepper Driver Interrupt" - This timer interrupt is the workhorse. +// It pops blocks from the block_buffer and executes them by pulsing the stepper pins appropriately. ISR(TIMER1_COMPA_vect) { - #if defined(LIN_ADVANCE) + #ifdef LIN_ADVANCE advance_isr_scheduler(); #else isr(); #endif } - -// "The Stepper Driver Interrupt" - This timer interrupt is the workhorse. -// It pops blocks from the block_buffer and executes them by pulsing the stepper pins appropriately. -void isr() -{ - -#ifndef LIN_ADVANCE - // Disable Timer0 ISRs and enable global ISR again to capture UART events (incoming chars) - CBI(TIMSK0, OCIE0B); // Temperature ISR - DISABLE_STEPPER_DRIVER_INTERRUPT(); - sei(); - #endif - +void isr() { // If there is no current block, attempt to pop one from the buffer if (current_block == NULL) { // Anything in the buffer? @@ -423,16 +366,13 @@ void isr() #ifdef Z_LATE_ENABLE if(current_block->steps_z > 0) { enable_z(); - OCR1A = 2000; //1ms wait - _ENABLE_ISRs(); + _NEXT_ISR(2000); //1ms wait return; } #endif } else { - OCR1A=2000; // 1kHz. - _ENABLE_ISRs(); - return; + _NEXT_ISR(2000); // 1kHz. } } @@ -598,11 +538,10 @@ void isr() } #endif -#ifndef LIN_ADVANCE if ((out_bits & (1 << E_AXIS)) != 0) { // -direction //AKU - #ifdef SNMM +#ifdef SNMM if (snmm_extruder == 0 || snmm_extruder == 2) { NORM_E_DIR(); @@ -611,14 +550,14 @@ void isr() { REV_E_DIR(); } - #else +#else REV_E_DIR(); - #endif // SNMM +#endif // SNMM count_direction[E_AXIS] = -1; } else { // +direction - #ifdef SNMM +#ifdef SNMM if (snmm_extruder == 0 || snmm_extruder == 2) { REV_E_DIR(); @@ -627,29 +566,25 @@ void isr() { NORM_E_DIR(); } - #else +#else NORM_E_DIR(); - #endif // SNMM +#endif // SNMM count_direction[E_AXIS] = 1; } -#endif for(uint8_t i=0; i < step_loops; i++) { // Take multiple steps per interrupt (For high speed moves) #ifndef AT90USB MSerial.checkRx(); // Check for serial chars. #endif - - #if defined(LIN_ADVANCE) - counter_e += current_block->steps_e; - if (counter_e > 0) { - counter_e -= current_block->step_event_count; - #ifndef MIXING_EXTRUDER - // Don't step E here for mixing extruder - count_position[E_AXIS] += count_direction[E_AXIS]; - motor_direction(E_AXIS) ? --e_steps[TOOL_E_INDEX] : ++e_steps[TOOL_E_INDEX]; - #endif - } - #endif //LIN_ADVANCE + + #ifdef LIN_ADVANCE + counter_e += current_block->steps_e; + if (counter_e > 0) { + counter_e -= current_block->step_event_count; + count_position[E_AXIS] += count_direction[E_AXIS]; + ((out_bits&(1<steps_x; if (counter_x > 0) { @@ -693,7 +628,7 @@ void isr() #endif } - #ifndef LIN_ADVANCE + #ifndef LIN_ADVANCE counter_e += current_block->steps_e; if (counter_e > 0) { WRITE_E_STEP(!INVERT_E_STEP_PIN); @@ -701,10 +636,21 @@ void isr() count_position[E_AXIS]+=count_direction[E_AXIS]; WRITE_E_STEP(INVERT_E_STEP_PIN); } - #endif + #endif step_events_completed += 1; if(step_events_completed >= current_block->step_event_count) break; } + + #ifdef LIN_ADVANCE + if (current_block->use_advance_lead) { + const int delta_adv_steps = current_estep_rate - current_adv_steps; + current_adv_steps += delta_adv_steps; + e_steps += delta_adv_steps; + } + // If we have esteps to execute, fire the next advance_isr "now" + if (e_steps) nextAdvanceISR = 0; + #endif + // Calculare new timer value unsigned short timer; unsigned short step_rate; @@ -719,17 +665,15 @@ void isr() // step_rate to timer interval timer = calc_timer(acc_step_rate); - OCR1A = timer; + _NEXT_ISR(timer); acceleration_time += timer; - - #if defined(LIN_ADVANCE) - - if (current_block->use_advance_lead) - { - current_estep_rate[TOOL_E_INDEX] = ((uint32_t)acc_step_rate * current_block->abs_adv_steps_multiplier8) >> 17; - } - eISR_Rate = ADV_RATE(timer, step_loops); - #endif + + #ifdef LIN_ADVANCE + if (current_block->use_advance_lead) { + current_estep_rate = ((uint32_t)acc_step_rate * current_block->abs_adv_steps_multiplier8) >> 17; + } + eISR_Rate = ADV_RATE(timer, step_loops); + #endif } else if (step_events_completed > (unsigned long int)current_block->decelerate_after) { MultiU24X24toH16(step_rate, deceleration_time, current_block->acceleration_rate); @@ -747,129 +691,64 @@ void isr() // step_rate to timer interval timer = calc_timer(step_rate); - OCR1A = timer; + _NEXT_ISR(timer); deceleration_time += timer; - - #if defined(LIN_ADVANCE) - - if (current_block->use_advance_lead) - { - current_estep_rate[TOOL_E_INDEX] = ((uint32_t)step_rate * current_block->abs_adv_steps_multiplier8) >> 17; - } - eISR_Rate = ADV_RATE(timer, step_loops); - #endif + + #ifdef LIN_ADVANCE + if (current_block->use_advance_lead) { + current_estep_rate = ((uint32_t)step_rate * current_block->abs_adv_steps_multiplier8) >> 17; + } + eISR_Rate = ADV_RATE(timer, step_loops); + #endif } else { - OCR1A = OCR1A_nominal; + #ifdef LIN_ADVANCE + if (current_block->use_advance_lead) + current_estep_rate = final_estep_rate; + + eISR_Rate = ADV_RATE(OCR1A_nominal, step_loops_nominal); + #endif + + _NEXT_ISR(OCR1A_nominal); // ensure we're running at the correct step rate, even if we just came off an acceleration step_loops = step_loops_nominal; } - - #ifndef LIN_ADVANCE - NOLESS(OCR1A, TCNT1 + 16); - #endif // If current block is finished, reset pointer if (step_events_completed >= current_block->step_event_count) { current_block = NULL; plan_discard_current_block(); } - - #ifndef LIN_ADVANCE - _ENABLE_ISRs(); // re-enable ISRs - #endif } } +#ifdef LIN_ADVANCE -#if defined LIN_ADVANCE + // Timer interrupt for E. e_steps is set in the main routine. - #define CYCLES_EATEN_E (E_STEPPERS * 5) - #define EXTRA_CYCLES_E (STEP_PULSE_CYCLES - (CYCLES_EATEN_E)) - - // Timer interrupt for E. e_steps is set in the main routine; - - void advance_isr() - { + void advance_isr() { nextAdvanceISR = eISR_Rate; - #define SET_E_STEP_DIR(INDEX) \ - if (e_steps[INDEX]) E## INDEX ##_DIR_WRITE(e_steps[INDEX] < 0 ? INVERT_E## INDEX ##_DIR : !INVERT_E## INDEX ##_DIR) - - #define START_E_PULSE(INDEX) \ - if (e_steps[INDEX]) E## INDEX ##_STEP_WRITE(!INVERT_E_STEP_PIN) - - #define STOP_E_PULSE(INDEX) \ - if (e_steps[INDEX]) { \ - e_steps[INDEX] < 0 ? ++e_steps[INDEX] : --e_steps[INDEX]; \ - E## INDEX ##_STEP_WRITE(INVERT_E_STEP_PIN); \ + if (e_steps) { + bool dir = + #ifdef SNMM + ((e_steps < 0) == (snmm_extruder & 1)) + #else + (e_steps < 0) + #endif + ? INVERT_E0_DIR : !INVERT_E0_DIR; //If we have SNMM, reverse every second extruder. + WRITE(E0_DIR_PIN, dir); + + for (uint8_t i = step_loops; e_steps && i--;) { + WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN); + e_steps < 0 ? ++e_steps : --e_steps; + WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN); } - - SET_E_STEP_DIR(0); - #if E_STEPPERS > 1 - SET_E_STEP_DIR(1); - #if E_STEPPERS > 2 - SET_E_STEP_DIR(2); - #if E_STEPPERS > 3 - SET_E_STEP_DIR(3); - #endif - #endif - #endif - - // Step all E steppers that have steps - for (uint8_t i = step_loops; i--;) { - - #if EXTRA_CYCLES_E > 20 - uint32_t pulse_start = TCNT0; - #endif - - START_E_PULSE(0); - #if E_STEPPERS > 1 - START_E_PULSE(1); - #if E_STEPPERS > 2 - START_E_PULSE(2); - #if E_STEPPERS > 3 - START_E_PULSE(3); - #endif - #endif - #endif - - // For minimum pulse time wait before stopping pulses - #if EXTRA_CYCLES_E > 20 - while (EXTRA_CYCLES_E > (uint32_t)(TCNT0 - pulse_start) * (INT0_PRESCALER)) { /* nada */ } - pulse_start = TCNT0; - #elif EXTRA_CYCLES_E > 0 - DELAY_NOPS(EXTRA_CYCLES_E); - #endif - - STOP_E_PULSE(0); - #if E_STEPPERS > 1 - STOP_E_PULSE(1); - #if E_STEPPERS > 2 - STOP_E_PULSE(2); - #if E_STEPPERS > 3 - STOP_E_PULSE(3); - #endif - #endif - #endif - - // For minimum pulse time wait before looping - #if EXTRA_CYCLES_E > 20 - if (i) while (EXTRA_CYCLES_E > (uint32_t)(TCNT0 - pulse_start) * (INT0_PRESCALER)) { /* nada */ } - #elif EXTRA_CYCLES_E > 0 - if (i) DELAY_NOPS(EXTRA_CYCLES_E); - #endif - - } // steps_loop + } } void advance_isr_scheduler() { - // Disable Timer0 ISRs and enable global ISR again to capture UART events (incoming chars) - CBI(TIMSK0, OCIE0B); // Temperature ISR - DISABLE_STEPPER_DRIVER_INTERRUPT(); - sei(); - // Run main stepping ISR if flagged if (!nextMainISR) isr(); @@ -896,13 +775,15 @@ void isr() } // Don't run the ISR faster than possible - NOLESS(OCR1A, TCNT1 + 16); - - // Restore original ISR settings - _ENABLE_ISRs(); + if (OCR1A < TCNT1 + 16) OCR1A = TCNT1 + 16; + } + + void clear_current_adv_vars() { + e_steps = 0; //Should be already 0 at an filament change event, but just to be sure.. + current_adv_steps = 0; } -#endif // ADVANCE or LIN_ADVANCE +#endif // LIN_ADVANCE void st_init() { @@ -1092,16 +973,11 @@ void st_init() TCNT1 = 0; ENABLE_STEPPER_DRIVER_INTERRUPT(); - #ifdef LIN_ADVANCE - #if defined(TCCR0A) && defined(WGM01) - TCCR0A &= ~(1< 2 #define WRITE_E_STEP(v) { if(current_block->active_extruder == 2) { WRITE(E2_STEP_PIN, v); } else { if(current_block->active_extruder == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}} @@ -42,31 +41,19 @@ extern bool abort_on_endstop_hit; #endif - #if defined(LIN_ADVANCE) - extern uint16_t nextMainISR, nextAdvanceISR, eISR_Rate; - #define _NEXT_ISR(T) nextMainISR = T - #if defined(LIN_ADVANCE) - extern volatile int e_steps[EXTRUDERS]; - extern int final_estep_rate; - extern int current_estep_rate[EXTRUDERS]; // Actual extruder speed [steps/s] - extern int current_adv_steps[EXTRUDERS]; // The amount of current added esteps due to advance. - // i.e., the current amount of pressure applied - // to the spring (=filament). - #endif -#else - #define _NEXT_ISR(T) OCR1A = T -#endif // ADVANCE or LIN_ADVANCE - -#if defined(LIN_ADVANCE) - extern void advance_isr(); - extern void advance_isr_scheduler(); -#endif - extern unsigned char last_direction_bits; // The next stepping-bits to be output - - // Initialize and start the stepper motor subsystem void st_init(); +// Interrupt Service Routines + +void isr(); + +#ifdef LIN_ADVANCE + void advance_isr(); + void advance_isr_scheduler(); + void clear_current_adv_vars(); //Used to reset the built up pretension and remaining esteps on filament change. +#endif + // Block until all buffered steps are executed void st_synchronize(); diff --git a/Firmware/stepper_indirection.h b/Firmware/stepper_indirection.h deleted file mode 100644 index a540980c3..000000000 --- a/Firmware/stepper_indirection.h +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - stepper_indirection.h - stepper motor driver indirection macros - to allow some stepper functions to be done via SPI/I2c instead of direct pin manipulation - Part of Marlin - - Copyright (c) 2015 Dominik Wenger - - Marlin is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Marlin is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Marlin. If not, see . -*/ - -#ifndef STEPPER_INDIRECTION_H -#define STEPPER_INDIRECTION_H - -#if defined(HAVE_TMC2130) - #include "TMC2130Stepper.h" - void tmc2130_init(); -#endif - -// X Stepper - #if defined(HAVE_TMC2130) && defined(X_IS_TMC2130) - extern TMC2130Stepper stepperX; - #endif - -#define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN) -#define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE) -#define X_ENABLE_READ READ(X_ENABLE_PIN) - -#define X_DIR_INIT SET_OUTPUT(X_DIR_PIN) -#define X_DIR_WRITE(STATE) WRITE(X_DIR_PIN,STATE) -#define X_DIR_READ READ(X_DIR_PIN) - -#define X_STEP_INIT SET_OUTPUT(X_STEP_PIN) -#define X_STEP_WRITE(STATE) WRITE(X_STEP_PIN,STATE) -#define X_STEP_READ READ(X_STEP_PIN) - -// Y Stepper - #if defined(HAVE_TMC2130) && defined(Y_IS_TMC2130) - extern TMC2130Stepper stepperY; - #endif - -#define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN) -#define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE) -#define Y_ENABLE_READ READ(Y_ENABLE_PIN) - -#define Y_DIR_INIT SET_OUTPUT(Y_DIR_PIN) -#define Y_DIR_WRITE(STATE) WRITE(Y_DIR_PIN,STATE) -#define Y_DIR_READ READ(Y_DIR_PIN) - -#define Y_STEP_INIT SET_OUTPUT(Y_STEP_PIN) -#define Y_STEP_WRITE(STATE) WRITE(Y_STEP_PIN,STATE) -#define Y_STEP_READ READ(Y_STEP_PIN) - -// Z Stepper - #if defined(HAVE_TMC2130) && defined(Z_IS_TMC2130) - extern TMC2130Stepper stepperZ; - #endif - -#define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN) -#define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE) -#define Z_ENABLE_READ READ(Z_ENABLE_PIN) - -#define Z_DIR_INIT SET_OUTPUT(Z_DIR_PIN) -#define Z_DIR_WRITE(STATE) WRITE(Z_DIR_PIN,STATE) -#define Z_DIR_READ READ(Z_DIR_PIN) - -#define Z_STEP_INIT SET_OUTPUT(Z_STEP_PIN) -#define Z_STEP_WRITE(STATE) WRITE(Z_STEP_PIN,STATE) -#define Z_STEP_READ READ(Z_STEP_PIN) - -// E0 Stepper - #if defined(HAVE_TMC2130) && defined(E0_IS_TMC2130) - extern TMC2130Stepper stepperE0; - #endif -#define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN) -#define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE) -#define E0_ENABLE_READ READ(E0_ENABLE_PIN) - -#define E0_DIR_INIT SET_OUTPUT(E0_DIR_PIN) -#define E0_DIR_WRITE(STATE) WRITE(E0_DIR_PIN,STATE) -#define E0_DIR_READ READ(E0_DIR_PIN) - -#define E0_STEP_INIT SET_OUTPUT(E0_STEP_PIN) -#define E0_STEP_WRITE(STATE) WRITE(E0_STEP_PIN,STATE) -#define E0_STEP_READ READ(E0_STEP_PIN) - -#endif // STEPPER_INDIRECTION_H diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f7f45c78f..20314a2f3 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -563,7 +563,7 @@ void lcd_commands() enquecommand(cmd1); if (axis_relative_modes[3] == true) enquecommand_P(PSTR("M83")); // set extruder to relative mode. else enquecommand_P(PSTR("M82")); // set extruder to absolute mode - enquecommand_P(PSTR("G1 E" STRINGIFY(DEFAULT_RETRACTION))); //unretract + enquecommand_P(PSTR("G1 E" STRINGIFY((is_multi_material) ? DEFAULT_RETRACTION_MM : DEFAULT_RETRACTION_SM))); //unretract enquecommand_P(PSTR("G90")); //absolute positioning lcd_commands_step = 1; } @@ -641,7 +641,7 @@ void lcd_commands() #endif lcd_ignore_click(false); #ifdef SNMM - lcd_commands_step = 7; + lcd_commands_step = 8; #else lcd_commands_step = 3; #endif @@ -672,9 +672,17 @@ void lcd_commands() lcd_commands_step = 5; } if (lcd_commands_step == 7 && !blocks_queued()) { - enquecommand_P(PSTR("M702")); + switch(snmm_stop_print_menu()) { + case 0: enquecommand_P(PSTR("M702")); break;//all + case 1: enquecommand_P(PSTR("M702 U")); break; //used + case 2: enquecommand_P(PSTR("M702 C")); break; //current + default: enquecommand_P(PSTR("M702")); break; + } lcd_commands_step = 3; } + if (lcd_commands_step == 8 && !blocks_queued()) { //step 8 is here for delay (going to next step after execution of all gcodes from step 4) + lcd_commands_step = 7; + } } if (lcd_commands_type == 3) @@ -975,7 +983,10 @@ static void lcd_support_menu() MENU_ITEM(back, PSTR("FlashAir IP Addr:"), lcd_main_menu); MENU_ITEM(back_RAM, menuData.supportMenu.ip_str, lcd_main_menu); } - + #ifndef MK1BP + MENU_ITEM(back, PSTR("------------"), lcd_main_menu); + MENU_ITEM(function, PSTR("XYZ cal. details"), lcd_service_mode_show_result); + #endif //MK1BP END_MENU(); } @@ -1380,6 +1391,57 @@ static void lcd_move_e() } } +void lcd_service_mode_show_result() { + lcd_set_custom_characters_degree(); + count_xyz_details(); + lcd_update_enable(false); + lcd_implementation_clear(); + lcd_printPGM(PSTR("Y distance from min:")); + lcd_print_at_PGM(0, 1, PSTR("Left:")); + lcd_print_at_PGM(0, 2, PSTR("Center:")); + lcd_print_at_PGM(0, 3, PSTR("Right:")); + for (int i = 0; i < 3; i++) { + if(distance_from_min[i] < 200) { + lcd_print_at_PGM(8, i + 1, PSTR("")); + lcd.print(distance_from_min[i]); + lcd_print_at_PGM((distance_from_min[i] < 0) ? 14 : 13, i + 1, PSTR("mm")); + } else lcd_print_at_PGM(8, i + 1, PSTR("N/A")); + } + delay_keep_alive(500); + while (!lcd_clicked()) { + delay_keep_alive(100); + } + delay_keep_alive(500); + lcd_implementation_clear(); + + + lcd_printPGM(PSTR("Measured skew: ")); + if (angleDiff < 100) { + lcd.print(angleDiff * 180 / M_PI); + lcd.print(LCD_STR_DEGREE); + }else lcd_print_at_PGM(15, 0, PSTR("N/A")); + lcd_print_at_PGM(0, 1, PSTR("--------------------")); + lcd_print_at_PGM(0, 2, PSTR("Slight skew:")); + lcd_print_at_PGM(15, 2, PSTR("")); + lcd.print(bed_skew_angle_mild * 180 / M_PI); + lcd.print(LCD_STR_DEGREE); + lcd_print_at_PGM(0, 3, PSTR("Severe skew:")); + lcd_print_at_PGM(15, 3, PSTR("")); + lcd.print(bed_skew_angle_extreme * 180 / M_PI); + lcd.print(LCD_STR_DEGREE); + delay_keep_alive(500); + while (!lcd_clicked()) { + delay_keep_alive(100); + } + delay_keep_alive(500); + lcd_set_custom_characters_arrows(); + lcd_return_to_status(); + lcd_update_enable(true); + lcd_update(2); +} + + + // Save a single axis babystep value. void EEPROM_save_B(int pos, int* value) @@ -2626,11 +2688,11 @@ static void lcd_calibration_menu() if (!isPrintPaused) { MENU_ITEM(function, MSG_SELFTEST, lcd_selftest); -#ifndef MESH_BED_LEVELING +#ifdef MK1BP // MK1 // "Calibrate Z" MENU_ITEM(gcode, MSG_HOMEYZ, PSTR("G28 Z")); -#else +#else //MK1BP // MK2 MENU_ITEM(function, MSG_CALIBRATE_BED, lcd_mesh_calibration); // "Calibrate Z" with storing the reference values to EEPROM. @@ -2641,14 +2703,17 @@ MENU_ITEM(function, MSG_CALIBRATE_BED, lcd_mesh_calibration); #endif // "Mesh Bed Leveling" MENU_ITEM(submenu, MSG_MESH_BED_LEVELING, lcd_mesh_bedleveling); -#endif +#endif //MK1BP MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28 W")); MENU_ITEM(submenu, MSG_BED_CORRECTION_MENU, lcd_adjust_bed); +#ifndef MK1BP MENU_ITEM(submenu, MSG_CALIBRATION_PINDA_MENU, lcd_pinda_calibration_menu); +#endif //MK1BP MENU_ITEM(submenu, MSG_PID_EXTRUDER, pid_extruder); - MENU_ITEM(submenu, MSG_PID_BED, pid_bed); MENU_ITEM(submenu, MSG_SHOW_END_STOPS, menu_show_end_stops); +#ifndef MK1BP MENU_ITEM(gcode, MSG_CALIBRATE_BED_RESET, PSTR("M44")); +#endif //MK1BP #ifndef SNMM //MENU_ITEM(function, MSG_RESET_CALIBRATE_E, lcd_extr_cal_reset); #endif @@ -2954,6 +3019,138 @@ void bowden_menu() { } } +static char snmm_stop_print_menu() { //menu for choosing which filaments will be unloaded in stop print + lcd_implementation_clear(); + lcd_print_at_PGM(0,0,MSG_UNLOAD_FILAMENT); lcd.print(":"); + lcd.setCursor(0, 1); lcd.print(">"); + lcd_print_at_PGM(1,1,MSG_ALL); + lcd_print_at_PGM(1,2,MSG_USED); + lcd_print_at_PGM(1,3,MSG_CURRENT); + char cursor_pos = 1; + int enc_dif = 0; + + while (1) { + manage_heater(); + manage_inactivity(true); + if (abs((enc_dif - encoderDiff)) > 4) { + + if ((abs(enc_dif - encoderDiff)) > 1) { + if (enc_dif > encoderDiff) cursor_pos--; + if (enc_dif < encoderDiff) cursor_pos++; + if (cursor_pos > 3) cursor_pos = 3; + if (cursor_pos < 1) cursor_pos = 1; + + lcd.setCursor(0, 1); + lcd.print(" "); + lcd.setCursor(0, 2); + lcd.print(" "); + lcd.setCursor(0, 3); + lcd.print(" "); + lcd.setCursor(0, cursor_pos); + lcd.print(">"); + enc_dif = encoderDiff; + delay(100); + } + } + if (lcd_clicked()) { + while (lcd_clicked()); + delay(10); + while (lcd_clicked()); + return(cursor_pos - 1); + } + } + +} + +char choose_extruder_menu() { + + int items_no = 4; + int first = 0; + int enc_dif = 0; + char cursor_pos = 1; + + enc_dif = encoderDiff; + lcd_implementation_clear(); + + lcd_printPGM(MSG_CHOOSE_EXTRUDER); + lcd.setCursor(0, 1); + lcd.print(">"); + for (int i = 0; i < 3; i++) { + lcd_print_at_PGM(1, i + 1, MSG_EXTRUDER); + } + + while (1) { + + for (int i = 0; i < 3; i++) { + lcd.setCursor(2 + strlen_P(MSG_EXTRUDER), i+1); + lcd.print(first + i + 1); + } + + manage_heater(); + manage_inactivity(true); + + if (abs((enc_dif - encoderDiff)) > 4) { + + if ((abs(enc_dif - encoderDiff)) > 1) { + if (enc_dif > encoderDiff) { + cursor_pos--; + } + + if (enc_dif < encoderDiff) { + cursor_pos++; + } + + if (cursor_pos > 3) { + cursor_pos = 3; + if (first < items_no - 3) { + first++; + lcd_implementation_clear(); + lcd_printPGM(MSG_CHOOSE_EXTRUDER); + for (int i = 0; i < 3; i++) { + lcd_print_at_PGM(1, i + 1, MSG_EXTRUDER); + } + } + } + + if (cursor_pos < 1) { + cursor_pos = 1; + if (first > 0) { + first--; + lcd_implementation_clear(); + lcd_printPGM(MSG_CHOOSE_EXTRUDER); + for (int i = 0; i < 3; i++) { + lcd_print_at_PGM(1, i + 1, MSG_EXTRUDER); + } + } + } + lcd.setCursor(0, 1); + lcd.print(" "); + lcd.setCursor(0, 2); + lcd.print(" "); + lcd.setCursor(0, 3); + lcd.print(" "); + lcd.setCursor(0, cursor_pos); + lcd.print(">"); + enc_dif = encoderDiff; + delay(100); + } + + } + + if (lcd_clicked()) { + lcd_update(2); + while (lcd_clicked()); + delay(10); + while (lcd_clicked()); + return(cursor_pos + first - 1); + + } + + } + +} + + char reset_menu() { #ifdef SNMM int items_no = 5; @@ -3094,31 +3291,26 @@ void change_extr(int extr) { //switches multiplexer for extruders pinMode(E_MUX0_PIN, OUTPUT); pinMode(E_MUX1_PIN, OUTPUT); - pinMode(E_MUX2_PIN, OUTPUT); switch (extr) { case 1: WRITE(E_MUX0_PIN, HIGH); WRITE(E_MUX1_PIN, LOW); - WRITE(E_MUX2_PIN, LOW); break; case 2: WRITE(E_MUX0_PIN, LOW); WRITE(E_MUX1_PIN, HIGH); - WRITE(E_MUX2_PIN, LOW); break; case 3: WRITE(E_MUX0_PIN, HIGH); WRITE(E_MUX1_PIN, HIGH); - WRITE(E_MUX2_PIN, LOW); break; default: WRITE(E_MUX0_PIN, LOW); WRITE(E_MUX1_PIN, LOW); - WRITE(E_MUX2_PIN, LOW); break; } @@ -3126,7 +3318,7 @@ void change_extr(int extr) { //switches multiplexer for extruders } static int get_ext_nr() { //reads multiplexer input pins and return current extruder number (counted from 0) - return(4 * READ(E_MUX2_PIN) + 2 * READ(E_MUX1_PIN) + READ(E_MUX0_PIN)); + return(2 * READ(E_MUX1_PIN) + READ(E_MUX0_PIN)); } @@ -3180,7 +3372,7 @@ static void extr_adj(int extruder) //loading filament for SNMM } -static void extr_unload() { //unloads filament +void extr_unload() { //unloads filament float tmp_motor[3] = DEFAULT_PWM_MOTOR_CURRENT; float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD; int8_t SilentMode; @@ -3318,6 +3510,30 @@ void extr_unload_all() { } } +//unloading just used filament (for snmm) + +void extr_unload_used() { + if (degHotend0() > EXTRUDE_MINTEMP) { + for (int i = 0; i < 4; i++) { + if (snmm_filaments_used & (1 << i)) { + change_extr(i); + extr_unload(); + } + } + snmm_filaments_used = 0; + } + else { + lcd_implementation_clear(); + lcd.setCursor(0, 0); + lcd_printPGM(MSG_ERROR); + lcd.setCursor(0, 2); + lcd_printPGM(MSG_PREHEAT_NOZZLE); + delay(2000); + lcd_implementation_clear(); + lcd_return_to_status(); + } +} + static void extr_unload_0() { @@ -3351,7 +3567,6 @@ static void fil_load_menu() END_MENU(); } - static void fil_unload_menu() { START_MENU(); @@ -3368,10 +3583,10 @@ static void fil_unload_menu() static void change_extr_menu(){ START_MENU(); MENU_ITEM(back, MSG_MAIN, lcd_main_menu); - MENU_ITEM(function, PSTR("Extruder 1"), extr_change_0); - MENU_ITEM(function, PSTR("Extruder 2"), extr_change_1); - MENU_ITEM(function, PSTR("Extruder 3"), extr_change_2); - MENU_ITEM(function, PSTR("Extruder 4"), extr_change_3); + MENU_ITEM(function, MSG_EXTRUDER_1, extr_change_0); + MENU_ITEM(function, MSG_EXTRUDER_2, extr_change_1); + MENU_ITEM(function, MSG_EXTRUDER_3, extr_change_2); + MENU_ITEM(function, MSG_EXTRUDER_4, extr_change_3); END_MENU(); } @@ -3720,11 +3935,6 @@ static void lcd_tune_menu() } else { MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set_tune); } - - #if defined(LIN_ADVANCE) - MENU_ITEM_EDIT(float3, MSG_ADVANCE_K, &extruder_advance_k, 0, 999); - MENU_ITEM_EDIT(float3, MSG_E_D_RATIO, &advance_ed_ratio, 0, 999); - #endif END_MENU(); } @@ -4116,7 +4326,7 @@ static void lcd_selftest() } if (_result) - { + { _progress = lcd_selftest_screen(5, _progress, 3, true, 2000); _result = lcd_selfcheck_check_heater(true); } @@ -4313,10 +4523,11 @@ static bool lcd_selfcheck_endstops() if (READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1 || READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1 || READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) { _result = false; - String _error = String((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1) ? "X" : "") + - String((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1) ? "Y" : "") + - String((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) ? "Z" : ""); - lcd_selftest_error(3, _error.c_str(), ""); + char _error[4] = ""; + if (READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1) strcat(_error, "X"); + if (READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1) strcat(_error, "Y"); + if (READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) strcat(_error, "Z"); + lcd_selftest_error(3, _error, ""); } manage_heater(); manage_inactivity(true); @@ -4332,9 +4543,9 @@ static bool lcd_selfcheck_check_heater(bool _isbed) int _checked_snapshot = (_isbed) ? degBed() : degHotend(0); int _opposite_snapshot = (_isbed) ? degHotend(0) : degBed(); - int _cycles = (_isbed) ? 120 : 30; + int _cycles = (_isbed) ? 180 : 60; //~ 90s / 30s - target_temperature[0] = (_isbed) ? 0 : 100; + target_temperature[0] = (_isbed) ? 0 : 200; target_temperature_bed = (_isbed) ? 100 : 0; manage_heater(); manage_inactivity(true); @@ -4346,8 +4557,16 @@ static bool lcd_selfcheck_check_heater(bool _isbed) manage_heater(); manage_inactivity(true); _progress = (_isbed) ? lcd_selftest_screen(5, _progress, 2, false, 400) : lcd_selftest_screen(1, _progress, 2, false, 400); + /*if (_isbed) { + MYSERIAL.print("Bed temp:"); + MYSERIAL.println(degBed()); + } + else { + MYSERIAL.print("Hotend temp:"); + MYSERIAL.println(degHotend(0)); + }*/ - } while (_docycle); + } while (_docycle); target_temperature[0] = 0; target_temperature_bed = 0; @@ -4355,7 +4574,13 @@ static bool lcd_selfcheck_check_heater(bool _isbed) int _checked_result = (_isbed) ? degBed() - _checked_snapshot : degHotend(0) - _checked_snapshot; int _opposite_result = (_isbed) ? degHotend(0) - _opposite_snapshot : degBed() - _opposite_snapshot; - + /* + MYSERIAL.println(""); + MYSERIAL.print("Checked result:"); + MYSERIAL.println(_checked_result); + MYSERIAL.print("Opposite result:"); + MYSERIAL.println(_opposite_result); + */ if (_opposite_result < ((_isbed) ? 10 : 3)) { if (_checked_result >= ((_isbed) ? 3 : 10)) diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 4ad876521..3d2ab5fc5 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -223,8 +223,10 @@ static void extr_unload_1(); static void extr_unload_2(); static void extr_unload_3(); static void lcd_disable_farm_mode(); -void extr_unload_all(); -static void extr_unload(); +void extr_unload_all(); +void extr_unload_used(); +void extr_unload(); +static char snmm_stop_print_menu(); void stack_error(); static void lcd_ping_allert(); @@ -247,6 +249,7 @@ union MenuData; void bowden_menu(); char reset_menu(); +char choose_extruder_menu(); void lcd_pinda_calibration_menu(); void lcd_calibrate_pinda(); @@ -254,4 +257,6 @@ void lcd_temp_calibration_set(); void display_loading(); +void lcd_service_mode_show_result(); + #endif //ULTRALCD_H \ No newline at end of file diff --git a/Firmware/variants/1_75mm_MK1-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK1-RAMBo10a-E3Dv6full.h new file mode 100644 index 000000000..ba9f55289 --- /dev/null +++ b/Firmware/variants/1_75mm_MK1-RAMBo10a-E3Dv6full.h @@ -0,0 +1,404 @@ +#ifndef CONFIGURATION_PRUSA_H +#define CONFIGURATION_PRUSA_H + +/*------------------------------------ +GENERAL SETTINGS +*------------------------------------*/ + +// Printer revision +#define FILAMENT_SIZE "1_75mm_MK1" +#define NOZZLE_TYPE "E3Dv6full" + +// Developer flag +#define DEVELOPER + +// Printer name +#define CUSTOM_MENDEL_NAME "Prusa i3 MK1" + +// Electronics +#define MOTHERBOARD BOARD_RAMBO_MINI_1_0 + +// MK1 back port +#define MK1BP + +// Prusa Single extruder multiple material suport +//#define SNMM + +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + + +/*------------------------------------ +AXIS SETTINGS +*------------------------------------*/ + +// Steps per unit {X,Y,Z,E} +#ifdef SNMM +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/0.8,140} +#else +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/0.8,174.2} +#endif + + +// Endstop inverting +const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. + +// Home position +#define MANUAL_X_HOME_POS 0 +#define MANUAL_Y_HOME_POS 0 +#define MANUAL_Z_HOME_POS 0.25 + +// Travel limits after homing +#define X_MAX_POS 214 +#define X_MIN_POS 0 +#define Y_MAX_POS 198 +#define Y_MIN_POS 0 +#define Z_MAX_POS 201 +#define Z_MIN_POS 0.23 + +// Canceled home position +#define X_CANCEL_POS 50 +#define Y_CANCEL_POS 190 + +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + +#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +#define HOMING_FEEDRATE {3000, 3000, 240, 0} // set the homing speeds (mm/min) + +#define DEFAULT_MAX_FEEDRATE {500, 500, 3, 25} // (mm/sec) +#define DEFAULT_MAX_ACCELERATION {9000,9000,30,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. + +#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for retracts + + +#define MANUAL_FEEDRATE {3000, 3000, 240, 60} // set the speeds for manual moves (mm/min) + +#define Z_AXIS_ALWAYS_ON 1 + +/*------------------------------------ +EXTRUDER SETTINGS +*------------------------------------*/ + +// Mintemps +#define HEATER_0_MINTEMP 15 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define BED_MINTEMP 15 + +// Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else +#define HEATER_0_MAXTEMP 305 +#endif +#define HEATER_1_MAXTEMP 305 +#define HEATER_2_MAXTEMP 305 +#define BED_MAXTEMP 150 + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else +// Define PID constants for extruder +#define DEFAULT_Kp 40.925 +#define DEFAULT_Ki 4.875 +#define DEFAULT_Kd 86.085 +#endif + +// Extrude mintemp +#define EXTRUDE_MINTEMP 190 + +// Extruder cooling fans +#define EXTRUDER_0_AUTO_FAN_PIN 8 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed + + + + + + +#ifdef SNMM +//#define BOWDEN_LENGTH 408 +#define BOWDEN_LENGTH 433 //default total length for filament fast loading part; max length for extrusion is 465 mm!; this length can be adjusted in service menu +#define FIL_LOAD_LENGTH 102 //length for loading filament into the nozzle +#define FIL_COOLING 10 //length for cooling moves +#define E_MOTOR_LOW_CURRENT 350 // current for PRUSAY code +#define E_MOTOR_HIGH_CURRENT 700 //current for unloading filament, stop print, PRUSAY ramming +#endif //SNMM + +//#define DIS //for measuring bed heigth and PINDa detection heigth relative to auto home point, experimental function + + +/*------------------------------------ +CHANGE FILAMENT SETTINGS +*------------------------------------*/ + +// Filament change configuration +#define FILAMENTCHANGEENABLE +#ifdef FILAMENTCHANGEENABLE +#define FILAMENTCHANGE_XPOS 211 +#define FILAMENTCHANGE_YPOS 0 +#define FILAMENTCHANGE_ZADD 2 +#define FILAMENTCHANGE_FIRSTRETRACT -2 +#define FILAMENTCHANGE_FINALRETRACT -80 + +#define FILAMENTCHANGE_FIRSTFEED 70 +#define FILAMENTCHANGE_FINALFEED 50 +#define FILAMENTCHANGE_RECFEED 5 + +#define FILAMENTCHANGE_XYFEED 50 +#define FILAMENTCHANGE_EFEED 20 +#define FILAMENTCHANGE_RFEED 400 +#define FILAMENTCHANGE_EXFEED 2 +#define FILAMENTCHANGE_ZFEED 15 + +#endif + +/*------------------------------------ +ADDITIONAL FEATURES SETTINGS +*------------------------------------*/ + +// Define Prusa filament runout sensor +//#define FILAMENT_RUNOUT_SUPPORT + +#ifdef FILAMENT_RUNOUT_SUPPORT +#define FILAMENT_RUNOUT_SENSOR 1 +#endif + +// temperature runaway +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 + +#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 +#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 + +/*------------------------------------ +MOTOR CURRENT SETTINGS +*------------------------------------*/ + +// Motor Current setting for BIG RAMBo +#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +#define DIGIPOT_MOTOR_CURRENT_LOUD {135,135,135,135,135} + +// Motor Current settings for RAMBo mini PWM value = MotorCurrentSetting * 255 / range +#if MOTHERBOARD == 102 || MOTHERBOARD == 302 +#define MOTOR_CURRENT_PWM_RANGE 2000 +#define DEFAULT_PWM_MOTOR_CURRENT {270, 830, 450} // {XY,Z,E} +#define DEFAULT_PWM_MOTOR_CURRENT_LOUD {540, 830, 500} // {XY,Z,E} +#endif + +/*------------------------------------ +BED SETTINGS +*------------------------------------*/ + +// Define Mesh Bed Leveling system to enable it +#define MESH_BED_LEVELING +#ifdef MESH_BED_LEVELING + +#define MBL_Z_STEP 0.01 + +// Mesh definitions +#define MESH_MIN_X 35 +#define MESH_MAX_X 238 +#define MESH_MIN_Y 6 +#define MESH_MAX_Y 202 + +// Mesh upsample definition +#define MESH_NUM_X_POINTS 7 +#define MESH_NUM_Y_POINTS 7 +// Mesh measure definition +#define MESH_MEAS_NUM_X_POINTS 3 +#define MESH_MEAS_NUM_Y_POINTS 3 + +#define MESH_HOME_Z_CALIB 0.2 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. + +#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right +#define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind +#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) +#endif + +// Bed Temperature Control +// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis +// +// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. +// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating. +// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. +// If your configuration is significantly different than this and you don't understand the issues involved, you probably +// shouldn't use bed PID until someone else verifies your hardware works. +// If this is enabled, find your own PID constants below. +#define PIDTEMPBED +// +//#define BED_LIMIT_SWITCHING + +// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option. +// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis) +// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did, +// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED) +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +// Bed temperature compensation settings +#define BED_OFFSET 10 +#define BED_OFFSET_START 40 +#define BED_OFFSET_CENTER 50 + + +#ifdef PIDTEMPBED +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else +#define DEFAULT_bedKp 126.13 +#define DEFAULT_bedKi 4.30 +#define DEFAULT_bedKd 924.76 +#endif + +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from pidautotune +// #define DEFAULT_bedKp 97.1 +// #define DEFAULT_bedKi 1.41 +// #define DEFAULT_bedKd 1675.16 + +// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + + +/*----------------------------------- +PREHEAT SETTINGS +*------------------------------------*/ + +#define PLA_PREHEAT_HOTEND_TEMP 215 +#define PLA_PREHEAT_HPB_TEMP 55 +#define PLA_PREHEAT_FAN_SPEED 0 + +#define ABS_PREHEAT_HOTEND_TEMP 255 +#define ABS_PREHEAT_HPB_TEMP 100 +#define ABS_PREHEAT_FAN_SPEED 0 + +#define HIPS_PREHEAT_HOTEND_TEMP 220 +#define HIPS_PREHEAT_HPB_TEMP 100 +#define HIPS_PREHEAT_FAN_SPEED 0 + +#define PP_PREHEAT_HOTEND_TEMP 254 +#define PP_PREHEAT_HPB_TEMP 100 +#define PP_PREHEAT_FAN_SPEED 0 + +#define PET_PREHEAT_HOTEND_TEMP 240 +#define PET_PREHEAT_HPB_TEMP 90 +#define PET_PREHEAT_FAN_SPEED 0 + +#define FLEX_PREHEAT_HOTEND_TEMP 230 +#define FLEX_PREHEAT_HPB_TEMP 50 +#define FLEX_PREHEAT_FAN_SPEED 0 + +/*------------------------------------ +THERMISTORS SETTINGS +*------------------------------------*/ + +// +//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table +// +//// Temperature sensor settings: +// -2 is thermocouple with MAX6675 (only for sensor 0) +// -1 is thermocouple with AD595 +// 0 is not used +// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) +// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) +// 3 is Mendel-parts thermistor (4.7k pullup) +// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! +// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) +// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) +// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) +// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) +// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) +// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) +// 10 is 100k RS thermistor 198-961 (4.7k pullup) +// 11 is 100k beta 3950 1% thermistor (4.7k pullup) +// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 20 is the PT100 circuit found in the Ultimainboard V2.x +// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 +// +// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k +// (but gives greater accuracy and more stable PID) +// 51 is 100k thermistor - EPCOS (1k pullup) +// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) +// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) +// +// 1047 is Pt1000 with 4k7 pullup +// 1010 is Pt1000 with 1k pullup (non standard) +// 147 is Pt100 with 4k7 pullup +// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.0a +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier +// 110 is Pt100 with 1k pullup (non standard) + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 148 +#else +#define TEMP_SENSOR_0 5 +#endif +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 148 +#else +#define TEMP_SENSOR_BED 1 +#endif + +#define STACK_GUARD_TEST_VALUE 0xA2A2 + +#define MAX_BED_TEMP_CALIBRATION 50 +#define MAX_HOTEND_TEMP_CALIBRATION 50 + +#define MAX_E_STEPS_PER_UNIT 250 +#define MIN_E_STEPS_PER_UNIT 100 + +#define Z_BABYSTEP_MIN -3999 +#define Z_BABYSTEP_MAX 0 + +#define PINDA_PREHEAT_X 70 +#define PINDA_PREHEAT_Y -3 +#define PINDA_PREHEAT_Z 1 +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + +#define PING_TIME 60 //time in s +#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes +#define PING_ALLERT_PERIOD 60 //time in s + +#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release + +#define PAUSE_RETRACT 1 + +#define DEFAULT_PID_TEMP 210 + +#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration + +#endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK1-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK1-RAMBo13a-E3Dv6full.h new file mode 100644 index 000000000..1822a9d73 --- /dev/null +++ b/Firmware/variants/1_75mm_MK1-RAMBo13a-E3Dv6full.h @@ -0,0 +1,404 @@ +#ifndef CONFIGURATION_PRUSA_H +#define CONFIGURATION_PRUSA_H + +/*------------------------------------ +GENERAL SETTINGS +*------------------------------------*/ + +// Printer revision +#define FILAMENT_SIZE "1_75mm_MK1" +#define NOZZLE_TYPE "E3Dv6full" + +// Developer flag +#define DEVELOPER + +// Printer name +#define CUSTOM_MENDEL_NAME "Prusa i3 MK1" + +// Electronics +#define MOTHERBOARD BOARD_RAMBO_MINI_1_3 + +// MK1 back port +#define MK1BP + +// Prusa Single extruder multiple material suport +//#define SNMM + +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + + +/*------------------------------------ +AXIS SETTINGS +*------------------------------------*/ + +// Steps per unit {X,Y,Z,E} +#ifdef SNMM +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/0.8,140} +#else +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/0.8,174.2} +#endif + + +// Endstop inverting +const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. + +// Home position +#define MANUAL_X_HOME_POS 0 +#define MANUAL_Y_HOME_POS 0 +#define MANUAL_Z_HOME_POS 0.25 + +// Travel limits after homing +#define X_MAX_POS 214 +#define X_MIN_POS 0 +#define Y_MAX_POS 198 +#define Y_MIN_POS 0 +#define Z_MAX_POS 201 +#define Z_MIN_POS 0.23 + +// Canceled home position +#define X_CANCEL_POS 50 +#define Y_CANCEL_POS 190 + +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + +#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +#define HOMING_FEEDRATE {3000, 3000, 240, 0} // set the homing speeds (mm/min) + +#define DEFAULT_MAX_FEEDRATE {500, 500, 3, 25} // (mm/sec) +#define DEFAULT_MAX_ACCELERATION {9000,9000,30,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. + +#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for retracts + + +#define MANUAL_FEEDRATE {3000, 3000, 240, 60} // set the speeds for manual moves (mm/min) + +#define Z_AXIS_ALWAYS_ON 1 + +/*------------------------------------ +EXTRUDER SETTINGS +*------------------------------------*/ + +// Mintemps +#define HEATER_0_MINTEMP 15 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define BED_MINTEMP 15 + +// Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else +#define HEATER_0_MAXTEMP 305 +#endif +#define HEATER_1_MAXTEMP 305 +#define HEATER_2_MAXTEMP 305 +#define BED_MAXTEMP 150 + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else +// Define PID constants for extruder +#define DEFAULT_Kp 40.925 +#define DEFAULT_Ki 4.875 +#define DEFAULT_Kd 86.085 +#endif + +// Extrude mintemp +#define EXTRUDE_MINTEMP 190 + +// Extruder cooling fans +#define EXTRUDER_0_AUTO_FAN_PIN 8 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed + + + + + + +#ifdef SNMM +//#define BOWDEN_LENGTH 408 +#define BOWDEN_LENGTH 433 //default total length for filament fast loading part; max length for extrusion is 465 mm!; this length can be adjusted in service menu +#define FIL_LOAD_LENGTH 102 //length for loading filament into the nozzle +#define FIL_COOLING 10 //length for cooling moves +#define E_MOTOR_LOW_CURRENT 350 // current for PRUSAY code +#define E_MOTOR_HIGH_CURRENT 700 //current for unloading filament, stop print, PRUSAY ramming +#endif //SNMM + +//#define DIS //for measuring bed heigth and PINDa detection heigth relative to auto home point, experimental function + + +/*------------------------------------ +CHANGE FILAMENT SETTINGS +*------------------------------------*/ + +// Filament change configuration +#define FILAMENTCHANGEENABLE +#ifdef FILAMENTCHANGEENABLE +#define FILAMENTCHANGE_XPOS 211 +#define FILAMENTCHANGE_YPOS 0 +#define FILAMENTCHANGE_ZADD 2 +#define FILAMENTCHANGE_FIRSTRETRACT -2 +#define FILAMENTCHANGE_FINALRETRACT -80 + +#define FILAMENTCHANGE_FIRSTFEED 70 +#define FILAMENTCHANGE_FINALFEED 50 +#define FILAMENTCHANGE_RECFEED 5 + +#define FILAMENTCHANGE_XYFEED 50 +#define FILAMENTCHANGE_EFEED 20 +#define FILAMENTCHANGE_RFEED 400 +#define FILAMENTCHANGE_EXFEED 2 +#define FILAMENTCHANGE_ZFEED 15 + +#endif + +/*------------------------------------ +ADDITIONAL FEATURES SETTINGS +*------------------------------------*/ + +// Define Prusa filament runout sensor +//#define FILAMENT_RUNOUT_SUPPORT + +#ifdef FILAMENT_RUNOUT_SUPPORT +#define FILAMENT_RUNOUT_SENSOR 1 +#endif + +// temperature runaway +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 + +#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 +#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 + +/*------------------------------------ +MOTOR CURRENT SETTINGS +*------------------------------------*/ + +// Motor Current setting for BIG RAMBo +#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +#define DIGIPOT_MOTOR_CURRENT_LOUD {135,135,135,135,135} + +// Motor Current settings for RAMBo mini PWM value = MotorCurrentSetting * 255 / range +#if MOTHERBOARD == 102 || MOTHERBOARD == 302 +#define MOTOR_CURRENT_PWM_RANGE 2000 +#define DEFAULT_PWM_MOTOR_CURRENT {270, 830, 450} // {XY,Z,E} +#define DEFAULT_PWM_MOTOR_CURRENT_LOUD {540, 830, 500} // {XY,Z,E} +#endif + +/*------------------------------------ +BED SETTINGS +*------------------------------------*/ + +// Define Mesh Bed Leveling system to enable it +#define MESH_BED_LEVELING +#ifdef MESH_BED_LEVELING + +#define MBL_Z_STEP 0.01 + +// Mesh definitions +#define MESH_MIN_X 35 +#define MESH_MAX_X 238 +#define MESH_MIN_Y 6 +#define MESH_MAX_Y 202 + +// Mesh upsample definition +#define MESH_NUM_X_POINTS 7 +#define MESH_NUM_Y_POINTS 7 +// Mesh measure definition +#define MESH_MEAS_NUM_X_POINTS 3 +#define MESH_MEAS_NUM_Y_POINTS 3 + +#define MESH_HOME_Z_CALIB 0.2 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. + +#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right +#define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind +#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) +#endif + +// Bed Temperature Control +// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis +// +// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. +// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating. +// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. +// If your configuration is significantly different than this and you don't understand the issues involved, you probably +// shouldn't use bed PID until someone else verifies your hardware works. +// If this is enabled, find your own PID constants below. +#define PIDTEMPBED +// +//#define BED_LIMIT_SWITCHING + +// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option. +// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis) +// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did, +// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED) +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +// Bed temperature compensation settings +#define BED_OFFSET 10 +#define BED_OFFSET_START 40 +#define BED_OFFSET_CENTER 50 + + +#ifdef PIDTEMPBED +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else +#define DEFAULT_bedKp 126.13 +#define DEFAULT_bedKi 4.30 +#define DEFAULT_bedKd 924.76 +#endif + +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from pidautotune +// #define DEFAULT_bedKp 97.1 +// #define DEFAULT_bedKi 1.41 +// #define DEFAULT_bedKd 1675.16 + +// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + + +/*----------------------------------- +PREHEAT SETTINGS +*------------------------------------*/ + +#define PLA_PREHEAT_HOTEND_TEMP 215 +#define PLA_PREHEAT_HPB_TEMP 55 +#define PLA_PREHEAT_FAN_SPEED 0 + +#define ABS_PREHEAT_HOTEND_TEMP 255 +#define ABS_PREHEAT_HPB_TEMP 100 +#define ABS_PREHEAT_FAN_SPEED 0 + +#define HIPS_PREHEAT_HOTEND_TEMP 220 +#define HIPS_PREHEAT_HPB_TEMP 100 +#define HIPS_PREHEAT_FAN_SPEED 0 + +#define PP_PREHEAT_HOTEND_TEMP 254 +#define PP_PREHEAT_HPB_TEMP 100 +#define PP_PREHEAT_FAN_SPEED 0 + +#define PET_PREHEAT_HOTEND_TEMP 240 +#define PET_PREHEAT_HPB_TEMP 90 +#define PET_PREHEAT_FAN_SPEED 0 + +#define FLEX_PREHEAT_HOTEND_TEMP 230 +#define FLEX_PREHEAT_HPB_TEMP 50 +#define FLEX_PREHEAT_FAN_SPEED 0 + +/*------------------------------------ +THERMISTORS SETTINGS +*------------------------------------*/ + +// +//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table +// +//// Temperature sensor settings: +// -2 is thermocouple with MAX6675 (only for sensor 0) +// -1 is thermocouple with AD595 +// 0 is not used +// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) +// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) +// 3 is Mendel-parts thermistor (4.7k pullup) +// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! +// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) +// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) +// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) +// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) +// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) +// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) +// 10 is 100k RS thermistor 198-961 (4.7k pullup) +// 11 is 100k beta 3950 1% thermistor (4.7k pullup) +// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 20 is the PT100 circuit found in the Ultimainboard V2.x +// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 +// +// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k +// (but gives greater accuracy and more stable PID) +// 51 is 100k thermistor - EPCOS (1k pullup) +// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) +// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) +// +// 1047 is Pt1000 with 4k7 pullup +// 1010 is Pt1000 with 1k pullup (non standard) +// 147 is Pt100 with 4k7 pullup +// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier +// 110 is Pt100 with 1k pullup (non standard) + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 148 +#else +#define TEMP_SENSOR_0 5 +#endif +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 148 +#else +#define TEMP_SENSOR_BED 1 +#endif + +#define STACK_GUARD_TEST_VALUE 0xA2A2 + +#define MAX_BED_TEMP_CALIBRATION 50 +#define MAX_HOTEND_TEMP_CALIBRATION 50 + +#define MAX_E_STEPS_PER_UNIT 250 +#define MIN_E_STEPS_PER_UNIT 100 + +#define Z_BABYSTEP_MIN -3999 +#define Z_BABYSTEP_MAX 0 + +#define PINDA_PREHEAT_X 70 +#define PINDA_PREHEAT_Y -3 +#define PINDA_PREHEAT_Z 1 +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + +#define PING_TIME 60 //time in s +#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes +#define PING_ALLERT_PERIOD 60 //time in s + +#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release + +#define PAUSE_RETRACT 1 + +#define DEFAULT_PID_TEMP 210 + +#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration + +#endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo10a-E3Dv6full.h new file mode 100644 index 000000000..06a7410c3 --- /dev/null +++ b/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo10a-E3Dv6full.h @@ -0,0 +1,401 @@ +#ifndef CONFIGURATION_PRUSA_H +#define CONFIGURATION_PRUSA_H + +/*------------------------------------ +GENERAL SETTINGS +*------------------------------------*/ + +// Printer revision +#define FILAMENT_SIZE "1_75mm_MK2_MM" +#define NOZZLE_TYPE "E3Dv6full" + +// Developer flag +#define DEVELOPER + +// Printer name +#define CUSTOM_MENDEL_NAME "Prusa i3 MK2" + +// Electronics +#define MOTHERBOARD BOARD_RAMBO_MINI_1_0 + +// Prusa Single extruder multiple material suport +#define SNMM + +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + + +/*------------------------------------ +AXIS SETTINGS +*------------------------------------*/ + +// Steps per unit {X,Y,Z,E} +#ifdef SNMM +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,140} +#else +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,161.3} +#endif + + +// Endstop inverting +const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. + +// Home position +#define MANUAL_X_HOME_POS 0 +#define MANUAL_Y_HOME_POS -2.2 +#define MANUAL_Z_HOME_POS 0.15 + +// Travel limits after homing +#define X_MAX_POS 250 +#define X_MIN_POS 0 +#define Y_MAX_POS 210 +#define Y_MIN_POS -2.2 +#define Z_MAX_POS 210 +#define Z_MIN_POS 0.15 + +// Canceled home position +#define X_CANCEL_POS 50 +#define Y_CANCEL_POS 190 + +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + +#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) + +#define DEFAULT_MAX_FEEDRATE {500, 500, 12, 120} // (mm/sec) +#define DEFAULT_MAX_ACCELERATION {9000,9000,500,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. + +#define DEFAULT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for retracts + + +#define MANUAL_FEEDRATE {3000, 3000, 1000, 100} // set the speeds for manual moves (mm/min) + +#define Z_AXIS_ALWAYS_ON 1 + +/*------------------------------------ +EXTRUDER SETTINGS +*------------------------------------*/ + +// Mintemps +#define HEATER_0_MINTEMP 15 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define BED_MINTEMP 15 + +// Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else +#define HEATER_0_MAXTEMP 305 +#endif +#define HEATER_1_MAXTEMP 305 +#define HEATER_2_MAXTEMP 305 +#define BED_MAXTEMP 150 + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else +// Define PID constants for extruder +#define DEFAULT_Kp 40.925 +#define DEFAULT_Ki 4.875 +#define DEFAULT_Kd 86.085 +#endif + +// Extrude mintemp +#define EXTRUDE_MINTEMP 130 + +// Extruder cooling fans +#define EXTRUDER_0_AUTO_FAN_PIN 8 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed + +// Prusa Single extruder multiple material suport +//#define SNMM + +#ifdef SNMM +//#define BOWDEN_LENGTH 408 +#define BOWDEN_LENGTH 433 //default total length for filament fast loading part; max length for extrusion is 465 mm!; this length can be adjusted in service menu +#define FIL_LOAD_LENGTH 102 //length for loading filament into the nozzle +#define FIL_COOLING 10 //length for cooling moves +#define E_MOTOR_LOW_CURRENT 350 // current for PRUSAY code +#define E_MOTOR_HIGH_CURRENT 700 //current for unloading filament, stop print, PRUSAY ramming +#endif //SNMM + +//#define DIS //for measuring bed heigth and PINDa detection heigth relative to auto home point, experimental function + + +/*------------------------------------ +CHANGE FILAMENT SETTINGS +*------------------------------------*/ + +// Filament change configuration +#define FILAMENTCHANGEENABLE +#ifdef FILAMENTCHANGEENABLE +#define FILAMENTCHANGE_XPOS 211 +#define FILAMENTCHANGE_YPOS 0 +#define FILAMENTCHANGE_ZADD 2 +#define FILAMENTCHANGE_FIRSTRETRACT -2 +#define FILAMENTCHANGE_FINALRETRACT -80 + +#define FILAMENTCHANGE_FIRSTFEED 70 +#define FILAMENTCHANGE_FINALFEED 50 +#define FILAMENTCHANGE_RECFEED 5 + +#define FILAMENTCHANGE_XYFEED 50 +#define FILAMENTCHANGE_EFEED 20 +#define FILAMENTCHANGE_RFEED 400 +#define FILAMENTCHANGE_EXFEED 2 +#define FILAMENTCHANGE_ZFEED 15 + +#endif + +/*------------------------------------ +ADDITIONAL FEATURES SETTINGS +*------------------------------------*/ + +// Define Prusa filament runout sensor +//#define FILAMENT_RUNOUT_SUPPORT + +#ifdef FILAMENT_RUNOUT_SUPPORT +#define FILAMENT_RUNOUT_SENSOR 1 +#endif + +// temperature runaway +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 + +#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 +#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 + +/*------------------------------------ +MOTOR CURRENT SETTINGS +*------------------------------------*/ + +// Motor Current setting for BIG RAMBo +#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +#define DIGIPOT_MOTOR_CURRENT_LOUD {135,135,135,135,135} + +// Motor Current settings for RAMBo mini PWM value = MotorCurrentSetting * 255 / range +#if MOTHERBOARD == 102 || MOTHERBOARD == 302 +#define MOTOR_CURRENT_PWM_RANGE 2000 +#define DEFAULT_PWM_MOTOR_CURRENT {270, 830, 450} // {XY,Z,E} +#define DEFAULT_PWM_MOTOR_CURRENT_LOUD {540, 830, 500} // {XY,Z,E} +#endif + +/*------------------------------------ +BED SETTINGS +*------------------------------------*/ + +// Define Mesh Bed Leveling system to enable it +#define MESH_BED_LEVELING +#ifdef MESH_BED_LEVELING + +#define MBL_Z_STEP 0.01 + +// Mesh definitions +#define MESH_MIN_X 35 +#define MESH_MAX_X 238 +#define MESH_MIN_Y 6 +#define MESH_MAX_Y 202 + +// Mesh upsample definition +#define MESH_NUM_X_POINTS 7 +#define MESH_NUM_Y_POINTS 7 +// Mesh measure definition +#define MESH_MEAS_NUM_X_POINTS 3 +#define MESH_MEAS_NUM_Y_POINTS 3 + +#define MESH_HOME_Z_CALIB 0.2 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. + +#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right +#define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind +#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) +#endif + +// Bed Temperature Control +// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis +// +// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. +// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating. +// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. +// If your configuration is significantly different than this and you don't understand the issues involved, you probably +// shouldn't use bed PID until someone else verifies your hardware works. +// If this is enabled, find your own PID constants below. +#define PIDTEMPBED +// +//#define BED_LIMIT_SWITCHING + +// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option. +// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis) +// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did, +// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED) +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +// Bed temperature compensation settings +#define BED_OFFSET 10 +#define BED_OFFSET_START 40 +#define BED_OFFSET_CENTER 50 + + +#ifdef PIDTEMPBED +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else +#define DEFAULT_bedKp 126.13 +#define DEFAULT_bedKi 4.30 +#define DEFAULT_bedKd 924.76 +#endif + +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from pidautotune +// #define DEFAULT_bedKp 97.1 +// #define DEFAULT_bedKi 1.41 +// #define DEFAULT_bedKd 1675.16 + +// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + + +/*----------------------------------- +PREHEAT SETTINGS +*------------------------------------*/ + +#define PLA_PREHEAT_HOTEND_TEMP 215 +#define PLA_PREHEAT_HPB_TEMP 55 +#define PLA_PREHEAT_FAN_SPEED 0 + +#define ABS_PREHEAT_HOTEND_TEMP 255 +#define ABS_PREHEAT_HPB_TEMP 100 +#define ABS_PREHEAT_FAN_SPEED 0 + +#define HIPS_PREHEAT_HOTEND_TEMP 220 +#define HIPS_PREHEAT_HPB_TEMP 100 +#define HIPS_PREHEAT_FAN_SPEED 0 + +#define PP_PREHEAT_HOTEND_TEMP 254 +#define PP_PREHEAT_HPB_TEMP 100 +#define PP_PREHEAT_FAN_SPEED 0 + +#define PET_PREHEAT_HOTEND_TEMP 240 +#define PET_PREHEAT_HPB_TEMP 90 +#define PET_PREHEAT_FAN_SPEED 0 + +#define FLEX_PREHEAT_HOTEND_TEMP 230 +#define FLEX_PREHEAT_HPB_TEMP 50 +#define FLEX_PREHEAT_FAN_SPEED 0 + +/*------------------------------------ +THERMISTORS SETTINGS +*------------------------------------*/ + +// +//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table +// +//// Temperature sensor settings: +// -2 is thermocouple with MAX6675 (only for sensor 0) +// -1 is thermocouple with AD595 +// 0 is not used +// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) +// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) +// 3 is Mendel-parts thermistor (4.7k pullup) +// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! +// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) +// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) +// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) +// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) +// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) +// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) +// 10 is 100k RS thermistor 198-961 (4.7k pullup) +// 11 is 100k beta 3950 1% thermistor (4.7k pullup) +// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 20 is the PT100 circuit found in the Ultimainboard V2.x +// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 +// +// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k +// (but gives greater accuracy and more stable PID) +// 51 is 100k thermistor - EPCOS (1k pullup) +// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) +// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) +// +// 1047 is Pt1000 with 4k7 pullup +// 1010 is Pt1000 with 1k pullup (non standard) +// 147 is Pt100 with 4k7 pullup +// 148 is Pt100 with 4k7 pullup and no PT100 Amplifier (in case type 147 doesn't work) +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier +// 110 is Pt100 with 1k pullup (non standard) + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 148 +#else +#define TEMP_SENSOR_0 5 +#endif +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 148 +#else +#define TEMP_SENSOR_BED 1 +#endif + +#define STACK_GUARD_TEST_VALUE 0xA2A2 + +#define MAX_BED_TEMP_CALIBRATION 50 +#define MAX_HOTEND_TEMP_CALIBRATION 50 + +#define MAX_E_STEPS_PER_UNIT 250 +#define MIN_E_STEPS_PER_UNIT 100 + +#define Z_BABYSTEP_MIN -3999 +#define Z_BABYSTEP_MAX 0 + +#define PINDA_PREHEAT_X 70 +#define PINDA_PREHEAT_Y -3 +#define PINDA_PREHEAT_Z 1 +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + +#define PING_TIME 60 //time in s +#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes +#define PING_ALLERT_PERIOD 60 //time in s + +#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release + +#define DEFAULT_PID_TEMP 210 + +#ifdef SNMM +#define DEFAULT_RETRACTION 4 //used for PINDA temp calibration and pause print +#else +#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print +#endif + +#endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo13a-E3Dv6full.h new file mode 100644 index 000000000..a0afa5f7f --- /dev/null +++ b/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo13a-E3Dv6full.h @@ -0,0 +1,403 @@ +#ifndef CONFIGURATION_PRUSA_H +#define CONFIGURATION_PRUSA_H + +/*------------------------------------ +GENERAL SETTINGS +*------------------------------------*/ + +// Printer revision +#define FILAMENT_SIZE "1_75mm_MK2_MM" +#define NOZZLE_TYPE "E3Dv6full" + +// Developer flag +#define DEVELOPER + +// Printer name +#define CUSTOM_MENDEL_NAME "Prusa i3 MK2" + +// Electronics +#define MOTHERBOARD BOARD_RAMBO_MINI_1_3 + +// Prusa Single extruder multiple material suport +#define SNMM + +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + + +/*------------------------------------ +AXIS SETTINGS +*------------------------------------*/ + +// Steps per unit {X,Y,Z,E} +#ifdef SNMM +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,140} +#else +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,161.3} +#endif + + +// Endstop inverting +const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. + +// Home position +#define MANUAL_X_HOME_POS 0 +#define MANUAL_Y_HOME_POS -2.2 +#define MANUAL_Z_HOME_POS 0.15 + +// Travel limits after homing +#define X_MAX_POS 250 +#define X_MIN_POS 0 +#define Y_MAX_POS 210 +#define Y_MIN_POS -2.2 +#define Z_MAX_POS 210 +#define Z_MIN_POS 0.15 + +// Canceled home position +#define X_CANCEL_POS 50 +#define Y_CANCEL_POS 190 + +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + +#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) + +#define DEFAULT_MAX_FEEDRATE {500, 500, 12, 120} // (mm/sec) +#define DEFAULT_MAX_ACCELERATION {9000,9000,500,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. + +#define DEFAULT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for retracts + + +#define MANUAL_FEEDRATE {3000, 3000, 1000, 100} // set the speeds for manual moves (mm/min) + +#define Z_AXIS_ALWAYS_ON 1 + +/*------------------------------------ +EXTRUDER SETTINGS +*------------------------------------*/ + +// Mintemps +#define HEATER_0_MINTEMP 15 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define BED_MINTEMP 15 + +// Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else +#define HEATER_0_MAXTEMP 305 +#endif +#define HEATER_1_MAXTEMP 305 +#define HEATER_2_MAXTEMP 305 +#define BED_MAXTEMP 150 + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else +// Define PID constants for extruder +#define DEFAULT_Kp 40.925 +#define DEFAULT_Ki 4.875 +#define DEFAULT_Kd 86.085 +#endif + +// Extrude mintemp +#define EXTRUDE_MINTEMP 130 + +// Extruder cooling fans +#define EXTRUDER_0_AUTO_FAN_PIN 8 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed + + + + + + +#ifdef SNMM +//#define BOWDEN_LENGTH 408 +#define BOWDEN_LENGTH 433 //default total length for filament fast loading part; max length for extrusion is 465 mm!; this length can be adjusted in service menu +#define FIL_LOAD_LENGTH 102 //length for loading filament into the nozzle +#define FIL_COOLING 10 //length for cooling moves +#define E_MOTOR_LOW_CURRENT 350 // current for PRUSAY code +#define E_MOTOR_HIGH_CURRENT 700 //current for unloading filament, stop print, PRUSAY ramming +#endif //SNMM + +//#define DIS //for measuring bed heigth and PINDa detection heigth relative to auto home point, experimental function + + +/*------------------------------------ +CHANGE FILAMENT SETTINGS +*------------------------------------*/ + +// Filament change configuration +#define FILAMENTCHANGEENABLE +#ifdef FILAMENTCHANGEENABLE +#define FILAMENTCHANGE_XPOS 211 +#define FILAMENTCHANGE_YPOS 0 +#define FILAMENTCHANGE_ZADD 2 +#define FILAMENTCHANGE_FIRSTRETRACT -2 +#define FILAMENTCHANGE_FINALRETRACT -80 + +#define FILAMENTCHANGE_FIRSTFEED 70 +#define FILAMENTCHANGE_FINALFEED 50 +#define FILAMENTCHANGE_RECFEED 5 + +#define FILAMENTCHANGE_XYFEED 50 +#define FILAMENTCHANGE_EFEED 20 +#define FILAMENTCHANGE_RFEED 400 +#define FILAMENTCHANGE_EXFEED 2 +#define FILAMENTCHANGE_ZFEED 15 + +#endif + +/*------------------------------------ +ADDITIONAL FEATURES SETTINGS +*------------------------------------*/ + +// Define Prusa filament runout sensor +//#define FILAMENT_RUNOUT_SUPPORT + +#ifdef FILAMENT_RUNOUT_SUPPORT +#define FILAMENT_RUNOUT_SENSOR 1 +#endif + +// temperature runaway +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 + +#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 +#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 + +/*------------------------------------ +MOTOR CURRENT SETTINGS +*------------------------------------*/ + +// Motor Current setting for BIG RAMBo +#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +#define DIGIPOT_MOTOR_CURRENT_LOUD {135,135,135,135,135} + +// Motor Current settings for RAMBo mini PWM value = MotorCurrentSetting * 255 / range +#if MOTHERBOARD == 102 || MOTHERBOARD == 302 +#define MOTOR_CURRENT_PWM_RANGE 2000 +#define DEFAULT_PWM_MOTOR_CURRENT {270, 830, 450} // {XY,Z,E} +#define DEFAULT_PWM_MOTOR_CURRENT_LOUD {540, 830, 500} // {XY,Z,E} +#endif + +/*------------------------------------ +BED SETTINGS +*------------------------------------*/ + +// Define Mesh Bed Leveling system to enable it +#define MESH_BED_LEVELING +#ifdef MESH_BED_LEVELING + +#define MBL_Z_STEP 0.01 + +// Mesh definitions +#define MESH_MIN_X 35 +#define MESH_MAX_X 238 +#define MESH_MIN_Y 6 +#define MESH_MAX_Y 202 + +// Mesh upsample definition +#define MESH_NUM_X_POINTS 7 +#define MESH_NUM_Y_POINTS 7 +// Mesh measure definition +#define MESH_MEAS_NUM_X_POINTS 3 +#define MESH_MEAS_NUM_Y_POINTS 3 + +#define MESH_HOME_Z_CALIB 0.2 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. + +#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right +#define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind +#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) +#endif + +// Bed Temperature Control +// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis +// +// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. +// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating. +// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. +// If your configuration is significantly different than this and you don't understand the issues involved, you probably +// shouldn't use bed PID until someone else verifies your hardware works. +// If this is enabled, find your own PID constants below. +#define PIDTEMPBED +// +//#define BED_LIMIT_SWITCHING + +// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option. +// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis) +// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did, +// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED) +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +// Bed temperature compensation settings +#define BED_OFFSET 10 +#define BED_OFFSET_START 40 +#define BED_OFFSET_CENTER 50 + + +#ifdef PIDTEMPBED +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else +#define DEFAULT_bedKp 126.13 +#define DEFAULT_bedKi 4.30 +#define DEFAULT_bedKd 924.76 +#endif + +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from pidautotune +// #define DEFAULT_bedKp 97.1 +// #define DEFAULT_bedKi 1.41 +// #define DEFAULT_bedKd 1675.16 + +// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + + +/*----------------------------------- +PREHEAT SETTINGS +*------------------------------------*/ + +#define PLA_PREHEAT_HOTEND_TEMP 215 +#define PLA_PREHEAT_HPB_TEMP 55 +#define PLA_PREHEAT_FAN_SPEED 0 + +#define ABS_PREHEAT_HOTEND_TEMP 255 +#define ABS_PREHEAT_HPB_TEMP 100 +#define ABS_PREHEAT_FAN_SPEED 0 + +#define HIPS_PREHEAT_HOTEND_TEMP 220 +#define HIPS_PREHEAT_HPB_TEMP 100 +#define HIPS_PREHEAT_FAN_SPEED 0 + +#define PP_PREHEAT_HOTEND_TEMP 254 +#define PP_PREHEAT_HPB_TEMP 100 +#define PP_PREHEAT_FAN_SPEED 0 + +#define PET_PREHEAT_HOTEND_TEMP 240 +#define PET_PREHEAT_HPB_TEMP 90 +#define PET_PREHEAT_FAN_SPEED 0 + +#define FLEX_PREHEAT_HOTEND_TEMP 230 +#define FLEX_PREHEAT_HPB_TEMP 50 +#define FLEX_PREHEAT_FAN_SPEED 0 + +/*------------------------------------ +THERMISTORS SETTINGS +*------------------------------------*/ + +// +//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table +// +//// Temperature sensor settings: +// -2 is thermocouple with MAX6675 (only for sensor 0) +// -1 is thermocouple with AD595 +// 0 is not used +// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) +// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) +// 3 is Mendel-parts thermistor (4.7k pullup) +// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! +// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) +// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) +// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) +// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) +// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) +// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) +// 10 is 100k RS thermistor 198-961 (4.7k pullup) +// 11 is 100k beta 3950 1% thermistor (4.7k pullup) +// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 20 is the PT100 circuit found in the Ultimainboard V2.x +// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 +// +// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k +// (but gives greater accuracy and more stable PID) +// 51 is 100k thermistor - EPCOS (1k pullup) +// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) +// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) +// +// 1047 is Pt1000 with 4k7 pullup +// 1010 is Pt1000 with 1k pullup (non standard) +// 147 is Pt100 with 4k7 pullup +// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier +// 110 is Pt100 with 1k pullup (non standard) + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 148 +#else +#define TEMP_SENSOR_0 5 +#endif +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 148 +#else +#define TEMP_SENSOR_BED 1 +#endif + +#define STACK_GUARD_TEST_VALUE 0xA2A2 + +#define MAX_BED_TEMP_CALIBRATION 50 +#define MAX_HOTEND_TEMP_CALIBRATION 50 + +#define MAX_E_STEPS_PER_UNIT 250 +#define MIN_E_STEPS_PER_UNIT 100 + +#define Z_BABYSTEP_MIN -3999 +#define Z_BABYSTEP_MAX 0 + +#define PINDA_PREHEAT_X 70 +#define PINDA_PREHEAT_Y -3 +#define PINDA_PREHEAT_Z 1 +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + +#define PING_TIME 60 //time in s +#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes +#define PING_ALLERT_PERIOD 60 //time in s + +#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release + +#define DEFAULT_PID_TEMP 210 + +#ifdef SNMM +#define DEFAULT_RETRACTION 4 //used for PINDA temp calibration and pause print +#else +#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print +#endif + +#endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index 11a0c5d91..474d2e9e1 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -28,49 +28,6 @@ GENERAL SETTINGS //#define E3D_PT100_BED_NO_AMP -// Linear Advance feature - EXPERIMENTAL! -/** - * Implementation of linear pressure control - * - * Assumption: advance = k * (delta velocity) - * K=0 means advance disabled. - * See Marlin documentation for calibration instructions. - */ -#define LIN_ADVANCE - -#if defined(LIN_ADVANCE) - #define LIN_ADVANCE_K 75 - - /** - * Some Slicers produce Gcode with randomly jumping extrusion widths occasionally. - * For example within a 0.4mm perimeter it may produce a single segment of 0.05mm width. - * While this is harmless for normal printing (the fluid nature of the filament will - * close this very, very tiny gap), it throws off the LIN_ADVANCE pressure adaption. - * - * For this case LIN_ADVANCE_E_D_RATIO can be used to set the extrusion:distance ratio - * to a fixed value. Note that using a fixed ratio will lead to wrong nozzle pressures - * if the slicer is using variable widths or layer heights within one print! - * - * This option sets the default E:D ratio at startup. Use `M900` to override this value. - * - * Example: `M900 W0.4 H0.2 D1.75`, where: - * - W is the extrusion width in mm - * - H is the layer height in mm - * - D is the filament diameter in mm - * - * Example: `M900 R0.0458` to set the ratio directly. - * - * Set to 0 to auto-detect the ratio based on given Gcode G1 print moves. - * - * Slic3r (including Prusa Slic3r) produces Gcode compatible with the automatic mode. - * Cura (as of this writing) may produce Gcode incompatible with the automatic mode. - */ - #define LIN_ADVANCE_E_D_RATIO 0.033260135 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) - // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 -#endif - - - /*------------------------------------ AXIS SETTINGS *------------------------------------*/ @@ -459,5 +416,4 @@ THERMISTORS SETTINGS #else #define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print #endif - #endif //__CONFIGURATION_PRUSA_H