|
@@ -351,20 +351,31 @@ bool target_direction;
|
351
|
351
|
#endif
|
352
|
352
|
|
353
|
353
|
#if ENABLED(DELTA)
|
|
354
|
+
|
|
355
|
+ #define TOWER_1 X_AXIS
|
|
356
|
+ #define TOWER_2 Y_AXIS
|
|
357
|
+ #define TOWER_3 Z_AXIS
|
|
358
|
+
|
354
|
359
|
float delta[3] = { 0 };
|
355
|
360
|
#define SIN_60 0.8660254037844386
|
356
|
361
|
#define COS_60 0.5
|
357
|
362
|
float endstop_adj[3] = { 0 };
|
358
|
363
|
// these are the default values, can be overriden with M665
|
359
|
364
|
float delta_radius = DELTA_RADIUS;
|
360
|
|
- float delta_tower1_x = -SIN_60 * delta_radius; // front left tower
|
361
|
|
- float delta_tower1_y = -COS_60 * delta_radius;
|
362
|
|
- float delta_tower2_x = SIN_60 * delta_radius; // front right tower
|
363
|
|
- float delta_tower2_y = -COS_60 * delta_radius;
|
364
|
|
- float delta_tower3_x = 0; // back middle tower
|
365
|
|
- float delta_tower3_y = delta_radius;
|
|
365
|
+ float delta_tower1_x = -SIN_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1); // front left tower
|
|
366
|
+ float delta_tower1_y = -COS_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1);
|
|
367
|
+ float delta_tower2_x = SIN_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_2); // front right tower
|
|
368
|
+ float delta_tower2_y = -COS_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_2);
|
|
369
|
+ float delta_tower3_x = 0; // back middle tower
|
|
370
|
+ float delta_tower3_y = (delta_radius + DELTA_RADIUS_TRIM_TOWER_3);
|
366
|
371
|
float delta_diagonal_rod = DELTA_DIAGONAL_ROD;
|
367
|
|
- float delta_diagonal_rod_2 = sq(delta_diagonal_rod);
|
|
372
|
+ float delta_diagonal_rod_trim_tower_1 = DELTA_DIAGONAL_ROD_TRIM_TOWER_1;
|
|
373
|
+ float delta_diagonal_rod_trim_tower_2 = DELTA_DIAGONAL_ROD_TRIM_TOWER_2;
|
|
374
|
+ float delta_diagonal_rod_trim_tower_3 = DELTA_DIAGONAL_ROD_TRIM_TOWER_3;
|
|
375
|
+ float delta_diagonal_rod_2_tower_1 = sq(delta_diagonal_rod + delta_diagonal_rod_trim_tower_1);
|
|
376
|
+ float delta_diagonal_rod_2_tower_2 = sq(delta_diagonal_rod + delta_diagonal_rod_trim_tower_2);
|
|
377
|
+ float delta_diagonal_rod_2_tower_3 = sq(delta_diagonal_rod + delta_diagonal_rod_trim_tower_3);
|
|
378
|
+ //float delta_diagonal_rod_2 = sq(delta_diagonal_rod);
|
368
|
379
|
float delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
|
369
|
380
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
370
|
381
|
int delta_grid_spacing[2] = { 0, 0 };
|
|
@@ -4491,11 +4502,17 @@ inline void gcode_M206() {
|
4491
|
4502
|
* L = diagonal rod
|
4492
|
4503
|
* R = delta radius
|
4493
|
4504
|
* S = segments per second
|
|
4505
|
+ * A = Alpha (Tower 1) diagonal rod trim
|
|
4506
|
+ * B = Beta (Tower 2) diagonal rod trim
|
|
4507
|
+ * C = Gamma (Tower 3) diagonal rod trim
|
4494
|
4508
|
*/
|
4495
|
4509
|
inline void gcode_M665() {
|
4496
|
4510
|
if (code_seen('L')) delta_diagonal_rod = code_value();
|
4497
|
4511
|
if (code_seen('R')) delta_radius = code_value();
|
4498
|
4512
|
if (code_seen('S')) delta_segments_per_second = code_value();
|
|
4513
|
+ if (code_seen('A')) delta_diagonal_rod_trim_tower_1 = code_value();
|
|
4514
|
+ if (code_seen('B')) delta_diagonal_rod_trim_tower_2 = code_value();
|
|
4515
|
+ if (code_seen('C')) delta_diagonal_rod_trim_tower_3 = code_value();
|
4499
|
4516
|
recalc_delta_settings(delta_radius, delta_diagonal_rod);
|
4500
|
4517
|
}
|
4501
|
4518
|
/**
|
|
@@ -6249,25 +6266,28 @@ void clamp_to_software_endstops(float target[3]) {
|
6249
|
6266
|
#if ENABLED(DELTA)
|
6250
|
6267
|
|
6251
|
6268
|
void recalc_delta_settings(float radius, float diagonal_rod) {
|
6252
|
|
- delta_tower1_x = -SIN_60 * radius; // front left tower
|
6253
|
|
- delta_tower1_y = -COS_60 * radius;
|
6254
|
|
- delta_tower2_x = SIN_60 * radius; // front right tower
|
6255
|
|
- delta_tower2_y = -COS_60 * radius;
|
6256
|
|
- delta_tower3_x = 0.0; // back middle tower
|
6257
|
|
- delta_tower3_y = radius;
|
6258
|
|
- delta_diagonal_rod_2 = sq(diagonal_rod);
|
|
6269
|
+ delta_tower1_x = -SIN_60 * (radius + DELTA_RADIUS_TRIM_TOWER_1); // front left tower
|
|
6270
|
+ delta_tower1_y = -COS_60 * (radius + DELTA_RADIUS_TRIM_TOWER_1);
|
|
6271
|
+ delta_tower2_x = SIN_60 * (radius + DELTA_RADIUS_TRIM_TOWER_2); // front right tower
|
|
6272
|
+ delta_tower2_y = -COS_60 * (radius + DELTA_RADIUS_TRIM_TOWER_2);
|
|
6273
|
+ delta_tower3_x = 0.0; // back middle tower
|
|
6274
|
+ delta_tower3_y = (radius + DELTA_RADIUS_TRIM_TOWER_3);
|
|
6275
|
+ delta_diagonal_rod_2_tower_1 = sq(delta_diagonal_rod + delta_diagonal_rod_trim_tower_1);
|
|
6276
|
+ delta_diagonal_rod_2_tower_2 = sq(delta_diagonal_rod + delta_diagonal_rod_trim_tower_2);
|
|
6277
|
+ delta_diagonal_rod_2_tower_3 = sq(delta_diagonal_rod + delta_diagonal_rod_trim_tower_3);
|
6259
|
6278
|
}
|
6260
|
6279
|
|
6261
|
6280
|
void calculate_delta(float cartesian[3]) {
|
6262
|
|
- delta[X_AXIS] = sqrt(delta_diagonal_rod_2
|
|
6281
|
+
|
|
6282
|
+ delta[TOWER_1] = sqrt(delta_diagonal_rod_2_tower_1
|
6263
|
6283
|
- sq(delta_tower1_x-cartesian[X_AXIS])
|
6264
|
6284
|
- sq(delta_tower1_y-cartesian[Y_AXIS])
|
6265
|
6285
|
) + cartesian[Z_AXIS];
|
6266
|
|
- delta[Y_AXIS] = sqrt(delta_diagonal_rod_2
|
|
6286
|
+ delta[TOWER_2] = sqrt(delta_diagonal_rod_2_tower_2
|
6267
|
6287
|
- sq(delta_tower2_x-cartesian[X_AXIS])
|
6268
|
6288
|
- sq(delta_tower2_y-cartesian[Y_AXIS])
|
6269
|
6289
|
) + cartesian[Z_AXIS];
|
6270
|
|
- delta[Z_AXIS] = sqrt(delta_diagonal_rod_2
|
|
6290
|
+ delta[TOWER_3] = sqrt(delta_diagonal_rod_2_tower_3
|
6271
|
6291
|
- sq(delta_tower3_x-cartesian[X_AXIS])
|
6272
|
6292
|
- sq(delta_tower3_y-cartesian[Y_AXIS])
|
6273
|
6293
|
) + cartesian[Z_AXIS];
|
|
@@ -6276,9 +6296,9 @@ void clamp_to_software_endstops(float target[3]) {
|
6276
|
6296
|
SERIAL_ECHOPGM(" y="); SERIAL_ECHO(cartesian[Y_AXIS]);
|
6277
|
6297
|
SERIAL_ECHOPGM(" z="); SERIAL_ECHOLN(cartesian[Z_AXIS]);
|
6278
|
6298
|
|
6279
|
|
- SERIAL_ECHOPGM("delta x="); SERIAL_ECHO(delta[X_AXIS]);
|
6280
|
|
- SERIAL_ECHOPGM(" y="); SERIAL_ECHO(delta[Y_AXIS]);
|
6281
|
|
- SERIAL_ECHOPGM(" z="); SERIAL_ECHOLN(delta[Z_AXIS]);
|
|
6299
|
+ SERIAL_ECHOPGM("delta a="); SERIAL_ECHO(delta[TOWER_1]);
|
|
6300
|
+ SERIAL_ECHOPGM(" b="); SERIAL_ECHO(delta[TOWER_2]);
|
|
6301
|
+ SERIAL_ECHOPGM(" c="); SERIAL_ECHOLN(delta[TOWER_3]);
|
6282
|
6302
|
*/
|
6283
|
6303
|
}
|
6284
|
6304
|
|