Browse Source

Add M605 to dynamically set delta configuration

Save above configs in eeprom
fix docs in createTemperatureLookupMarlin.py
add missing azteegX3pro digipot settings in delta example config
Jim Morris 10 years ago
parent
commit
af9395ac2e

+ 21
- 4
Marlin/ConfigurationStore.cpp View File

37
 // the default values are used whenever there is a change to the data, to prevent
37
 // the default values are used whenever there is a change to the data, to prevent
38
 // wrong data being written to the variables.
38
 // wrong data being written to the variables.
39
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
39
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
40
-#define EEPROM_VERSION "V10"
40
+#define EEPROM_VERSION "V11"
41
 
41
 
42
 #ifdef EEPROM_SETTINGS
42
 #ifdef EEPROM_SETTINGS
43
 void Config_StoreSettings() 
43
 void Config_StoreSettings() 
59
   EEPROM_WRITE_VAR(i,add_homeing);
59
   EEPROM_WRITE_VAR(i,add_homeing);
60
   #ifdef DELTA
60
   #ifdef DELTA
61
   EEPROM_WRITE_VAR(i,endstop_adj);
61
   EEPROM_WRITE_VAR(i,endstop_adj);
62
+  EEPROM_WRITE_VAR(i,delta_radius);
63
+  EEPROM_WRITE_VAR(i,delta_diagonal_rod);
64
+  EEPROM_WRITE_VAR(i,delta_segments_per_second);
62
   #endif
65
   #endif
63
   #ifndef ULTIPANEL
66
   #ifndef ULTIPANEL
64
   int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
67
   int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
156
     SERIAL_ECHOPAIR("  M666 X",endstop_adj[0] );
159
     SERIAL_ECHOPAIR("  M666 X",endstop_adj[0] );
157
     SERIAL_ECHOPAIR(" Y" ,endstop_adj[1] );
160
     SERIAL_ECHOPAIR(" Y" ,endstop_adj[1] );
158
     SERIAL_ECHOPAIR(" Z" ,endstop_adj[2] );
161
     SERIAL_ECHOPAIR(" Z" ,endstop_adj[2] );
159
-    SERIAL_ECHOLN("");
162
+	SERIAL_ECHOLN("");
163
+	SERIAL_ECHO_START;
164
+	SERIAL_ECHOLNPGM("Delta settings: L=delta_diagonal_rod, R=delta_radius, S=delta_segments_per_second");
165
+	SERIAL_ECHO_START;
166
+	SERIAL_ECHOPAIR("  M665 L",delta_diagonal_rod );
167
+	SERIAL_ECHOPAIR(" R" ,delta_radius );
168
+	SERIAL_ECHOPAIR(" S" ,delta_segments_per_second );
169
+	SERIAL_ECHOLN("");
160
 #endif
170
 #endif
161
 #ifdef PIDTEMP
171
 #ifdef PIDTEMP
162
     SERIAL_ECHO_START;
172
     SERIAL_ECHO_START;
199
         EEPROM_READ_VAR(i,max_e_jerk);
209
         EEPROM_READ_VAR(i,max_e_jerk);
200
         EEPROM_READ_VAR(i,add_homeing);
210
         EEPROM_READ_VAR(i,add_homeing);
201
         #ifdef DELTA
211
         #ifdef DELTA
202
-        EEPROM_READ_VAR(i,endstop_adj);
212
+		EEPROM_READ_VAR(i,endstop_adj);
213
+		EEPROM_READ_VAR(i,delta_radius);
214
+		EEPROM_READ_VAR(i,delta_diagonal_rod);
215
+		EEPROM_READ_VAR(i,delta_segments_per_second);
203
         #endif
216
         #endif
204
         #ifndef ULTIPANEL
217
         #ifndef ULTIPANEL
205
         int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed;
218
         int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed;
264
     max_e_jerk=DEFAULT_EJERK;
277
     max_e_jerk=DEFAULT_EJERK;
265
     add_homeing[0] = add_homeing[1] = add_homeing[2] = 0;
278
     add_homeing[0] = add_homeing[1] = add_homeing[2] = 0;
