Merge remote-tracking branch 'MarlinFirmware/Development' into Development

Conflicts:
	Marlin/Marlin_main.cpp
This commit is contained in:
Chris Roadfeldt 2015-03-31 11:08:36 -05:00
commit c89b8368ee
15 changed files with 93 additions and 212 deletions

View File

@ -72,6 +72,12 @@ Here are some standard links for getting your machine calibrated:
// This defines the number of extruders // This defines the number of extruders
#define EXTRUDERS 1 #define EXTRUDERS 1
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
//#define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
//// The following define selects which power supply you have. Please choose the one that matches your setup //// The following define selects which power supply you have. Please choose the one that matches your setup
// 1 = ATX // 1 = ATX
// 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC) // 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC)
@ -536,12 +542,6 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration in mm/s^2 for retracts #define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration in mm/s^2 for retracts
#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves #define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
// #define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
// #define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
// The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously) // The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously)
#define DEFAULT_XYJERK 20.0 // (mm/sec) #define DEFAULT_XYJERK 20.0 // (mm/sec)
#define DEFAULT_ZJERK 0.4 // (mm/sec) #define DEFAULT_ZJERK 0.4 // (mm/sec)
@ -716,7 +716,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
// Servo Endstops // Servo Endstops
// //
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
// //
//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

View File

