Skip to content

Commit

Permalink
Enabled safety stops in Marlin config.
Browse files Browse the repository at this point in the history
  • Loading branch information
marciot committed Aug 19, 2023
1 parent b2cf48a commit d8ec993
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1772,9 +1772,9 @@
* If an axis has endstops on both ends the one specified above is used for
* homing, while the other can be used for things like SD_ABORT_ON_ENDSTOP_HIT.
*/
//#define X_SAFETY_STOP
//#define Y_SAFETY_STOP
//#define Z_SAFETY_STOP
#define X_SAFETY_STOP // <-- changed
#define Y_SAFETY_STOP // <-- changed
#define Z_SAFETY_STOP // <-- changed
//#define I_SAFETY_STOP
//#define J_SAFETY_STOP
//#define K_SAFETY_STOP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,15 @@
#define X_MAX_POS 165.8
#define X_MIN_ENDSTOP_HIT_STATE LOW
#define X_MIN_POS 0
#define X_SAFETY_STOP
#define Y_BED_SIZE 155.8
#define Y_DRIVER_TYPE A4988
#define Y_HOME_DIR 1
#define Y_MAX_ENDSTOP_HIT_STATE LOW
#define Y_MAX_POS 196
#define Y_MIN_ENDSTOP_HIT_STATE LOW
#define Y_MIN_POS -8
#define Y_SAFETY_STOP
#define Z_CLEARANCE_BETWEEN_PROBES 5
#define Z_CLEARANCE_DEPLOY_PROBE 5
#define Z_CLEARANCE_FOR_HOMING 4
Expand All @@ -181,4 +183,5 @@
#define Z_PROBE_FEEDRATE_SLOW 60
#define Z_PROBE_LOW_POINT -5
#define Z_PROBE_OFFSET_RANGE_MAX 5
#define Z_PROBE_OFFSET_RANGE_MIN -2
#define Z_PROBE_OFFSET_RANGE_MIN -2
#define Z_SAFETY_STOP
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@
*/
//#define X_SAFETY_STOP
//#define Y_SAFETY_STOP
//#define Z_SAFETY_STOP
#define Z_SAFETY_STOP // <-- changed
//#define I_SAFETY_STOP
//#define J_SAFETY_STOP
//#define K_SAFETY_STOP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
#define X_MIN_ENDSTOP_HIT_STATE LOW
#define X_MIN_POS -3
#define X_RSENSE 0.12
//#define X_SAFETY_STOP
#define X_STALL_SENSITIVITY 4
#define Y_BED_SIZE 157
#define Y_CURRENT 920
Expand All @@ -237,6 +238,7 @@
#define Y_MIN_ENDSTOP_HIT_STATE HIGH
#define Y_MIN_POS -5
#define Y_RSENSE 0.12
//#define Y_SAFETY_STOP
#define Y_STALL_SENSITIVITY 4
#define Z_CLEARANCE_BETWEEN_PROBES 5
#define Z_CLEARANCE_DEPLOY_PROBE 5
Expand All @@ -257,4 +259,5 @@
#define Z_PROBE_LOW_POINT -5
#define Z_PROBE_OFFSET_RANGE_MAX 5
#define Z_PROBE_OFFSET_RANGE_MIN -2
#define Z_RSENSE 0.12
#define Z_RSENSE 0.12
#define Z_SAFETY_STOP
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@
*/
//#define X_SAFETY_STOP
//#define Y_SAFETY_STOP
//#define Z_SAFETY_STOP
#define Z_SAFETY_STOP // <-- changed
//#define I_SAFETY_STOP
//#define J_SAFETY_STOP
//#define K_SAFETY_STOP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
#define Z_MIN_POS 0
#define Z_MIN_PROBE_ENDSTOP_HIT_STATE LOW
#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
#define Z_SAFETY_STOP
#define Z_SAFE_HOMING
#define Z_SAFE_HOMING_X_POINT 10
#define Z_SAFE_HOMING_Y_POINT 10
Original file line number Diff line number Diff line change
Expand Up @@ -1772,9 +1772,9 @@
* If an axis has endstops on both ends the one specified above is used for
* homing, while the other can be used for things like SD_ABORT_ON_ENDSTOP_HIT.
*/
//#define X_SAFETY_STOP
//#define Y_SAFETY_STOP
//#define Z_SAFETY_STOP
#define X_SAFETY_STOP // <-- changed
#define Y_SAFETY_STOP // <-- changed
#define Z_SAFETY_STOP // <-- changed
//#define I_SAFETY_STOP
//#define J_SAFETY_STOP
//#define K_SAFETY_STOP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,15 @@
#define X_MAX_POS 301.5
#define X_MIN_ENDSTOP_HIT_STATE HIGH
#define X_MIN_POS -20.1
#define X_SAFETY_STOP
#define Y_BED_SIZE 281.4
#define Y_DRIVER_TYPE A4988
#define Y_HOME_DIR 1
#define Y_MAX_ENDSTOP_HIT_STATE HIGH
#define Y_MAX_POS 304.5
#define Y_MIN_ENDSTOP_HIT_STATE HIGH
#define Y_MIN_POS -20.1
#define Y_SAFETY_STOP
#define Z_CLEARANCE_BETWEEN_PROBES 5
#define Z_CLEARANCE_DEPLOY_PROBE 5
#define Z_CLEARANCE_FOR_HOMING 5
Expand All @@ -220,6 +222,7 @@
#define Z_PROBE_LOW_POINT -2
#define Z_PROBE_OFFSET_RANGE_MAX 5
#define Z_PROBE_OFFSET_RANGE_MIN -2
#define Z_SAFETY_STOP
#define Z_SAFE_HOMING
#define Z_SAFE_HOMING_X_POINT -19
#define Z_SAFE_HOMING_Y_POINT 258
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@
*/
//#define X_SAFETY_STOP
//#define Y_SAFETY_STOP
//#define Z_SAFETY_STOP
#define Z_SAFETY_STOP // <-- changed
//#define I_SAFETY_STOP
//#define J_SAFETY_STOP
//#define K_SAFETY_STOP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,5 @@
#define Z_PROBE_LOW_POINT -2
#define Z_PROBE_OFFSET_RANGE_MAX 5
#define Z_PROBE_OFFSET_RANGE_MIN -2
#define Z_RSENSE 0.12
#define Z_RSENSE 0.12
#define Z_SAFETY_STOP
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@
*/
//#define X_SAFETY_STOP
//#define Y_SAFETY_STOP
//#define Z_SAFETY_STOP
#define Z_SAFETY_STOP // <-- changed
//#define I_SAFETY_STOP
//#define J_SAFETY_STOP
//#define K_SAFETY_STOP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,5 @@
#define Z_PROBE_FEEDRATE_SLOW 60
#define Z_PROBE_LOW_POINT -2
#define Z_PROBE_OFFSET_RANGE_MAX 5
#define Z_PROBE_OFFSET_RANGE_MIN -2
#define Z_PROBE_OFFSET_RANGE_MIN -2
#define Z_SAFETY_STOP
41 changes: 28 additions & 13 deletions config/examples/build-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -891,23 +891,33 @@ function make_config(PRINTER, TOOLHEAD) {
MARLIN["X_HOME_DIR"] = -1 // Home left
MARLIN["Y_HOME_DIR"] = 1 // Home bed forward
MARLIN["QUICK_HOME"] = true
MARLIN["X_SAFETY_STOP"] = !PRINTER.includes("Hibiscus_Mini2")
MARLIN["Y_SAFETY_STOP"] = !PRINTER.includes("Hibiscus_Mini2") && !USE_BTT_002
MARLIN["Z_SAFETY_STOP"] = !USE_BTT_002
}
else if (PRINTER.includes("Juniper_TAZ5") || PRINTER.includes("Guava_TAZ4")) {
MARLIN["X_HOME_DIR"] = -1 // Home left
MARLIN["Y_HOME_DIR"] = -1 // Home bed rear
MARLIN["QUICK_HOME"] = true
MARLIN["Z_SAFETY_STOP"] = true
}