266
 #ifdef DELTA
279
 #ifdef DELTA
267
-    endstop_adj[0] = endstop_adj[1] = endstop_adj[2] = 0;
280
+	endstop_adj[0] = endstop_adj[1] = endstop_adj[2] = 0;
281
+	delta_radius= DELTA_RADIUS;
282
+	delta_diagonal_rod= DELTA_DIAGONAL_ROD;
283
+	delta_segments_per_second= DELTA_SEGMENTS_PER_SECOND;
284
+	recalc_delta_settings(delta_radius, delta_diagonal_rod);
268
 #endif
285
 #endif
269
 #ifdef ULTIPANEL
286
 #ifdef ULTIPANEL
270
     plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP;
287
     plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP;

+ 4
- 0
Marlin/Marlin.h View File

209
 extern float add_homeing[3];
209
 extern float add_homeing[3];
210
 #ifdef DELTA
210
 #ifdef DELTA
211
 extern float endstop_adj[3];
211
 extern float endstop_adj[3];
212
+extern float delta_radius;
213
+extern float delta_diagonal_rod;
214
+extern float delta_segments_per_second;
215
+void recalc_delta_settings(float radius, float diagonal_rod);
212
 #endif
216
 #endif
213
 extern float min_pos[3];
217
 extern float min_pos[3];
214
 extern float max_pos[3];
218
 extern float max_pos[3];

+ 50
- 13
Marlin/Marlin_main.cpp View File

161
 // M503 - print the current settings (from memory not from eeprom)
161
 // M503 - print the current settings (from memory not from eeprom)
162
 // M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
162
 // M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
163
 // M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
163
 // M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
164
+// M665 - set delta configurations
164
 // M666 - set delta endstop adjustemnt
165
 // M666 - set delta endstop adjustemnt
165
 // M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ]
166
 // M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ]
166
 // M907 - Set digital trimpot motor current using axis codes.
167
 // M907 - Set digital trimpot motor current using axis codes.
246
 #endif
247
 #endif
247
 
248
 
248
 #ifdef DELTA
249
 #ifdef DELTA
249
-float delta[3] = {0.0, 0.0, 0.0};
250
-#endif
251
-
250
+  float delta[3] = {0.0, 0.0, 0.0};
251
+  #define SIN_60 0.8660254037844386
252
+  #define COS_60 0.5
253
+  // these are the default values, can be overriden with M665
254
+  float delta_radius= DELTA_RADIUS;
255
+  float delta_tower1_x= -SIN_60*delta_radius; // front left tower
256
+  float delta_tower1_y= -COS_60*delta_radius;	   
257
+  float delta_tower2_x=  SIN_60*delta_radius; // front right tower
258
+  float delta_tower2_y= -COS_60*delta_radius;	   
259
+  float delta_tower3_x= 0.0;                  // back middle tower
260
+  float delta_tower3_y= delta_radius;
261
+  float delta_diagonal_rod= DELTA_DIAGONAL_ROD;
262
+  float delta_diagonal_rod_2= sq(delta_diagonal_rod);
263
+  float delta_segments_per_second= DELTA_SEGMENTS_PER_SECOND;
264
+#endif					
252
 
265
 
253
 //===========================================================================
266
 //===========================================================================
254
 //=============================private variables=============================
267
 //=============================private variables=============================
2267
       }
2280
       }
2268
       break;
2281
       break;
2269
     #ifdef DELTA
2282
     #ifdef DELTA
2283
+	case 665: // M665 set delta configurations L<diagonal_rod> R<delta_radius> S<segments_per_sec>
2284
+		if(code_seen('L')) {
2285
+			delta_diagonal_rod= code_value();
2286
+		}
2287
+		if(code_seen('R')) {
2288
+			delta_radius= code_value();
2289
+		}
2290
+		if(code_seen('S')) {
2291
+			delta_segments_per_second= code_value();
2292
+		}
2293
+		
2294
+		recalc_delta_settings(delta_radius, delta_diagonal_rod);
2295
+		break;
2270
     case 666: // M666 set delta endstop adjustemnt
