|
@@ -179,10 +179,10 @@ static float std_dev_points(float z_pt[NPP + 1], const bool _0p_cal, const bool
|
179
|
179
|
S2 += sq(z_pt[rad]);
|
180
|
180
|
N++;
|
181
|
181
|
}
|
182
|
|
- return LROUND(SQRT(S2 / N) * 1000.0) / 1000.0 + 0.00001;
|
|
182
|
+ return LROUND(SQRT(S2 / N) * 1000.0f) / 1000.0f + 0.00001f;
|
183
|
183
|
}
|
184
|
184
|
}
|
185
|
|
- return 0.00001;
|
|
185
|
+ return 0.00001f;
|
186
|
186
|
}
|
187
|
187
|
|
188
|
188
|
/**
|
|
@@ -218,7 +218,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
|
218
|
218
|
_7p_6_center = probe_points >= 5 && probe_points <= 7,
|
219
|
219
|
_7p_9_center = probe_points >= 8;
|
220
|
220
|
|
221
|
|
- LOOP_CAL_ALL(rad) z_pt[rad] = 0.0;
|
|
221
|
+ LOOP_CAL_ALL(rad) z_pt[rad] = 0.0f;
|
222
|
222
|
|
223
|
223
|
if (!_0p_calibration) {
|
224
|
224
|
|
|
@@ -228,8 +228,8 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
|
228
|
228
|
}
|
229
|
229
|
|
230
|
230
|
if (_7p_calibration) { // probe extra center points
|
231
|
|
- const float start = _7p_9_center ? float(_CA) + _7P_STEP / 3.0 : _7p_6_center ? float(_CA) : float(__C),
|
232
|
|
- steps = _7p_9_center ? _4P_STEP / 3.0 : _7p_6_center ? _7P_STEP : _4P_STEP;
|
|
231
|
+ const float start = _7p_9_center ? float(_CA) + _7P_STEP / 3.0f : _7p_6_center ? float(_CA) : float(__C),
|
|
232
|
+ steps = _7p_9_center ? _4P_STEP / 3.0f : _7p_6_center ? _7P_STEP : _4P_STEP;
|
233
|
233
|
I_LOOP_CAL_PT(rad, start, steps) {
|
234
|
234
|
const float a = RADIANS(210 + (360 / NPP) * (rad - 1)),
|
235
|
235
|
r = delta_calibration_radius * 0.1;
|
|
@@ -241,13 +241,13 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
|
241
|
241
|
|
242
|
242
|
if (!_1p_calibration) { // probe the radius
|
243
|
243
|
const CalEnum start = _4p_opposite_points ? _AB : __A;
|
244
|
|
- const float steps = _7p_14_intermediates ? _7P_STEP / 15.0 : // 15r * 6 + 10c = 100
|
245
|
|
- _7p_11_intermediates ? _7P_STEP / 12.0 : // 12r * 6 + 9c = 81
|
246
|
|
- _7p_8_intermediates ? _7P_STEP / 9.0 : // 9r * 6 + 10c = 64
|
247
|
|
- _7p_6_intermediates ? _7P_STEP / 7.0 : // 7r * 6 + 7c = 49
|
248
|
|
- _7p_4_intermediates ? _7P_STEP / 5.0 : // 5r * 6 + 6c = 36
|
249
|
|
- _7p_2_intermediates ? _7P_STEP / 3.0 : // 3r * 6 + 7c = 25
|
250
|
|
- _7p_1_intermediates ? _7P_STEP / 2.0 : // 2r * 6 + 4c = 16
|
|
244
|
+ const float steps = _7p_14_intermediates ? _7P_STEP / 15.0f : // 15r * 6 + 10c = 100
|
|
245
|
+ _7p_11_intermediates ? _7P_STEP / 12.0f : // 12r * 6 + 9c = 81
|
|
246
|
+ _7p_8_intermediates ? _7P_STEP / 9.0f : // 9r * 6 + 10c = 64
|
|
247
|
+ _7p_6_intermediates ? _7P_STEP / 7.0f : // 7r * 6 + 7c = 49
|
|
248
|
+ _7p_4_intermediates ? _7P_STEP / 5.0f : // 5r * 6 + 6c = 36
|
|
249
|
+ _7p_2_intermediates ? _7P_STEP / 3.0f : // 3r * 6 + 7c = 25
|
|
250
|
+ _7p_1_intermediates ? _7P_STEP / 2.0f : // 2r * 6 + 4c = 16
|
251
|
251
|
_7p_no_intermediates ? _7P_STEP : // 1r * 6 + 3c = 9
|
252
|
252
|
_4P_STEP; // .5r * 6 + 1c = 4
|
253
|
253
|
bool zig_zag = true;
|
|
@@ -269,7 +269,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
|
269
|
269
|
LOOP_CAL_RAD(rad)
|
270
|
270
|
z_pt[rad] /= _7P_STEP / steps;
|
271
|
271
|
|
272
|
|
- do_blocking_move_to_xy(0.0, 0.0);
|
|
272
|
+ do_blocking_move_to_xy(0.0f, 0.0f);
|
273
|
273
|
}
|
274
|
274
|
}
|
275
|
275
|
return true;
|
|
@@ -286,7 +286,7 @@ static void reverse_kinematics_probe_points(float z_pt[NPP + 1], float mm_at_pt_
|
286
|
286
|
|
287
|
287
|
LOOP_CAL_ALL(rad) {
|
288
|
288
|
const float a = RADIANS(210 + (360 / NPP) * (rad - 1)),
|
289
|
|
- r = (rad == CEN ? 0.0 : delta_calibration_radius);
|
|
289
|
+ r = (rad == CEN ? 0.0f : delta_calibration_radius);
|
290
|
290
|
pos[X_AXIS] = cos(a) * r;
|
291
|
291
|
pos[Y_AXIS] = sin(a) * r;
|
292
|
292
|
pos[Z_AXIS] = z_pt[rad];
|
|
@@ -298,7 +298,7 @@ static void reverse_kinematics_probe_points(float z_pt[NPP + 1], float mm_at_pt_
|
298
|
298
|
static void forward_kinematics_probe_points(float mm_at_pt_axis[NPP + 1][ABC], float z_pt[NPP + 1]) {
|
299
|
299
|
const float r_quot = delta_calibration_radius / delta_radius;
|
300
|
300
|
|
301
|
|
- #define ZPP(N,I,A) ((1 / 3.0 + r_quot * (N) / 3.0 ) * mm_at_pt_axis[I][A])
|
|
301
|
+ #define ZPP(N,I,A) ((1 / 3.0f + r_quot * (N) / 3.0f ) * mm_at_pt_axis[I][A])
|
302
|
302
|
#define Z00(I, A) ZPP( 0, I, A)
|
303
|
303
|
#define Zp1(I, A) ZPP(+1, I, A)
|
304
|
304
|
#define Zm1(I, A) ZPP(-1, I, A)
|
|
@@ -339,45 +339,45 @@ static void calc_kinematics_diff_probe_points(float z_pt[NPP + 1], float delta_e
|
339
|
339
|
|
340
|
340
|
static float auto_tune_h() {
|
341
|
341
|
const float r_quot = delta_calibration_radius / delta_radius;
|
342
|
|
- float h_fac = 0.0;
|
|
342
|
+ float h_fac = 0.0f;
|
343
|
343
|
|
344
|
|
- h_fac = r_quot / (2.0 / 3.0);
|
|
344
|
+ h_fac = r_quot / (2.0f / 3.0f);
|
345
|
345
|
h_fac = 1.0f / h_fac; // (2/3)/CR
|
346
|
346
|
return h_fac;
|
347
|
347
|
}
|
348
|
348
|
|
349
|
349
|
static float auto_tune_r() {
|
350
|
|
- const float diff = 0.01;
|
351
|
|
- float r_fac = 0.0,
|
352
|
|
- z_pt[NPP + 1] = { 0.0 },
|
353
|
|
- delta_e[ABC] = {0.0},
|
354
|
|
- delta_r = {0.0},
|
355
|
|
- delta_t[ABC] = {0.0};
|
|
350
|
+ const float diff = 0.01f;
|
|
351
|
+ float r_fac = 0.0f,
|
|
352
|
+ z_pt[NPP + 1] = { 0.0f },
|
|
353
|
+ delta_e[ABC] = { 0.0f },
|
|
354
|
+ delta_r = { 0.0f },
|
|
355
|
+ delta_t[ABC] = { 0.0f };
|
356
|
356
|
|
357
|
357
|
delta_r = diff;
|
358
|
358
|
calc_kinematics_diff_probe_points(z_pt, delta_e, delta_r, delta_t);
|
359
|
|
- r_fac = -(z_pt[__A] + z_pt[__B] + z_pt[__C] + z_pt[_BC] + z_pt[_CA] + z_pt[_AB]) / 6.0;
|
360
|
|
- r_fac = diff / r_fac / 3.0; // 1/(3*delta_Z)
|
|
359
|
+ r_fac = -(z_pt[__A] + z_pt[__B] + z_pt[__C] + z_pt[_BC] + z_pt[_CA] + z_pt[_AB]) / 6.0f;
|
|
360
|
+ r_fac = diff / r_fac / 3.0f; // 1/(3*delta_Z)
|
361
|
361
|
return r_fac;
|
362
|
362
|
}
|
363
|
363
|
|
364
|
364
|
static float auto_tune_a() {
|
365
|
|
- const float diff = 0.01;
|
366
|
|
- float a_fac = 0.0,
|
367
|
|
- z_pt[NPP + 1] = { 0.0 },
|
368
|
|
- delta_e[ABC] = {0.0},
|
369
|
|
- delta_r = {0.0},
|
370
|
|
- delta_t[ABC] = {0.0};
|
|
365
|
+ const float diff = 0.01f;
|
|
366
|
+ float a_fac = 0.0f,
|
|
367
|
+ z_pt[NPP + 1] = { 0.0f },
|
|
368
|
+ delta_e[ABC] = { 0.0f },
|
|
369
|
+ delta_r = { 0.0f },
|
|
370
|
+ delta_t[ABC] = { 0.0f };
|
371
|
371
|
|
372
|
372
|
ZERO(delta_t);
|
373
|
373
|
LOOP_XYZ(axis) {
|
374
|
374
|
delta_t[axis] = diff;
|
375
|
375
|
calc_kinematics_diff_probe_points(z_pt, delta_e, delta_r, delta_t);
|
376
|
376
|
delta_t[axis] = 0;
|
377
|
|
- a_fac += z_pt[uint8_t((axis * _4P_STEP) - _7P_STEP + NPP) % NPP + 1] / 6.0;
|
378
|
|
- a_fac -= z_pt[uint8_t((axis * _4P_STEP) + 1 + _7P_STEP)] / 6.0;
|
|
377
|
+ a_fac += z_pt[uint8_t((axis * _4P_STEP) - _7P_STEP + NPP) % NPP + 1] / 6.0f;
|
|
378
|
+ a_fac -= z_pt[uint8_t((axis * _4P_STEP) + 1 + _7P_STEP)] / 6.0f;
|
379
|
379
|
}
|
380
|
|
- a_fac = diff / a_fac / 3.0; // 1/(3*delta_Z)
|
|
380
|
+ a_fac = diff / a_fac / 3.0f; // 1/(3*delta_Z)
|
381
|
381
|
return a_fac;
|
382
|
382
|
}
|
383
|
383
|
|
|
@@ -418,7 +418,7 @@ void GcodeSuite::G33() {
|
418
|
418
|
|
419
|
419
|
const bool towers_set = !parser.seen('T');
|
420
|
420
|
|
421
|
|
- const float calibration_precision = parser.floatval('C', 0.0);
|
|
421
|
+ const float calibration_precision = parser.floatval('C', 0.0f);
|
422
|
422
|
if (calibration_precision < 0) {
|
423
|
423
|
SERIAL_ECHOLNPGM("?(C)alibration precision implausible (>=0).");
|
424
|
424
|
return;
|
|
@@ -450,7 +450,7 @@ void GcodeSuite::G33() {
|
450
|
450
|
static const char save_message[] PROGMEM = "Save with M500 and/or copy to Configuration.h";
|
451
|
451
|
int8_t iterations = 0;
|
452
|
452
|
float test_precision,
|
453
|
|
- zero_std_dev = (verbose_level ? 999.0 : 0.0), // 0.0 in dry-run mode : forced end
|
|
453
|
+ zero_std_dev = (verbose_level ? 999.0f : 0.0f), // 0.0 in dry-run mode : forced end
|
454
|
454
|
zero_std_dev_min = zero_std_dev,
|
455
|
455
|
zero_std_dev_old = zero_std_dev,
|
456
|
456
|
h_factor,
|
|
@@ -497,9 +497,9 @@ void GcodeSuite::G33() {
|
497
|
497
|
|
498
|
498
|
do { // start iterations
|
499
|
499
|
|
500
|
|
- float z_at_pt[NPP + 1] = { 0.0 };
|
|
500
|
+ float z_at_pt[NPP + 1] = { 0.0f };
|
501
|
501
|
|
502
|
|
- test_precision = zero_std_dev_old != 999.0 ? (zero_std_dev + zero_std_dev_old) / 2 : zero_std_dev;
|
|
502
|
+ test_precision = zero_std_dev_old != 999.0f ? (zero_std_dev + zero_std_dev_old) / 2.0f : zero_std_dev;
|
503
|
503
|
iterations++;
|
504
|
504
|
|
505
|
505
|
// Probe the points
|
|
@@ -515,7 +515,7 @@ void GcodeSuite::G33() {
|
515
|
515
|
if ((zero_std_dev < test_precision || iterations <= force_iterations) && zero_std_dev > calibration_precision) {
|
516
|
516
|
|
517
|
517
|
#if !HAS_BED_PROBE
|
518
|
|
- test_precision = 0.00; // forced end
|
|
518
|
+ test_precision = 0.0f; // forced end
|
519
|
519
|
#endif
|
520
|
520
|
|
521
|
521
|
if (zero_std_dev < zero_std_dev_min) {
|
|
@@ -526,9 +526,9 @@ void GcodeSuite::G33() {
|
526
|
526
|
COPY(a_old, delta_tower_angle_trim);
|
527
|
527
|
}
|
528
|
528
|
|
529
|
|
- float e_delta[ABC] = { 0.0 },
|
530
|
|
- r_delta = 0.0,
|
531
|
|
- t_delta[ABC] = { 0.0 };
|
|
529
|
+ float e_delta[ABC] = { 0.0f },
|
|
530
|
+ r_delta = 0.0f,
|
|
531
|
+ t_delta[ABC] = { 0.0f };
|
532
|
532
|
|
533
|
533
|
/**
|
534
|
534
|
* convergence matrices:
|
|
@@ -536,7 +536,7 @@ void GcodeSuite::G33() {
|
536
|
536
|
* - definition of the matrix scaling parameters
|
537
|
537
|
* - matrices for 4 and 7 point calibration
|
538
|
538
|
*/
|
539
|
|
- #define ZP(N,I) ((N) * z_at_pt[I] / 4.0) // 4.0 = divider to normalize to integers
|
|
539
|
+ #define ZP(N,I) ((N) * z_at_pt[I] / 4.0f) // 4.0 = divider to normalize to integers
|
540
|
540
|
#define Z12(I) ZP(12, I)
|
541
|
541
|
#define Z4(I) ZP(4, I)
|
542
|
542
|
#define Z2(I) ZP(2, I)
|
|
@@ -545,7 +545,7 @@ void GcodeSuite::G33() {
|
545
|
545
|
|
546
|
546
|
// calculate factors
|
547
|
547
|
const float cr_old = delta_calibration_radius;
|
548
|
|
- if (_7p_9_center) delta_calibration_radius *= 0.9;
|
|
548
|
+ if (_7p_9_center) delta_calibration_radius *= 0.9f;
|
549
|
549
|
h_factor = auto_tune_h();
|
550
|
550
|
r_factor = auto_tune_r();
|
551
|
551
|
a_factor = auto_tune_a();
|
|
@@ -553,11 +553,11 @@ void GcodeSuite::G33() {
|
553
|
553
|
|
554
|
554
|
switch (probe_points) {
|
555
|
555
|
case 0:
|
556
|
|
- test_precision = 0.00; // forced end
|
|
556
|
+ test_precision = 0.0f; // forced end
|
557
|
557
|
break;
|
558
|
558
|
|
559
|
559
|
case 1:
|
560
|
|
- test_precision = 0.00; // forced end
|
|
560
|
+ test_precision = 0.0f; // forced end
|
561
|
561
|
LOOP_XYZ(axis) e_delta[axis] = +Z4(CEN);
|
562
|
562
|
break;
|
563
|
563
|
|
|
@@ -605,9 +605,9 @@ void GcodeSuite::G33() {
|
605
|
605
|
|
606
|
606
|
// Normalize angles to least-squares
|
607
|
607
|
if (_angle_results) {
|
608
|
|
- float a_sum = 0.0;
|
|
608
|
+ float a_sum = 0.0f;
|
609
|
609
|
LOOP_XYZ(axis) a_sum += delta_tower_angle_trim[axis];
|
610
|
|
- LOOP_XYZ(axis) delta_tower_angle_trim[axis] -= a_sum / 3.0;
|
|
610
|
+ LOOP_XYZ(axis) delta_tower_angle_trim[axis] -= a_sum / 3.0f;
|
611
|
611
|
}
|
612
|
612
|
|
613
|
613
|
// adjust delta_height and endstops by the max amount
|
|
@@ -639,7 +639,7 @@ void GcodeSuite::G33() {
|
639
|
639
|
char mess[21];
|
640
|
640
|
strcpy_P(mess, PSTR("Calibration sd:"));
|
641
|
641
|
if (zero_std_dev_min < 1)
|
642
|
|
- sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev_min * 1000.0));
|
|
642
|
+ sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev_min * 1000.0f));
|
643
|
643
|
else
|
644
|
644
|
sprintf_P(&mess[15], PSTR("%03i.x"), (int)LROUND(zero_std_dev_min));
|
645
|
645
|
ui.set_status(mess);
|
|
@@ -671,7 +671,7 @@ void GcodeSuite::G33() {
|
671
|
671
|
strcpy_P(mess, enddryrun);
|
672
|
672
|
strcpy_P(&mess[11], PSTR(" sd:"));
|
673
|
673
|
if (zero_std_dev < 1)
|
674
|
|
- sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev * 1000.0));
|
|
674
|
+ sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev * 1000.0f));
|
675
|
675
|
else
|
676
|
676
|
sprintf_P(&mess[15], PSTR("%03i.x"), (int)LROUND(zero_std_dev));
|
677
|
677
|
ui.set_status(mess);
|