diff options
author | kliment <kliment.yanev@gmail.com> | 2011-05-15 13:15:41 -0700 |
---|---|---|
committer | kliment <kliment.yanev@gmail.com> | 2011-05-15 13:15:41 -0700 |
commit | a0272ab76226acaf9a5aeeaf95c448f9bb6cc366 (patch) | |
tree | 870056031c69b014bd2de8dbfc0b1365e2ba6c05 | |
parent | db793cda52eb29cad5e96b826377186fc177fbf4 (diff) | |
parent | 3dba0cd086d96358e6bc3570e364324406769304 (diff) |
Merge pull request #25 from ScribbleJ/3dba0cd086d96358e6bc3570e364324406769304
Endstop patch
-rw-r--r-- | Tonokip_Firmware/Tonokip_Firmware.pde | 28 | ||||
-rw-r--r-- | Tonokip_Firmware/configuration.h | 6 |
2 files changed, 20 insertions, 14 deletions
diff --git a/Tonokip_Firmware/Tonokip_Firmware.pde b/Tonokip_Firmware/Tonokip_Firmware.pde index 5faf413..8765267 100644 --- a/Tonokip_Firmware/Tonokip_Firmware.pde +++ b/Tonokip_Firmware/Tonokip_Firmware.pde @@ -224,7 +224,7 @@ void setup() if(Y_ENABLE_PIN > -1) if(!Y_ENABLE_ON) digitalWrite(Y_ENABLE_PIN,HIGH); if(Z_ENABLE_PIN > -1) if(!Z_ENABLE_ON) digitalWrite(Z_ENABLE_PIN,HIGH); if(E_ENABLE_PIN > -1) if(!E_ENABLE_ON) digitalWrite(E_ENABLE_PIN,HIGH); - + //endstop pullups #ifdef ENDSTOPPULLUPS if(X_MIN_PIN > -1) { pinMode(X_MIN_PIN,INPUT); digitalWrite(X_MIN_PIN,HIGH);} @@ -448,6 +448,7 @@ inline void process_commands() { unsigned long codenum; //throw away variable char *starpos = NULL; + if(code_seen('G')) { switch((int)code_value()) @@ -484,17 +485,17 @@ inline void process_commands() current_e = 0; feedrate = 0; - if(X_MIN_PIN > -1) { + if(X_MIN_PIN > -1 || X_MAX_PIN > -1) { current_x = 0; - destination_x = -1.5 * X_MAX_LENGTH; + destination_x = 1.5 * X_MAX_LENGTH * X_HOME_DIR; feedrate = min_units_per_second * 60; prepare_move(); current_x = 0; - destination_x = 1; + destination_x = -1 * X_HOME_DIR; prepare_move(); - destination_x = -10; + destination_x = 10 * X_HOME_DIR; prepare_move(); current_x = 0; @@ -502,17 +503,17 @@ inline void process_commands() feedrate = 0; } - if(Y_MIN_PIN > -1) { + if(Y_MIN_PIN > -1 || Y_MAX_PIN > -1) { current_y = 0; - destination_y = -1.5 * Y_MAX_LENGTH; + destination_y = 1.5 * Y_MAX_LENGTH * Y_HOME_DIR; feedrate = min_units_per_second * 60; prepare_move(); current_y = 0; - destination_y = 1; + destination_y = -1 * Y_HOME_DIR; prepare_move(); - destination_y = -10; + destination_y = 10 * Y_HOME_DIR; prepare_move(); current_y = 0; @@ -520,17 +521,17 @@ inline void process_commands() feedrate = 0; } - if(Z_MIN_PIN > -1) { + if(Z_MIN_PIN > -1 || Z_MAX_PIN > -1) { current_z = 0; - destination_z = -1.5 * Z_MAX_LENGTH; + destination_z = 1.5 * Z_MAX_LENGTH * Z_HOME_DIR; feedrate = max_z_feedrate/2; prepare_move(); current_z = 0; - destination_z = 1; + destination_z = -1 * Z_HOME_DIR; prepare_move(); - destination_z = -10; + destination_z = 10 * Z_HOME_DIR; prepare_move(); current_z = 0; @@ -777,7 +778,6 @@ inline void process_commands() case 115: // M115 Serial.println("FIRMWARE_NAME:Sprinter FIRMWARE_URL:http%%3A/github.com/kliment/Sprinter/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1"); break; - case 114: // M114 Serial.print("X:"); Serial.print(current_x); diff --git a/Tonokip_Firmware/configuration.h b/Tonokip_Firmware/configuration.h index 8ef28e4..eab2e46 100644 --- a/Tonokip_Firmware/configuration.h +++ b/Tonokip_Firmware/configuration.h @@ -115,6 +115,12 @@ const bool INVERT_Y_DIR = false; const bool INVERT_Z_DIR = true; const bool INVERT_E_DIR = false; +// Sets direction of endstops when homing; 1=MAX, -1=MIN +const int X_HOME_DIR = -1; +const int Y_HOME_DIR = -1; +const int Z_HOME_DIR = -1; + + //Thermistor settings: //Uncomment for 100k thermistor |