2296
     case 666: // M666 set delta endstop adjustemnt
2271
       for(int8_t i=0; i < 3; i++)
2297
       for(int8_t i=0; i < 3; i++)
2272
       {
2298
       {
3101
 }
3127
 }
3102
 
3128
 
3103
 #ifdef DELTA
3129
 #ifdef DELTA
3130
+void recalc_delta_settings(float radius, float diagonal_rod)
3131
+{
3132
+	 delta_tower1_x= -SIN_60*radius; // front left tower
3133
+	 delta_tower1_y= -COS_60*radius;	   
3134
+	 delta_tower2_x=  SIN_60*radius; // front right tower
3135
+	 delta_tower2_y= -COS_60*radius;	   
3136
+	 delta_tower3_x= 0.0;                  // back middle tower
3137
+	 delta_tower3_y= radius;
3138
+	 delta_diagonal_rod_2= sq(diagonal_rod);
3139
+}
3140
+
3104
 void calculate_delta(float cartesian[3])
3141
 void calculate_delta(float cartesian[3])
3105
 {
3142
 {
3106
-  delta[X_AXIS] = sqrt(DELTA_DIAGONAL_ROD_2
3107
-                       - sq(DELTA_TOWER1_X-cartesian[X_AXIS])
3108
-                       - sq(DELTA_TOWER1_Y-cartesian[Y_AXIS])
3143
+  delta[X_AXIS] = sqrt(delta_diagonal_rod_2
3144
+                       - sq(delta_tower1_x-cartesian[X_AXIS])
3145
+                       - sq(delta_tower1_y-cartesian[Y_AXIS])
3109
                        ) + cartesian[Z_AXIS];
3146
                        ) + cartesian[Z_AXIS];
3110
-  delta[Y_AXIS] = sqrt(DELTA_DIAGONAL_ROD_2
3111
-                       - sq(DELTA_TOWER2_X-cartesian[X_AXIS])
3112
-                       - sq(DELTA_TOWER2_Y-cartesian[Y_AXIS])
3147
+  delta[Y_AXIS] = sqrt(delta_diagonal_rod_2
3148
+                       - sq(delta_tower2_x-cartesian[X_AXIS])
3149
+                       - sq(delta_tower2_y-cartesian[Y_AXIS])
3113
                        ) + cartesian[Z_AXIS];
3150
                        ) + cartesian[Z_AXIS];
3114
-  delta[Z_AXIS] = sqrt(DELTA_DIAGONAL_ROD_2
3115
-                       - sq(DELTA_TOWER3_X-cartesian[X_AXIS])
3116
-                       - sq(DELTA_TOWER3_Y-cartesian[Y_AXIS])
3151
+  delta[Z_AXIS] = sqrt(delta_diagonal_rod_2
3152
+                       - sq(delta_tower3_x-cartesian[X_AXIS])
3153
+                       - sq(delta_tower3_y-cartesian[Y_AXIS])
3117
                        ) + cartesian[Z_AXIS];
3154
                        ) + cartesian[Z_AXIS];
3118
   /*
3155
   /*
3119
   SERIAL_ECHOPGM("cartesian x="); SERIAL_ECHO(cartesian[X_AXIS]);
3156
   SERIAL_ECHOPGM("cartesian x="); SERIAL_ECHO(cartesian[X_AXIS]);
3143
   if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); }
3180
   if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); }
3144
   if (cartesian_mm < 0.000001) { return; }
3181
   if (cartesian_mm < 0.000001) { return; }
3145
   float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
3182
   float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
3146
-  int steps = max(1, int(DELTA_SEGMENTS_PER_SECOND * seconds));
3183
+  int steps = max(1, int(delta_segments_per_second * seconds));
3147
   // SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
3184
   // SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
3148
   // SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
3185
   // SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
3149
   // SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps);
3186
   // SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps);

+ 5
- 4
Marlin/createTemperatureLookupMarlin.py View File

16
 Options:
16
 Options:
17
   -h, --help        show this help
17
   -h, --help        show this help
18
   --rp=...          pull-up resistor
18
   --rp=...          pull-up resistor
19
-  --t0=ttt:rrr      low temperature temperature:resistance point (around 25C)
20
-  --t1=ttt:rrr      middle temperature temperature:resistance point (around 150C)
21
-  --t2=ttt:rrr      high temperature temperature:resistance point (around 250C)
19
+  --t1=ttt:rrr      low temperature temperature:resistance point (around 25C)
20
+  --t2=ttt:rrr      middle temperature temperature:resistance point (around 150C)
21
+  --t3=ttt:rrr      high temperature temperature:resistance point (around 250C)
22
   --num-temps=...   the number of temperature points to calculate (default: 20)
22
   --num-temps=...   the number of temperature points to calculate (default: 20)
23
 """
23
 """
24
 
24
 
98
     
98
     
99
     try:
99
     try:
100
         opts, args = getopt.getopt(argv, "h", ["help", "rp=", "t1=", "t2=", "t3=", "num-temps="])
100
         opts, args = getopt.getopt(argv, "h", ["help", "rp=", "t1=", "t2=", "t3=", "num-temps="])
101
-    except getopt.GetoptError:
101
+    except getopt.GetoptError as err:
102
+        print  str(err)
102
         usage()
103
         usage()
103
         sys.exit(2)
104
         sys.exit(2)
104
         
105
         

+ 1
- 12
Marlin/example_configurations/delta/Configuration.h View File

51
 // 65 = Azteeg X1
51
 // 65 = Azteeg X1
52
 // 66 = Melzi with ATmega1284 (MaKr3d version)
52
 // 66 = Melzi with ATmega1284 (MaKr3d version)
53
 // 67 = Azteeg X3
53
 // 67 = Azteeg X3
54
+// 68 = Azteeg X3 Pro
54
 // 7  = Ultimaker
55
 // 7  = Ultimaker
55
 // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
56
 // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
56
 // 77 = 3Drag Controller
57
 // 77 = 3Drag Controller
119
 // Effective horizontal distance bridged by diagonal push rods.
120
 // Effective horizontal distance bridged by diagonal push rods.
120
 #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-DELTA_EFFECTOR_OFFSET-DELTA_CARRIAGE_OFFSET)
121
 #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-DELTA_EFFECTOR_OFFSET-DELTA_CARRIAGE_OFFSET)
121
 
122
 
122
-#define DELTA_DIAGONAL_ROD_2 sq(DELTA_DIAGONAL_ROD)
123
-
124
-// Effective X/Y positions of the three vertical towers.
125
-#define SIN_60 0.8660254037844386
126
-#define COS_60 0.5
127
-#define DELTA_TOWER1_X -SIN_60*DELTA_RADIUS // front left tower
128
-#define DELTA_TOWER1_Y -COS_60*DELTA_RADIUS
129
-#define DELTA_TOWER2_X SIN_60*DELTA_RADIUS // front right tower
130
-#define DELTA_TOWER2_Y -COS_60*DELTA_RADIUS
131
-#define DELTA_TOWER3_X 0.0 // back middle tower
132
-#define DELTA_TOWER3_Y DELTA_RADIUS
133
-
134
 //===========================================================================
123
 //===========================================================================
135
 //=============================Thermal Settings  ============================
124
 //=============================Thermal Settings  ============================
136
 //===========================================================================
125
 //===========================================================================

+ 6
- 0
Marlin/example_configurations/delta/Configuration_adv.h View File

270
 // Motor Current setting (Only functional when motor driver current ref pins are connected to a digital trimpot on supported boards)
270
 // Motor Current setting (Only functional when motor driver current ref pins are connected to a digital trimpot on supported boards)
271
 #define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
271
 #define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
272
 
272
 
273
+// uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
274
+//#define DIGIPOT_I2C
275
+// Number of channels available for I2C digipot, For Azteeg X3 Pro we have 8
276
+#define DIGIPOT_I2C_NUM_CHANNELS 8
277
+// actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
278
+#define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}
273
 
279
 
274
 //===========================================================================
280
 //===========================================================================
275
 //=============================Additional Features===========================
281
 //=============================Additional Features===========================

Loading…
Cancel
Save