|
@@ -465,7 +465,6 @@ static uint8_t target_extruder;
|
465
|
465
|
#define COS_60 0.5
|
466
|
466
|
|
467
|
467
|
float delta[ABC],
|
468
|
|
- cartes[XYZ] = { 0 },
|
469
|
468
|
endstop_adj[ABC] = { 0 };
|
470
|
469
|
|
471
|
470
|
// these are the default values, can be overriden with M665
|
|
@@ -487,7 +486,6 @@ static uint8_t target_extruder;
|
487
|
486
|
delta_clip_start_height = Z_MAX_POS;
|
488
|
487
|
|
489
|
488
|
float delta_safe_distance_from_top();
|
490
|
|
- void get_cartesian_from_steppers();
|
491
|
489
|
|
492
|
490
|
#else
|
493
|
491
|
|
|
@@ -508,11 +506,11 @@ static uint8_t target_extruder;
|
508
|
506
|
|
509
|
507
|
float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND,
|
510
|
508
|
delta[ABC],
|
511
|
|
- axis_scaling[ABC] = { 1, 1, 1 }, // Build size scaling, default to 1
|
512
|
|
- cartes[XYZ] = { 0 };
|
513
|
|
- void get_cartesian_from_steppers() { } // to be written later
|
|
509
|
+ axis_scaling[ABC] = { 1, 1, 1 }; // Build size scaling, default to 1
|
514
|
510
|
#endif
|
515
|
511
|
|
|
512
|
+float cartes[XYZ] = { 0 };
|
|
513
|
+
|
516
|
514
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
517
|
515
|
bool filament_sensor = false; //M405 turns on filament_sensor control, M406 turns it off
|
518
|
516
|
float filament_width_nominal = DEFAULT_NOMINAL_FILAMENT_DIA, // Nominal filament width. Change with M404
|
|
@@ -598,6 +596,8 @@ void stop();
|
598
|
596
|
void get_available_commands();
|
599
|
597
|
void process_next_command();
|
600
|
598
|
void prepare_move_to_destination();
|
|
599
|
+
|
|
600
|
+void get_cartesian_from_steppers();
|
601
|
601
|
void set_current_from_steppers_for_axis(AxisEnum axis);
|
602
|
602
|
|
603
|
603
|
#if ENABLED(ARC_SUPPORT)
|
|
@@ -1347,7 +1347,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
1347
|
1347
|
}
|
1348
|
1348
|
#endif
|
1349
|
1349
|
|
1350
|
|
- #if ENABLED(SCARA)
|
|
1350
|
+ #if ENABLED(MORGAN_SCARA)
|
1351
|
1351
|
|
1352
|
1352
|
if (axis == X_AXIS || axis == Y_AXIS) {
|
1353
|
1353
|
|
|
@@ -1362,19 +1362,19 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
1362
|
1362
|
* and calculates homing offset using forward kinematics
|
1363
|
1363
|
*/
|
1364
|
1364
|
inverse_kinematics(homeposition);
|
1365
|
|
- forward_kinematics_SCARA(delta);
|
|
1365
|
+ forward_kinematics_SCARA(delta[A_AXIS], delta[B_AXIS]);
|
1366
|
1366
|
|
1367
|
|
- // SERIAL_ECHOPAIR("Delta X=", delta[X_AXIS]);
|
1368
|
|
- // SERIAL_ECHOPGM(" Delta Y="); SERIAL_ECHOLN(delta[Y_AXIS]);
|
|
1367
|
+ // SERIAL_ECHOPAIR("Delta X=", cartes[X_AXIS]);
|
|
1368
|
+ // SERIAL_ECHOPGM(" Delta Y="); SERIAL_ECHOLN(cartes[Y_AXIS]);
|
1369
|
1369
|
|
1370
|
|
- current_position[axis] = LOGICAL_POSITION(delta[axis], axis);
|
|
1370
|
+ current_position[axis] = LOGICAL_POSITION(cartes[axis], axis);
|
1371
|
1371
|
|
1372
|
1372
|
/**
|
1373
|
1373
|
* SCARA home positions are based on configuration since the actual
|
1374
|
1374
|
* limits are determined by the inverse kinematic transform.
|
1375
|
1375
|
*/
|
1376
|
|
- soft_endstop_min[axis] = base_min_pos(axis); // + (delta[axis] - base_home_pos(axis));
|
1377
|
|
- soft_endstop_max[axis] = base_max_pos(axis); // + (delta[axis] - base_home_pos(axis));
|
|
1376
|
+ soft_endstop_min[axis] = base_min_pos(axis); // + (cartes[axis] - base_home_pos(axis));
|
|
1377
|
+ soft_endstop_max[axis] = base_max_pos(axis); // + (cartes[axis] - base_home_pos(axis));
|
1378
|
1378
|
}
|
1379
|
1379
|
else
|
1380
|
1380
|
#endif
|
|
@@ -5089,7 +5089,7 @@ static void report_current_position() {
|
5089
|
5089
|
|
5090
|
5090
|
stepper.report_positions();
|
5091
|
5091
|
|
5092
|
|
- #if ENABLED(SCARA)
|
|
5092
|
+ #if IS_SCARA
|
5093
|
5093
|
SERIAL_PROTOCOLPGM("SCARA Theta:");
|
5094
|
5094
|
SERIAL_PROTOCOL(delta[X_AXIS]);
|
5095
|
5095
|
SERIAL_PROTOCOLPGM(" Psi+Theta:");
|
|
@@ -5327,7 +5327,7 @@ inline void gcode_M206() {
|
5327
|
5327
|
if (code_seen(axis_codes[i]))
|
5328
|
5328
|
set_home_offset((AxisEnum)i, code_value_axis_units(i));
|
5329
|
5329
|
|
5330
|
|
- #if ENABLED(SCARA)
|
|
5330
|
+ #if IS_SCARA
|
5331
|
5331
|
if (code_seen('T')) set_home_offset(X_AXIS, code_value_axis_units(X_AXIS)); // Theta
|
5332
|
5332
|
if (code_seen('P')) set_home_offset(Y_AXIS, code_value_axis_units(Y_AXIS)); // Psi
|
5333
|
5333
|
#endif
|
|
@@ -5808,17 +5808,16 @@ inline void gcode_M303() {
|
5808
|
5808
|
#endif
|
5809
|
5809
|
}
|
5810
|
5810
|
|
5811
|
|
-#if ENABLED(SCARA)
|
5812
|
|
- bool SCARA_move_to_cal(uint8_t delta_x, uint8_t delta_y) {
|
|
5811
|
+#if ENABLED(MORGAN_SCARA)
|
|
5812
|
+ bool SCARA_move_to_cal(uint8_t delta_a, uint8_t delta_b) {
|
5813
|
5813
|
//SoftEndsEnabled = false; // Ignore soft endstops during calibration
|
5814
|
5814
|
//SERIAL_ECHOLNPGM(" Soft endstops disabled");
|
5815
|
5815
|
if (IsRunning()) {
|
5816
|
5816
|
//gcode_get_destination(); // For X Y Z E F
|
5817
|
|
- delta[X_AXIS] = delta_x;
|
5818
|
|
- delta[Y_AXIS] = delta_y;
|
5819
|
|
- forward_kinematics_SCARA(delta);
|
5820
|
|
- destination[X_AXIS] = delta[X_AXIS] / axis_scaling[X_AXIS];
|
5821
|
|
- destination[Y_AXIS] = delta[Y_AXIS] / axis_scaling[Y_AXIS];
|
|
5817
|
+ forward_kinematics_SCARA(delta_a, delta_b);
|
|
5818
|
+ destination[X_AXIS] = cartes[X_AXIS] / axis_scaling[X_AXIS];
|
|
5819
|
+ destination[Y_AXIS] = cartes[Y_AXIS] / axis_scaling[Y_AXIS];
|
|
5820
|
+ destination[Z_AXIS] = current_position[Z_AXIS];
|
5822
|
5821
|
prepare_move_to_destination();
|
5823
|
5822
|
//ok_to_send();
|
5824
|
5823
|
return true;
|
|
@@ -7456,7 +7455,7 @@ void process_next_command() {
|
7456
|
7455
|
gcode_M303();
|
7457
|
7456
|
break;
|
7458
|
7457
|
|
7459
|
|
- #if ENABLED(SCARA)
|
|
7458
|
+ #if ENABLED(MORGAN_SCARA)
|
7460
|
7459
|
case 360: // M360 SCARA Theta pos1
|
7461
|
7460
|
if (gcode_M360()) return;
|
7462
|
7461
|
break;
|
|
@@ -7794,12 +7793,6 @@ void ok_to_send() {
|
7794
|
7793
|
forward_kinematics_DELTA(point[A_AXIS], point[B_AXIS], point[C_AXIS]);
|
7795
|
7794
|
}
|
7796
|
7795
|
|
7797
|
|
- void get_cartesian_from_steppers() {
|
7798
|
|
- forward_kinematics_DELTA(stepper.get_axis_position_mm(A_AXIS),
|
7799
|
|
- stepper.get_axis_position_mm(B_AXIS),
|
7800
|
|
- stepper.get_axis_position_mm(C_AXIS));
|
7801
|
|
- }
|
7802
|
|
-
|
7803
|
7796
|
#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
|
7804
|
7797
|
|
7805
|
7798
|
// Adjust print surface height by linear interpolation over the bed_level array.
|
|
@@ -8274,32 +8267,32 @@ void prepare_move_to_destination() {
|
8274
|
8267
|
|
8275
|
8268
|
#endif // HAS_CONTROLLERFAN
|
8276
|
8269
|
|
8277
|
|
-#if ENABLED(SCARA)
|
|
8270
|
+#if IS_SCARA
|
8278
|
8271
|
|
8279
|
|
- void forward_kinematics_SCARA(float f_scara[ABC]) {
|
8280
|
|
- // Perform forward kinematics, and place results in delta[]
|
|
8272
|
+ void forward_kinematics_SCARA(const float &a, const float &b) {
|
|
8273
|
+ // Perform forward kinematics, and place results in cartes[]
|
8281
|
8274
|
// The maths and first version has been done by QHARLEY . Integrated into masterbranch 06/2014 and slightly restructured by Joachim Cerny in June 2014
|
8282
|
8275
|
|
8283
|
|
- float x_sin, x_cos, y_sin, y_cos;
|
|
8276
|
+ float a_sin, a_cos, b_sin, b_cos;
|
8284
|
8277
|
|
8285
|
|
- //SERIAL_ECHOPGM("f_delta x="); SERIAL_ECHO(f_scara[X_AXIS]);
|
8286
|
|
- //SERIAL_ECHOPGM(" y="); SERIAL_ECHO(f_scara[Y_AXIS]);
|
|
8278
|
+ //SERIAL_ECHOPGM("f_delta x="); SERIAL_ECHO(a);
|
|
8279
|
+ //SERIAL_ECHOPGM(" y="); SERIAL_ECHO(b);
|
8287
|
8280
|
|
8288
|
|
- x_sin = sin(RADIANS(f_scara[X_AXIS])) * L1;
|
8289
|
|
- x_cos = cos(RADIANS(f_scara[X_AXIS])) * L1;
|
8290
|
|
- y_sin = sin(RADIANS(f_scara[Y_AXIS])) * L2;
|
8291
|
|
- y_cos = cos(RADIANS(f_scara[Y_AXIS])) * L2;
|
|
8281
|
+ a_sin = sin(RADIANS(a)) * L1;
|
|
8282
|
+ a_cos = cos(RADIANS(a)) * L1;
|
|
8283
|
+ b_sin = sin(RADIANS(b)) * L2;
|
|
8284
|
+ b_cos = cos(RADIANS(b)) * L2;
|
8292
|
8285
|
|
8293
|
|
- //SERIAL_ECHOPGM(" x_sin="); SERIAL_ECHO(x_sin);
|
8294
|
|
- //SERIAL_ECHOPGM(" x_cos="); SERIAL_ECHO(x_cos);
|
8295
|
|
- //SERIAL_ECHOPGM(" y_sin="); SERIAL_ECHO(y_sin);
|
8296
|
|
- //SERIAL_ECHOPGM(" y_cos="); SERIAL_ECHOLN(y_cos);
|
|
8286
|
+ //SERIAL_ECHOPGM(" a_sin="); SERIAL_ECHO(a_sin);
|
|
8287
|
+ //SERIAL_ECHOPGM(" a_cos="); SERIAL_ECHO(a_cos);
|
|
8288
|
+ //SERIAL_ECHOPGM(" b_sin="); SERIAL_ECHO(b_sin);
|
|
8289
|
+ //SERIAL_ECHOPGM(" b_cos="); SERIAL_ECHOLN(b_cos);
|
8297
|
8290
|
|
8298
|
|
- delta[X_AXIS] = x_cos + y_cos + SCARA_OFFSET_X; //theta
|
8299
|
|
- delta[Y_AXIS] = x_sin + y_sin + SCARA_OFFSET_Y; //theta+phi
|
|
8291
|
+ cartes[X_AXIS] = a_cos + b_cos + SCARA_OFFSET_X; //theta
|
|
8292
|
+ cartes[Y_AXIS] = a_sin + b_sin + SCARA_OFFSET_Y; //theta+phi
|
8300
|
8293
|
|
8301
|
|
- //SERIAL_ECHOPGM(" delta[X_AXIS]="); SERIAL_ECHO(delta[X_AXIS]);
|
8302
|
|
- //SERIAL_ECHOPGM(" delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]);
|
|
8294
|
+ //SERIAL_ECHOPGM(" cartes[X_AXIS]="); SERIAL_ECHO(cartes[X_AXIS]);
|
|
8295
|
+ //SERIAL_ECHOPGM(" cartes[Y_AXIS]="); SERIAL_ECHOLN(cartes[Y_AXIS]);
|
8303
|
8296
|
}
|
8304
|
8297
|
|
8305
|
8298
|
void inverse_kinematics(const float cartesian[XYZ]) {
|
|
@@ -8343,7 +8336,27 @@ void prepare_move_to_destination() {
|
8343
|
8336
|
//*/
|
8344
|
8337
|
}
|
8345
|
8338
|
|
8346
|
|
-#endif // MORGAN_SCARA
|
|
8339
|
+#endif // IS_SCARA
|
|
8340
|
+
|
|
8341
|
+void get_cartesian_from_steppers() {
|
|
8342
|
+ #if ENABLED(DELTA)
|
|
8343
|
+ forward_kinematics_DELTA(
|
|
8344
|
+ stepper.get_axis_position_mm(A_AXIS),
|
|
8345
|
+ stepper.get_axis_position_mm(B_AXIS),
|
|
8346
|
+ stepper.get_axis_position_mm(C_AXIS)
|
|
8347
|
+ );
|
|
8348
|
+ #elif IS_SCARA
|
|
8349
|
+ forward_kinematics_SCARA(
|
|
8350
|
+ stepper.get_axis_position_degrees(A_AXIS),
|
|
8351
|
+ stepper.get_axis_position_degrees(B_AXIS)
|
|
8352
|
+ );
|
|
8353
|
+ cartes[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
|
|
8354
|
+ #else
|
|
8355
|
+ cartes[X_AXIS] = stepper.get_axis_position_mm(X_AXIS);
|
|
8356
|
+ cartes[Y_AXIS] = stepper.get_axis_position_mm(Y_AXIS);
|
|
8357
|
+ cartes[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
|
|
8358
|
+ #endif
|
|
8359
|
+}
|
8347
|
8360
|
|
8348
|
8361
|
#if ENABLED(TEMP_STAT_LEDS)
|
8349
|
8362
|
|