|
@@ -3596,7 +3596,7 @@ inline void gcode_G28() {
|
3596
|
3596
|
* so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z
|
3597
|
3597
|
*/
|
3598
|
3598
|
|
3599
|
|
- int abl2 = auto_bed_leveling_grid_points * auto_bed_leveling_grid_points;
|
|
3599
|
+ int abl2 = sq(auto_bed_leveling_grid_points);
|
3600
|
3600
|
|
3601
|
3601
|
double eqnAMatrix[abl2 * 3], // "A" matrix of the linear system of equations
|
3602
|
3602
|
eqnBVector[abl2], // "B" vector of Z points
|
|
@@ -3629,7 +3629,7 @@ inline void gcode_G28() {
|
3629
|
3629
|
|
3630
|
3630
|
#if ENABLED(DELTA)
|
3631
|
3631
|
// Avoid probing the corners (outside the round or hexagon print surface) on a delta printer.
|
3632
|
|
- float distance_from_center = sqrt(xProbe * xProbe + yProbe * yProbe);
|
|
3632
|
+ float distance_from_center = HYPOT(xProbe, yProbe);
|
3633
|
3633
|
if (distance_from_center > DELTA_PROBEABLE_RADIUS) continue;
|
3634
|
3634
|
#endif //DELTA
|
3635
|
3635
|
|
|
@@ -4252,7 +4252,7 @@ inline void gcode_M42() {
|
4252
|
4252
|
return;
|
4253
|
4253
|
}
|
4254
|
4254
|
#else
|
4255
|
|
- if (sqrt(X_probe_location * X_probe_location + Y_probe_location * Y_probe_location) > DELTA_PROBEABLE_RADIUS) {
|
|
4255
|
+ if (HYPOT(X_probe_location, Y_probe_location) > DELTA_PROBEABLE_RADIUS) {
|
4256
|
4256
|
SERIAL_PROTOCOLLNPGM("? (X,Y) location outside of probeable radius.");
|
4257
|
4257
|
return;
|
4258
|
4258
|
}
|
|
@@ -4342,7 +4342,7 @@ inline void gcode_M42() {
|
4342
|
4342
|
#else
|
4343
|
4343
|
// If we have gone out too far, we can do a simple fix and scale the numbers
|
4344
|
4344
|
// back in closer to the origin.
|
4345
|
|
- while (sqrt(X_current * X_current + Y_current * Y_current) > DELTA_PROBEABLE_RADIUS) {
|
|
4345
|
+ while (HYPOT(X_current, Y_current) > DELTA_PROBEABLE_RADIUS) {
|
4346
|
4346
|
X_current /= 1.25;
|
4347
|
4347
|
Y_current /= 1.25;
|
4348
|
4348
|
if (verbose_level > 3) {
|
|
@@ -4378,10 +4378,9 @@ inline void gcode_M42() {
|
4378
|
4378
|
* data points we have so far
|
4379
|
4379
|
*/
|
4380
|
4380
|
sum = 0.0;
|
4381
|
|
- for (uint8_t j = 0; j <= n; j++) {
|
4382
|
|
- float ss = sample_set[j] - mean;
|
4383
|
|
- sum += ss * ss;
|
4384
|
|
- }
|
|
4381
|
+ for (uint8_t j = 0; j <= n; j++)
|
|
4382
|
+ sum += sq(sample_set[j] - mean);
|
|
4383
|
+
|
4385
|
4384
|
sigma = sqrt(sum / (n + 1));
|
4386
|
4385
|
if (verbose_level > 0) {
|
4387
|
4386
|
if (verbose_level > 1) {
|
|
@@ -8139,7 +8138,7 @@ void prepare_move_to_destination() {
|
8139
|
8138
|
* This is important when there are successive arc motions.
|
8140
|
8139
|
*/
|
8141
|
8140
|
// Vector rotation matrix values
|
8142
|
|
- float cos_T = 1 - 0.5 * theta_per_segment * theta_per_segment; // Small angle approximation
|
|
8141
|
+ float cos_T = 1 - 0.5 * sq(theta_per_segment); // Small angle approximation
|
8143
|
8142
|
float sin_T = theta_per_segment;
|
8144
|
8143
|
|
8145
|
8144
|
float arc_target[NUM_AXIS];
|