else if (PRINTER.includes("Redgum_TAZWorkhorse") || PRINTER.includes("SynDaver_Axi")) {
MARLIN["X_HOME_DIR"] = -1 // Home left
MARLIN["Y_HOME_DIR"] = -1 // Home bed rear
MARLIN["QUICK_HOME"] = true
MARLIN["Z_SAFETY_STOP"] = true
}

else if (IS_TAZ) {
MARLIN["X_HOME_DIR"] = -1 // Home left
MARLIN["Y_HOME_DIR"] = 1 // Home bed forward
MARLIN["QUICK_HOME"] = true
if(!PRINTER.includes("Quiver_TAZPro")) {
MARLIN["X_SAFETY_STOP"] = true
MARLIN["Y_SAFETY_STOP"] = true
}
MARLIN["Z_SAFETY_STOP"] = true
}

if (USE_HOME_BUTTON || ["BLTouch", "Inductive"].includes(PROBE_STYLE) ||
Expand Down Expand Up @@ -1325,6 +1335,7 @@ function make_config(PRINTER, TOOLHEAD) {

if (TOOLHEAD_IS_UNIVERSAL && USE_Z_SCREW) {
MARLIN["USE_XMAX_PLUG"] = false
MARLIN["X_SAFETY_STOP"] = false
MARLIN["NO_MOTION_BEFORE_HOMING"] = true
ADAPTER_X_OFFSET = 0
ADAPTER_Y_OFFSET = IS_TAZ ? -2.0 : -7.2
Expand Down Expand Up @@ -3066,24 +3077,28 @@ function make_config(PRINTER, TOOLHEAD) {

MARLIN["TOOLHEAD_TYPE"] = C_STRING(TOOLHEAD_TYPE)

function checkEndstop(u,assertion) {
if(MARLIN.hasOwnProperty(u)) {
if(!assertion) {
console.log("WARNING:", u, "not supported on this version of Marlin");
}
delete MARLIN[u];
function checkEndstop(axis) {
function a(s) {
return s.replace("X",axis);
}
if(MARLIN[a("X_HOME_DIR")] == -1) {
if(!ENABLED(a("USE_XMIN_PLUG"))) console.log("WARNING:", a("USE_XMIN_PLUG"), "needs to be enabled");
if( ENABLED(a("USE_XMAX_PLUG")) && !ENABLED(a("X_SAFETY_STOP"))) console.log("WARNING:", a("X_SAFETY_STOP"), "needs to be enabled");
if(!ENABLED(a("USE_XMAX_PLUG")) && ENABLED(a("X_SAFETY_STOP"))) console.log("WARNING:", a("X_SAFETY_STOP"), "needs to be disabled");
} else {
if(!ENABLED(a("USE_XMAX_PLUG"))) console.log("WARNING:", a("USE_XMAX_PLUG"), "needs to be enabled");
if( ENABLED(a("USE_XMIN_PLUG")) && !ENABLED(a("X_SAFETY_STOP"))) console.log("WARNING:", a("X_SAFETY_STOP"), "needs to be enabled");
if(!ENABLED(a("USE_XMIN_PLUG")) && ENABLED(a("X_SAFETY_STOP"))) console.log("WARNING:", a("X_SAFETY_STOP"), "needs to be disabled");
}
delete MARLIN[a("USE_XMIN_PLUG")];
delete MARLIN[a("USE_XMAX_PLUG")];
}

// As of https://github.com/MarlinFirmware/Marlin/pull/25748, USE_*_PLUG is no longer used,
// but keep it around for now.
checkEndstop("USE_XMIN_PLUG", MARLIN["X_HOME_DIR"] == -1);
checkEndstop("USE_YMIN_PLUG", MARLIN["Y_HOME_DIR"] == -1);
checkEndstop("USE_ZMIN_PLUG", MARLIN["Z_HOME_DIR"] == -1);
checkEndstop("USE_XMAX_PLUG", MARLIN["X_HOME_DIR"] == 1);
checkEndstop("USE_YMAX_PLUG", MARLIN["Y_HOME_DIR"] == 1);
checkEndstop("USE_ZMAX_PLUG", MARLIN["Z_HOME_DIR"] == 1);

checkEndstop("X");
checkEndstop("Y");
checkEndstop("Z");
return MARLIN
}
/***************************** END OF CONFIGURATION ****************************/
Expand Down

0 comments on commit d8ec993

Please sign in to comment.