Commit fee28e94 authored by MagoKimbra's avatar MagoKimbra

M600 (Change Filament) bug fixed for Deltabot

parent 177b89ce
...@@ -179,36 +179,34 @@ ...@@ -179,36 +179,34 @@
// This makes temp sensor 1 a redundant sensor for sensor 0. // This makes temp sensor 1 a redundant sensor for sensor 0.
// If the temperatures difference between these sensors is to high the print will be aborted. // If the temperatures difference between these sensors is to high the print will be aborted.
//#define TEMP_SENSOR_1_AS_REDUNDANT //#define TEMP_SENSOR_1_AS_REDUNDANT
#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 // degC #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 // (degC)
#ifdef SINGLENOZZLE #ifdef SINGLENOZZLE
#undef TEMP_SENSOR_1_AS_REDUNDANT #undef TEMP_SENSOR_1_AS_REDUNDANT
#endif #endif
// Actual temperature must be close to target for this long before M109 returns success // Actual temperature must be close to target for this long before M109 returns success
#define TEMP_RESIDENCY_TIME 10 // seconds #define TEMP_RESIDENCY_TIME 10 // (seconds)
// Range of +/- temperatures considered "close" to the target one #define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one
#define TEMP_HYSTERESIS 3 // degC #define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early.
// Window around target to start the residency timer x degC early.
#define TEMP_WINDOW 1 // degC
// The minimal temperature defines the temperature below which the heater will not be enabled It is used // The minimal temperature defines the temperature below which the heater will not be enabled It is used
// to check that the wiring to the thermistor is not broken. // to check that the wiring to the thermistor is not broken.
// Otherwise this would lead to the heater being powered on all the time. // Otherwise this would lead to the heater being powered on all the time.
#define HEATER_0_MINTEMP 5 // degC #define HEATER_0_MINTEMP 5 // (degC)
#define HEATER_1_MINTEMP 5 // degC #define HEATER_1_MINTEMP 5 // (degC)
#define HEATER_2_MINTEMP 5 // degC #define HEATER_2_MINTEMP 5 // (degC)
#define HEATER_3_MINTEMP 5 // degC #define HEATER_3_MINTEMP 5 // (degC)
#define BED_MINTEMP 5 // degC #define BED_MINTEMP 5 // (degC)
// When temperature exceeds max temp, your heater will be switched off. // When temperature exceeds max temp, your heater will be switched off.
// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! // This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
// You should use MINTEMP for thermistor short/failure protection. // You should use MINTEMP for thermistor short/failure protection.
#define HEATER_0_MAXTEMP 275 // degC #define HEATER_0_MAXTEMP 275 // (degC)
#define HEATER_1_MAXTEMP 275 // degC #define HEATER_1_MAXTEMP 275 // (degC)
#define HEATER_2_MAXTEMP 275 // degC #define HEATER_2_MAXTEMP 275 // (degC)
#define HEATER_3_MAXTEMP 275 // degC #define HEATER_3_MAXTEMP 275 // (degC)
#define BED_MAXTEMP 150 // degC #define BED_MAXTEMP 150 // (degC)
// If your bed has low resistance e.g. 0.6 ohm and throws the fuse you can duty cycle it to reduce the // If your bed has low resistance e.g. 0.6 ohm and throws the fuse you can duty cycle it to reduce the
// average current. The value should be an integer and the heat bed will be turned on for 1 interval of // average current. The value should be an integer and the heat bed will be turned on for 1 interval of
...@@ -222,27 +220,18 @@ ...@@ -222,27 +220,18 @@
//=============================== PID settings ============================== //=============================== PID settings ==============================
// Comment the following line to disable PID and enable bang-bang. // Comment the following line to disable PID and enable bang-bang.
#define PIDTEMP #define PIDTEMP
#ifdef PIDTEMP #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
// Limits current to nozzle while in bang-bang mode #define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
#define BANG_MAX 255 // 255 is full current
// Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below)
#define PID_MAX BANG_MAX // 255 is full current
// Sends debug data to the serial port
//#define PID_DEBUG
// Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define PID_OPENLOOP 1
// PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of
// approximately 1s useful for heaters driven by a relay
//#define SLOW_PWM_HEATERS
#ifdef PIDTEMP
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
// If the temperature difference between the target temperature and the actual temperature // If the temperature difference between the target temperature and the actual temperature
// is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
#define PID_FUNCTIONAL_RANGE 10 // degC #define PID_FUNCTIONAL_RANGE 10 // degC
#define PID_INTEGRAL_DRIVE_MAX PID_MAX // Limit for the integral term
// Limit for the integral term #define K1 0.95 // Smoothing factor within the PID
#define PID_INTEGRAL_DRIVE_MAX PID_MAX
// Smoothing factor within the PID
#define K1 0.95
// HotEnd{HE0,HE1,HE2,HE3} // HotEnd{HE0,HE1,HE2,HE3}
#define DEFAULT_Kp {41,41,41,41} // Kp for E0, E1, E2, E3 #define DEFAULT_Kp {41,41,41,41} // Kp for E0, E1, E2, E3
......
...@@ -5162,7 +5162,13 @@ void process_commands() ...@@ -5162,7 +5162,13 @@ void process_commands()
target[E_AXIS]+= FILAMENTCHANGE_FIRSTRETRACT; target[E_AXIS]+= FILAMENTCHANGE_FIRSTRETRACT;
#endif #endif
} }
#ifdef DELTA
calculate_delta(target);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver);
#else
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver); plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver);
#endif
//lift Z //lift Z
if(code_seen('Z')) if(code_seen('Z'))
...@@ -5175,7 +5181,13 @@ void process_commands() ...@@ -5175,7 +5181,13 @@ void process_commands()
target[Z_AXIS]+= FILAMENTCHANGE_ZADD; target[Z_AXIS]+= FILAMENTCHANGE_ZADD;
#endif #endif
} }
#ifdef DELTA
calculate_delta(target);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver);
#else
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver); plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver);
#endif
//move xy //move xy
if(code_seen('X')) if(code_seen('X'))
...@@ -5199,7 +5211,12 @@ void process_commands() ...@@ -5199,7 +5211,12 @@ void process_commands()
#endif #endif
} }
#ifdef DELTA
calculate_delta(target);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver);
#else
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver); plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver);
#endif
if(code_seen('L')) if(code_seen('L'))
{ {
...@@ -5212,7 +5229,12 @@ void process_commands() ...@@ -5212,7 +5229,12 @@ void process_commands()
#endif #endif
} }
#ifdef DELTA
calculate_delta(target);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver);
#else
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver); plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver);
#endif
//finish moves //finish moves
st_synchronize(); st_synchronize();
...@@ -5264,10 +5286,19 @@ void process_commands() ...@@ -5264,10 +5286,19 @@ void process_commands()
#endif #endif
current_position[E_AXIS]=target[E_AXIS]; //the long retract of L is compensated by manual filament feeding current_position[E_AXIS]=target[E_AXIS]; //the long retract of L is compensated by manual filament feeding
plan_set_e_position(current_position[E_AXIS]); plan_set_e_position(current_position[E_AXIS]);
#ifdef DELTA
calculate_delta(target);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver); //should do nothing
calculate_delta(lastpos);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver); //move xyz back
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], lastpos[E_AXIS], feedrate/60, active_extruder, active_driver); //final unretract
#else
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver); //should do nothing plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver); //should do nothing
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver); //move xy back plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver); //move xy back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver); //move z back plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver); //move z back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], lastpos[E_AXIS], feedrate/60, active_extruder, active_driver); //final untretract plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], lastpos[E_AXIS], feedrate/60, active_extruder, active_driver); //final unretract
#endif
} }
break; break;
#endif //FILAMENTCHANGEENABLE #endif //FILAMENTCHANGEENABLE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment