From 93770c54edb1cf4518544ffc61d747a64789bc1e Mon Sep 17 00:00:00 2001 From: tonokip Date: Wed, 12 May 2010 19:11:30 -0700 Subject: added failsafe endstop checking Mcode that can be used for homing --- Tonokip_Firmware/Tonokip_Firmware.pde | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Tonokip_Firmware/Tonokip_Firmware.pde b/Tonokip_Firmware/Tonokip_Firmware.pde index 2290a8e..71d495b 100644 --- a/Tonokip_Firmware/Tonokip_Firmware.pde +++ b/Tonokip_Firmware/Tonokip_Firmware.pde @@ -29,6 +29,7 @@ // M83 - Set E codes relative while in Absolute Coordinates (G90) mode // M84 - Disable steppers until next move // M85 - Set inactivity shutdown timer with parameter S. To disable set zero (default) +// M86 - If Endstop is Not Activated then Abort Print. Specify X and/or Y // M92 - Set axis_steps_per_unit - same syntax as G92 //Stepper Movement Variables @@ -322,6 +323,10 @@ inline void process_commands() code_seen('S'); max_inactive_time = code_value()*1000; break; + case 86: // M86 If Endstop is Not Activated then Abort Print + if(code_seen('X')) if( digitalRead(X_MIN_PIN) == ENDSTOPS_INVERTING ) kill(3); + if(code_seen('Y')) if( digitalRead(Y_MIN_PIN) == ENDSTOPS_INVERTING ) kill(4); + break; case 92: // M92 if(code_seen('X')) x_steps_per_unit = code_value(); if(code_seen('Y')) y_steps_per_unit = code_value(); @@ -582,8 +587,13 @@ inline void kill(byte debug) while(1) { - if(debug == 1) Serial.print("Inactivity Shutdown, Last Line: "); - if(debug == 2) Serial.print("Linear Move Abort, Last Line: "); + switch(debug) + { + case 1: Serial.print("Inactivity Shutdown, Last Line: "); break; + case 2: Serial.print("Linear Move Abort, Last Line: "); break; + case 3: Serial.print("Homing X Min Stop Fail, Last Line: "); break; + case 4: Serial.print("Homing Y Min Stop Fail, Last Line: "); break; + } Serial.println(gcode_LastN); delay(5000); // 5 Second delay } -- cgit v1.2.1