Browse Source

Merge pull request #582 from hercek/upstream

add command M666 for adjusting delta printer endstop position
ErikZalm 11 years ago
parent
commit
f8d173bd0b
3 changed files with 43 additions and 2 deletions
  1. 19
    1
      Marlin/ConfigurationStore.cpp
  2. 3
    0
      Marlin/Marlin.h
  3. 21
    1
      Marlin/Marlin_main.cpp

+ 19
- 1
Marlin/ConfigurationStore.cpp View File

@@ -37,7 +37,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
37 37
 // the default values are used whenever there is a change to the data, to prevent
38 38
 // wrong data being written to the variables.
39 39
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
40
-#define EEPROM_VERSION "V08"
40
+#define EEPROM_VERSION "V09"
41 41
 
42 42
 #ifdef EEPROM_SETTINGS
43 43
 void Config_StoreSettings() 
@@ -57,6 +57,9 @@ void Config_StoreSettings()
57 57
   EEPROM_WRITE_VAR(i,max_z_jerk);
58 58
   EEPROM_WRITE_VAR(i,max_e_jerk);
59 59
   EEPROM_WRITE_VAR(i,add_homeing);
60
+  #ifdef DELTA
61
+  EEPROM_WRITE_VAR(i,endstop_adj);
62
+  #endif
60 63
   #ifndef ULTIPANEL
61 64
   int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
62 65
   int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
@@ -145,6 +148,15 @@ void Config_PrintSettings()
145 148
     SERIAL_ECHOPAIR(" Y" ,add_homeing[1] );
146 149
     SERIAL_ECHOPAIR(" Z" ,add_homeing[2] );
147 150
     SERIAL_ECHOLN("");
151
+#ifdef DELTA
152
+    SERIAL_ECHO_START;
153
+    SERIAL_ECHOLNPGM("Endstop adjustement (mm):");
154
+    SERIAL_ECHO_START;
155
+    SERIAL_ECHOPAIR("  M666 X",endstop_adj[0] );
156
+    SERIAL_ECHOPAIR(" Y" ,endstop_adj[1] );
157
+    SERIAL_ECHOPAIR(" Z" ,endstop_adj[2] );
158
+    SERIAL_ECHOLN("");
159
+#endif
148 160
 #ifdef PIDTEMP
149 161
     SERIAL_ECHO_START;
150 162
     SERIAL_ECHOLNPGM("PID settings:");
@@ -185,6 +197,9 @@ void Config_RetrieveSettings()
185 197
         EEPROM_READ_VAR(i,max_z_jerk);
186 198
         EEPROM_READ_VAR(i,max_e_jerk);
187 199
         EEPROM_READ_VAR(i,add_homeing);
200
+        #ifdef DELTA
201
+        EEPROM_READ_VAR(i,endstop_adj);
202
+        #endif
188 203
         #ifndef ULTIPANEL
189 204
         int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed;
190 205
         int absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed;
@@ -244,6 +259,9 @@ void Config_ResetDefault()
244 259
     max_z_jerk=DEFAULT_ZJERK;
245 260
     max_e_jerk=DEFAULT_EJERK;
246 261
     add_homeing[0] = add_homeing[1] = add_homeing[2] = 0;
262
+#ifdef DELTA
263
+    endstop_adj[0] = endstop_adj[1] = endstop_adj[2] = 0;
264
+#endif
247 265
 #ifdef ULTIPANEL
248 266
     plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP;
249 267
     plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP;

+ 3
- 0
Marlin/Marlin.h View File

@@ -191,6 +191,9 @@ extern int feedmultiply;
191 191
 extern int extrudemultiply; // Sets extrude multiply factor (in percent)
192 192
 extern float current_position[NUM_AXIS] ;
193 193
 extern float add_homeing[3];
194
+#ifdef DELTA
195
+extern float endstop_adj[3];
196
+#endif
194 197
 extern float min_pos[3];
195 198
 extern float max_pos[3];
196 199
 extern int fanSpeed;

+ 21
- 1
Marlin/Marlin_main.cpp View File

@@ -139,6 +139,7 @@
139 139
 // M503 - print the current settings (from memory not from eeprom)
140 140
 // M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
141 141
 // M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
142
+// M666 - set delta endstop adjustemnt
142 143
 // M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ]
143 144
 // M907 - Set digital trimpot motor current using axis codes.
144 145
 // M908 - Control digital trimpot directly.
@@ -167,6 +168,9 @@ int saved_feedmultiply;
167 168
 int extrudemultiply=100; //100->1 200->2
168 169
 float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
169 170
 float add_homeing[3]={0,0,0};
171
+#ifdef DELTA
172
+float endstop_adj[3]={0,0,0};
173
+#endif
170 174
 float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
171 175
 float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
172 176
 
@@ -794,7 +798,15 @@ static void homeaxis(int axis) {
794 798
 #endif
795 799
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
796 800
     st_synchronize();
797
-
801
+#ifdef DELTA
802
+    // retrace by the amount specified in endstop_adj
803
+    if (endstop_adj[axis] * axis_home_dir < 0) {
804
+      plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
805
+      destination[axis] = endstop_adj[axis];
806
+      plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
807
+      st_synchronize();
808
+    }
809
+#endif
798 810
     axis_is_at_home(axis);
799 811
     destination[axis] = current_position[axis];
800 812
     feedrate = 0.0;
@@ -1658,6 +1670,14 @@ void process_commands()
1658 1670
         if(code_seen(axis_codes[i])) add_homeing[i] = code_value();
1659 1671
       }
1660 1672
       break;
1673
+    #ifdef DELTA
1674
+    case 666: // M666 set delta endstop adjustemnt
1675
+      for(int8_t i=0; i < 3; i++)
1676
+      {
1677
+        if(code_seen(axis_codes[i])) endstop_adj[i] = code_value();
1678
+      }
1679
+      break;
1680
+    #endif
1661 1681
     #ifdef FWRETRACT
1662 1682
     case 207: //M207 - set retract length S[positive mm] F[feedrate mm/sec] Z[additional zlift/hop]
1663 1683
     {

Loading…
Cancel
Save