Sfoglia il codice sorgente

Merge pull request #786 from wolfmanjm/add/M665-set-delta-configuration

Add M665 to dynamically set delta configuration
ErikZalm 11 anni fa
parent
commit
8c98690e1d

+ 21
- 4
Marlin/ConfigurationStore.cpp Vedi 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 Vedi 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 Vedi 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 adjustment
165
 // M666 - set delta endstop adjustment
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.
249
 #endif
250
 #endif
250
 
251
 
251
 #ifdef DELTA
252
 #ifdef DELTA
252
-float delta[3] = {0.0, 0.0, 0.0};
253
-#endif
254
-
253
+  float delta[3] = {0.0, 0.0, 0.0};
254
+  #define SIN_60 0.8660254037844386
255
+  #define COS_60 0.5
256
+  // these are the default values, can be overriden with M665
257
+  float delta_radius= DELTA_RADIUS;
258
+  float delta_tower1_x= -SIN_60*delta_radius; // front left tower
259
+  float delta_tower1_y= -COS_60*delta_radius;	   
260
+  float delta_tower2_x=  SIN_60*delta_radius; // front right tower
261
+  float delta_tower2_y= -COS_60*delta_radius;	   
262
+  float delta_tower3_x= 0.0;                  // back middle tower
263
+  float delta_tower3_y= delta_radius;
264
+  float delta_diagonal_rod= DELTA_DIAGONAL_ROD;
265
+  float delta_diagonal_rod_2= sq(delta_diagonal_rod);
266
+  float delta_segments_per_second= DELTA_SEGMENTS_PER_SECOND;
267
+#endif					
255
 
268
 
256
 //===========================================================================
269
 //===========================================================================
257
 //=============================Private Variables=============================
270
 //=============================Private Variables=============================
2293
       }
2306
       }
2294
       break;
2307
       break;
2295
     #ifdef DELTA
2308
     #ifdef DELTA
2309
+	case 665: // M665 set delta configurations L<diagonal_rod> R<delta_radius> S<segments_per_sec>
2310
+		if(code_seen('L')) {
2311
+			delta_diagonal_rod= code_value();
2312
+		}
2313
+		if(code_seen('R')) {
2314
+			delta_radius= code_value();
2315
+		}
2316
+		if(code_seen('S')) {
2317
+			delta_segments_per_second= code_value();
2318
+		}
2319
+		
2320
+		recalc_delta_settings(delta_radius, delta_diagonal_rod);
2321
+		break;
2296
     case 666: // M666 set delta endstop adjustemnt
2322
     case 666: // M666 set delta endstop adjustemnt
2297
       for(int8_t i=0; i < 3; i++)
2323
       for(int8_t i=0; i < 3; i++)
2298
       {
2324
       {
3091
 }
3117
 }
3092
 
3118
 
3093
 #ifdef DELTA
3119
 #ifdef DELTA
3120
+void recalc_delta_settings(float radius, float diagonal_rod)
3121
+{
3122
+	 delta_tower1_x= -SIN_60*radius; // front left tower
3123
+	 delta_tower1_y= -COS_60*radius;	   
3124
+	 delta_tower2_x=  SIN_60*radius; // front right tower
3125
+	 delta_tower2_y= -COS_60*radius;	   
3126
+	 delta_tower3_x= 0.0;                  // back middle tower
3127
+	 delta_tower3_y= radius;
3128
+	 delta_diagonal_rod_2= sq(diagonal_rod);
3129
+}
3130
+
3094
 void calculate_delta(float cartesian[3])
3131
 void calculate_delta(float cartesian[3])
3095
 {
3132
 {
3096
-  delta[X_AXIS] = sqrt(DELTA_DIAGONAL_ROD_2
3097
-                       - sq(DELTA_TOWER1_X-cartesian[X_AXIS])
3098
-                       - sq(DELTA_TOWER1_Y-cartesian[Y_AXIS])
3133
+  delta[X_AXIS] = sqrt(delta_diagonal_rod_2
3134
+                       - sq(delta_tower1_x-cartesian[X_AXIS])
3135
+                       - sq(delta_tower1_y-cartesian[Y_AXIS])
3099
                        ) + cartesian[Z_AXIS];
3136
                        ) + cartesian[Z_AXIS];
3100
-  delta[Y_AXIS] = sqrt(DELTA_DIAGONAL_ROD_2
3101
-                       - sq(DELTA_TOWER2_X-cartesian[X_AXIS])
3102
-                       - sq(DELTA_TOWER2_Y-cartesian[Y_AXIS])
3137
+  delta[Y_AXIS] = sqrt(delta_diagonal_rod_2
3138
+                       - sq(delta_tower2_x-cartesian[X_AXIS])
3139
+                       - sq(delta_tower2_y-cartesian[Y_AXIS])
3103
                        ) + cartesian[Z_AXIS];
3140
                        ) + cartesian[Z_AXIS];
3104
-  delta[Z_AXIS] = sqrt(DELTA_DIAGONAL_ROD_2
3105
-                       - sq(DELTA_TOWER3_X-cartesian[X_AXIS])
3106
-                       - sq(DELTA_TOWER3_Y-cartesian[Y_AXIS])
3141
+  delta[Z_AXIS] = sqrt(delta_diagonal_rod_2
3142
+                       - sq(delta_tower3_x-cartesian[X_AXIS])
3143
+                       - sq(delta_tower3_y-cartesian[Y_AXIS])
3107
                        ) + cartesian[Z_AXIS];
3144
                        ) + cartesian[Z_AXIS];
3108
   /*
3145
   /*
3109
   SERIAL_ECHOPGM("cartesian x="); SERIAL_ECHO(cartesian[X_AXIS]);
3146
   SERIAL_ECHOPGM("cartesian x="); SERIAL_ECHO(cartesian[X_AXIS]);
3133
   if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); }
3170
   if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); }
3134
   if (cartesian_mm < 0.000001) { return; }
3171
   if (cartesian_mm < 0.000001) { return; }
3135
   float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
3172
   float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
3136
-  int steps = max(1, int(DELTA_SEGMENTS_PER_SECOND * seconds));
3173
+  int steps = max(1, int(delta_segments_per_second * seconds));
3137
   // SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
3174
   // SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
3138
   // SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
3175
   // SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
3139
   // SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps);
3176
   // SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps);

+ 5
- 4
Marlin/createTemperatureLookupMarlin.py Vedi 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 Vedi 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 Vedi 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…
Annulla
Salva