@ -226,21 +226,21 @@ float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS }; float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
bool axis_known_position[3] = { false }; bool axis_known_position[3] = { false };
// Extruder offset // Extruder offsets
#if EXTRUDERS > 1 #if EXTRUDERS > 1
#ifndef EXTRUDER_OFFSET_X #ifndef EXTRUDER_OFFSET_X
#define EXTRUDER_OFFSET_X 0 #define EXTRUDER_OFFSET_X { 0 }
#endif #endif
#ifndef EXTRUDER_OFFSET_Y #ifndef EXTRUDER_OFFSET_Y
#define EXTRUDER_OFFSET_Y 0 #define EXTRUDER_OFFSET_Y { 0 }
#endif #endif
#ifndef DUAL_X_CARRIAGE float extruder_offset[][EXTRUDERS] = {
#define NUM_EXTRUDER_OFFSETS 2 // only in XY plane EXTRUDER_OFFSET_X,
#else EXTRUDER_OFFSET_Y
#define NUM_EXTRUDER_OFFSETS 3 // supports offsets in XYZ plane #ifdef DUAL_X_CARRIAGE
#endif , { 0 } // supports offsets in XYZ plane
#define _EXY { EXTRUDER_OFFSET_X, EXTRUDER_OFFSET_Y } #endif
float extruder_offset[EXTRUDERS][NUM_EXTRUDER_OFFSETS] = ARRAY_BY_EXTRUDERS(_EXY, _EXY, _EXY, _EXY); };
#endif #endif
uint8_t active_extruder = 0; uint8_t active_extruder = 0;
@ -935,7 +935,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
// second X-carriage offset when homed - otherwise X2_HOME_POS is used. // second X-carriage offset when homed - otherwise X2_HOME_POS is used.
// This allow soft recalibration of the second extruder offset position without firmware reflash // This allow soft recalibration of the second extruder offset position without firmware reflash
// (through the M218 command). // (through the M218 command).
return (extruder_offset[1][X_AXIS] > 0) ? extruder_offset[1][X_AXIS] : X2_HOME_POS; return (extruder_offset[X_AXIS][1] > 0) ? extruder_offset[X_AXIS][1] : X2_HOME_POS;
} }
static int x_home_dir(int extruder) { static int x_home_dir(int extruder) {
@ -959,14 +959,14 @@ static void axis_is_at_home(int axis) {
if (active_extruder != 0) { if (active_extruder != 0) {
current_position[X_AXIS] = x_home_pos(active_extruder); current_position[X_AXIS] = x_home_pos(active_extruder);
min_pos[X_AXIS] = X2_MIN_POS; min_pos[X_AXIS] = X2_MIN_POS;
max_pos[X_AXIS] = max(extruder_offset[1][X_AXIS], X2_MAX_POS); max_pos[X_AXIS] = max(extruder_offset[X_AXIS][1], X2_MAX_POS);
return; return;
} }
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) { else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
float xoff = home_offset[X_AXIS]; float xoff = home_offset[X_AXIS];
current_position[X_AXIS] = base_home_pos(X_AXIS) + xoff; current_position[X_AXIS] = base_home_pos(X_AXIS) + xoff;
min_pos[X_AXIS] = base_min_pos(X_AXIS) + xoff; min_pos[X_AXIS] = base_min_pos(X_AXIS) + xoff;
max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + xoff, max(extruder_offset[1][X_AXIS], X2_MAX_POS) - duplicate_extruder_x_offset); max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + xoff, max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
return; return;
} }
} }
@ -1055,7 +1055,7 @@ inline void sync_plan_position() {
//corrected_position.debug("position after"); //corrected_position.debug("position after");
current_position[X_AXIS] = corrected_position.x; current_position[X_AXIS] = corrected_position.x;
current_position[Y_AXIS] = corrected_position.y; current_position[Y_AXIS] = corrected_position.y;
current_position[Z_AXIS] = zprobe_zoffset; // was: corrected_position.z current_position[Z_AXIS] = corrected_position.z;
sync_plan_position(); sync_plan_position();
} }
@ -1084,7 +1084,7 @@ inline void sync_plan_position() {
vector_3 corrected_position = plan_get_position(); vector_3 corrected_position = plan_get_position();
current_position[X_AXIS] = corrected_position.x; current_position[X_AXIS] = corrected_position.x;
current_position[Y_AXIS] = corrected_position.y; current_position[Y_AXIS] = corrected_position.y;
current_position[Z_AXIS] = zprobe_zoffset; // was: corrected_position.z current_position[Z_AXIS] = corrected_position.z;
sync_plan_position(); sync_plan_position();
} }
@ -1202,58 +1202,6 @@ inline void sync_plan_position() {
previous_millis_cmd = millis(); previous_millis_cmd = millis();
} }
<<<<<<< HEAD
static void engage_z_probe() {
// Engage Z Servo endstop if enabled
#ifdef SERVO_ENDSTOPS
if (servo_endstops[Z_AXIS] > -1) {
#if SERVO_LEVELING
servos[servo_endstops[Z_AXIS]].attach(0);
#endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]);
#if SERVO_LEVELING
delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach();
#endif
}
#elif defined(Z_PROBE_ALLEN_KEY)
feedrate = homing_feedrate[X_AXIS];
// Move to the start position to initiate deployment
destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_X;
destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_Y;
destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_Z;
prepare_move_raw();
// Home X to touch the belt
feedrate = homing_feedrate[X_AXIS]/10;
destination[X_AXIS] = 0;
prepare_move_raw();
// Home Y for safety
feedrate = homing_feedrate[X_AXIS]/2;
destination[Y_AXIS] = 0;
prepare_move_raw();
st_synchronize();
// If Z_PROBE_AND_ENDSTOP is changed to completely break it's bonds from Z_MIN_ENDSTOP and become
// it's own unique entity, then the following logic will need to be modified
// so it only uses the Z_PROBE
#if defined(Z_PROBE_AND_ENDSTOP)
bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
if (z_probe_endstop)
#else
bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
if (z_min_endstop)
#endif
{
if (!Stopped)
{
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("Z-Probe failed to engage!");
LCD_ALERTMESSAGEPGM("Err: ZPROBE");
=======
static void engage_z_probe() { static void engage_z_probe() {
#ifdef SERVO_ENDSTOPS #ifdef SERVO_ENDSTOPS
@ -1292,107 +1240,43 @@ static void engage_z_probe() {
st_synchronize(); st_synchronize();
#if defined(Z_PROBE_AND_ENDSTOP)
bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
if (z_probe_endstop) {
#else
bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
if (z_min_endstop) { if (!z_min_endstop) {
#endif
if (!Stopped) { if (!Stopped) {
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("Z-Probe failed to engage!"); SERIAL_ERRORLNPGM("Z-Probe failed to engage!");
LCD_ALERTMESSAGEPGM("Err: ZPROBE"); LCD_ALERTMESSAGEPGM("Err: ZPROBE");
>>>>>>> MarlinFirmware/Development
} }
Stop(); Stop();
} }
#endif // Z_PROBE_ALLEN_KEY #endif // Z_PROBE_ALLEN_KEY
<<<<<<< HEAD
static void retract_z_probe() {
// Retract Z Servo endstop if enabled
#ifdef SERVO_ENDSTOPS
if (servo_endstops[Z_AXIS] > -1)
{
#if Z_RAISE_AFTER_PROBING > 0
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_AFTER_PROBING);
st_synchronize();
#endif
#if SERVO_LEVELING
servos[servo_endstops[Z_AXIS]].attach(0);
#endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]);
#if SERVO_LEVELING
delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach();
#endif
}
#elif defined(Z_PROBE_ALLEN_KEY)
// Move up for safety
feedrate = homing_feedrate[X_AXIS];
destination[Z_AXIS] = current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING;
prepare_move_raw();
// Move to the start position to initiate retraction
destination[X_AXIS] = Z_PROBE_ALLEN_KEY_RETRACT_X;
destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_RETRACT_Y;
destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_RETRACT_Z;
prepare_move_raw();
// Move the nozzle down to push the probe into retracted position
feedrate = homing_feedrate[Z_AXIS]/10;
destination[Z_AXIS] = current_position[Z_AXIS] - Z_PROBE_ALLEN_KEY_RETRACT_DEPTH;
prepare_move_raw();
// Move up for safety
feedrate = homing_feedrate[Z_AXIS]/2;
destination[Z_AXIS] = current_position[Z_AXIS] + Z_PROBE_ALLEN_KEY_RETRACT_DEPTH * 2;
prepare_move_raw();
// Home XY for safety
feedrate = homing_feedrate[X_AXIS]/2;
destination[X_AXIS] = 0;
destination[Y_AXIS] = 0;
prepare_move_raw();
st_synchronize();
// If Z_PROBE_AND_ENDSTOP is changed to completely break it's bonds from Z_MIN_ENDSTOP and become
// it's own unique entity, then the following logic will need to be modified
// so it only uses the Z_PROBE
#if defined(Z_PROBE_AND_ENDSTOP)
bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
if (z_probe_endstop)
#else
bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
if (z_min_endstop)
#endif
{
if (!Stopped)
{
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("Z-Probe failed to retract!");
LCD_ALERTMESSAGEPGM("Err: ZPROBE");
=======
} }
static void retract_z_probe(const float z_after=Z_RAISE_AFTER_PROBING) { static void retract_z_probe() {
#ifdef SERVO_ENDSTOPS #ifdef SERVO_ENDSTOPS
// Retract Z Servo endstop if enabled // Retract Z Servo endstop if enabled
if (servo_endstops[Z_AXIS] >= 0) { if (servo_endstops[Z_AXIS] >= 0) {
if (z_after > 0) { #if Z_RAISE_AFTER_PROBING > 0
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_after); do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_AFTER_PROBING);
st_synchronize(); st_synchronize();
>>>>>>> MarlinFirmware/Development #endif
}
#if SERVO_LEVELING #if SERVO_LEVELING
servos[servo_endstops[Z_AXIS]].attach(0); servos[servo_endstops[Z_AXIS]].attach(0);
#endif #endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]); servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]);
#if SERVO_LEVELING #if SERVO_LEVELING
delay(PROBE_SERVO_DEACTIVATION_DELAY); delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach(); servos[servo_endstops[Z_AXIS]].detach();
@ -1430,11 +1314,13 @@ static void retract_z_probe() {
st_synchronize(); st_synchronize();
// If Z_PROBE_AND_ENDSTOP is changed to completely break it's bonds from Z_MIN_ENDSTOP and become #if defined(Z_PROBE_AND_ENDSTOP)
// it's own unique entity, then the following logic will need to be modified bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
// so it only uses the Z_PROBE if (z_probe_endstop) {
#else
bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
if (!z_min_endstop) { if (!z_min_endstop) {
#endif
if (!Stopped) { if (!Stopped) {
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("Z-Probe failed to retract!"); SERIAL_ERRORLNPGM("Z-Probe failed to retract!");
@ -1467,8 +1353,15 @@ static void retract_z_probe() {
run_z_probe(); run_z_probe();
float measured_z = current_position[Z_AXIS]; float measured_z = current_position[Z_AXIS];
#if Z_RAISE_BETWEEN_PROBINGS > 0
if (retract_action == ProbeStay) {
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_BETWEEN_PROBINGS);
st_synchronize();
}
#endif
#if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY) #if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY)
if (retract_action & ProbeRetract) retract_z_probe(z_before); if (retract_action & ProbeRetract) retract_z_probe();
#endif #endif
if (verbose_level > 2) { if (verbose_level > 2) {
@ -1583,23 +1476,6 @@ static void homeaxis(int axis) {
#endif // Z_PROBE_SLED #endif // Z_PROBE_SLED
<<<<<<< HEAD
#ifndef Z_PROBE_SLED
// Engage Servo endstop if enabled and we are not using Z_PROBE_AND_ENDSTOP unless we are using Z_SAFE_HOMING
#ifdef SERVO_ENDSTOPS && (defined (Z_SAFE_HOMING) || ! defined (Z_PROBE_AND_ENDSTOP))
#if SERVO_LEVELING
if (axis==Z_AXIS) {
engage_z_probe();
}
else
#endif
if (servo_endstops[axis] > -1) {
servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]);
}
#endif
#endif // Z_PROBE_SLED
=======
>>>>>>> MarlinFirmware/Development
#ifdef Z_DUAL_ENDSTOPS #ifdef Z_DUAL_ENDSTOPS
if (axis == Z_AXIS) In_Homing_Process(true); if (axis == Z_AXIS) In_Homing_Process(true);
#endif #endif
@ -3921,23 +3797,23 @@ inline void gcode_M206() {
inline void gcode_M218() { inline void gcode_M218() {
if (setTargetedHotend(218)) return; if (setTargetedHotend(218)) return;
if (code_seen('X')) extruder_offset[tmp_extruder][X_AXIS] = code_value(); if (code_seen('X')) extruder_offset[X_AXIS][tmp_extruder] = code_value();
if (code_seen('Y')) extruder_offset[tmp_extruder][Y_AXIS] = code_value(); if (code_seen('Y')) extruder_offset[Y_AXIS][tmp_extruder] = code_value();
#ifdef DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE
if (code_seen('Z')) extruder_offset[tmp_extruder][Z_AXIS] = code_value(); if (code_seen('Z')) extruder_offset[Z_AXIS][tmp_extruder] = code_value();
#endif #endif
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET); SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
for (tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++) { for (tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++) {
SERIAL_ECHO(" "); SERIAL_ECHO(" ");
SERIAL_ECHO(extruder_offset[tmp_extruder][X_AXIS]); SERIAL_ECHO(extruder_offset[X_AXIS][tmp_extruder]);
SERIAL_ECHO(","); SERIAL_ECHO(",");
SERIAL_ECHO(extruder_offset[tmp_extruder][Y_AXIS]); SERIAL_ECHO(extruder_offset[Y_AXIS][tmp_extruder]);
#ifdef DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE
SERIAL_ECHO(","); SERIAL_ECHO(",");
SERIAL_ECHO(extruder_offset[tmp_extruder][Z_AXIS]); SERIAL_ECHO(extruder_offset[Z_AXIS][tmp_extruder]);
#endif #endif
} }
SERIAL_EOL; SERIAL_EOL;
@ -4628,13 +4504,13 @@ inline void gcode_M503() {
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET); SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
SERIAL_ECHO(" "); SERIAL_ECHO(" ");
SERIAL_ECHO(extruder_offset[0][X_AXIS]); SERIAL_ECHO(extruder_offset[X_AXIS][0]);
SERIAL_ECHO(","); SERIAL_ECHO(",");
SERIAL_ECHO(extruder_offset[0][Y_AXIS]); SERIAL_ECHO(extruder_offset[Y_AXIS][0]);
SERIAL_ECHO(" "); SERIAL_ECHO(" ");
SERIAL_ECHO(duplicate_extruder_x_offset); SERIAL_ECHO(duplicate_extruder_x_offset);
SERIAL_ECHO(","); SERIAL_ECHO(",");
SERIAL_ECHOLN(extruder_offset[1][Y_AXIS]); SERIAL_ECHOLN(extruder_offset[Y_AXIS][1]);
break; break;
case DXC_FULL_CONTROL_MODE: case DXC_FULL_CONTROL_MODE:
case DXC_AUTO_PARK_MODE: case DXC_AUTO_PARK_MODE:
@ -4769,11 +4645,11 @@ inline void gcode_T() {
// apply Y & Z extruder offset (x offset is already used in determining home pos) // apply Y & Z extruder offset (x offset is already used in determining home pos)
current_position[Y_AXIS] = current_position[Y_AXIS] - current_position[Y_AXIS] = current_position[Y_AXIS] -
extruder_offset[active_extruder][Y_AXIS] + extruder_offset[Y_AXIS][active_extruder] +
extruder_offset[tmp_extruder][Y_AXIS]; extruder_offset[Y_AXIS][tmp_extruder];
current_position[Z_AXIS] = current_position[Z_AXIS] - current_position[Z_AXIS] = current_position[Z_AXIS] -
extruder_offset[active_extruder][Z_AXIS] + extruder_offset[Z_AXIS][active_extruder] +
extruder_offset[tmp_extruder][Z_AXIS]; extruder_offset[Z_AXIS][tmp_extruder];
active_extruder = tmp_extruder; active_extruder = tmp_extruder;
@ -4803,7 +4679,7 @@ inline void gcode_T() {
#else // !DUAL_X_CARRIAGE #else // !DUAL_X_CARRIAGE
// Offset extruder (only by XY) // Offset extruder (only by XY)
for (int i=X_AXIS; i<=Y_AXIS; i++) for (int i=X_AXIS; i<=Y_AXIS; i++)
current_position[i] += extruder_offset[tmp_extruder][i] - extruder_offset[active_extruder][i]; current_position[i] += extruder_offset[i][tmp_extruder] - extruder_offset[i][active_extruder];
// Set the new active extruder and position // Set the new active extruder and position
active_extruder = tmp_extruder; active_extruder = tmp_extruder;
#endif // !DUAL_X_CARRIAGE #endif // !DUAL_X_CARRIAGE

View File

@ -740,7 +740,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// Servo Endstops // Servo Endstops
// //
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
// //
//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

View File

@ -680,7 +680,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// Servo Endstops // Servo Endstops
// //
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
// //
//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

View File

@ -680,7 +680,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// Servo Endstops // Servo Endstops
// //
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
// //
//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

View File

@ -702,7 +702,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// Servo Endstops // Servo Endstops
// //
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
// //
//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

View File

@ -708,7 +708,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// Servo Endstops // Servo Endstops
// //
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
// //
//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

View File

@ -731,7 +731,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// Servo Endstops // Servo Endstops
// //
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
// //
//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

View File

@ -701,7 +701,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// Servo Endstops // Servo Endstops
// //
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
// //
//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

View File

@ -755,7 +755,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// Servo Endstops // Servo Endstops
// //
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
// //
//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

View File

@ -759,7 +759,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// Servo Endstops // Servo Endstops
// //
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
// //
//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

View File

@ -699,7 +699,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// Servo Endstops // Servo Endstops
// //
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
// //
//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

View File

@ -705,7 +705,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// Servo Endstops // Servo Endstops
// //
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
// //
//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

View File

@ -83,15 +83,20 @@ unsigned char soft_pwm_bed;
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
int current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only int current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only
#endif #endif
#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc); #define HAS_HEATER_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0)
static int thermal_runaway_state_machine[4]; // = {0,0,0,0}; #define HAS_BED_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_BED_PERIOD) && THERMAL_RUNAWAY_PROTECTION_BED_PERIOD > 0 && TEMP_SENSOR_BED != 0)
static unsigned long thermal_runaway_timer[4]; // = {0,0,0,0}; #if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
static bool thermal_runaway = false; static bool thermal_runaway = false;
#if TEMP_SENSOR_BED != 0 void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
static int thermal_runaway_bed_state_machine; #if HAS_HEATER_THERMAL_PROTECTION
static unsigned long thermal_runaway_bed_timer; static int thermal_runaway_state_machine[4]; // = {0,0,0,0};
#endif static unsigned long thermal_runaway_timer[4]; // = {0,0,0,0};
#endif
#if HAS_BED_THERMAL_PROTECTION
static int thermal_runaway_bed_state_machine;
static unsigned long thermal_runaway_bed_timer;
#endif
#endif #endif
//=========================================================================== //===========================================================================
@ -650,7 +655,7 @@ void manage_heater() {
#if TEMP_SENSOR_BED != 0 #if TEMP_SENSOR_BED != 0
#if defined(THERMAL_RUNAWAY_PROTECTION_BED_PERIOD) && THERMAL_RUNAWAY_PROTECTION_BED_PERIOD > 0 #if HAS_BED_THERMAL_PROTECTION
thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, 9, THERMAL_RUNAWAY_PROTECTION_BED_PERIOD, THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS); thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, 9, THERMAL_RUNAWAY_PROTECTION_BED_PERIOD, THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS);
#endif #endif
@ -1008,7 +1013,7 @@ void setWatch() {
#endif #endif
} }
#if defined(THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0 #if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc)
{ {
/* /*

View File

@ -136,7 +136,6 @@ static void lcd_status_screen();
if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \ if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \
uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \ uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
bool wasClicked = LCD_CLICKED, itemSelected; \ bool wasClicked = LCD_CLICKED, itemSelected; \
if (wasClicked) lcd_quick_feedback(); \
for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \ for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
_menuItemNr = 0; _menuItemNr = 0;
@ -167,6 +166,7 @@ static void lcd_status_screen();
if (lcdDrawUpdate) \ if (lcdDrawUpdate) \
lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \ lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
if (wasClicked && itemSelected) { \ if (wasClicked && itemSelected) { \
lcd_quick_feedback(); \
menu_action_ ## type(args); \ menu_action_ ## type(args); \
return; \ return; \
} \ } \
@ -1155,10 +1155,10 @@ static void lcd_quick_feedback() {
#elif defined(BEEPER) && BEEPER > -1 #elif defined(BEEPER) && BEEPER > -1
SET_OUTPUT(BEEPER); SET_OUTPUT(BEEPER);
#ifndef LCD_FEEDBACK_FREQUENCY_HZ #ifndef LCD_FEEDBACK_FREQUENCY_HZ
#define LCD_FEEDBACK_FREQUENCY_HZ 500 #define LCD_FEEDBACK_FREQUENCY_HZ 5000
#endif #endif
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 50 #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
#endif #endif
const unsigned int delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2; const unsigned int delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2;
int i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000; int i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000;