Skip to content

Commit

Permalink
munge math
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Feb 10, 2022
1 parent 8616120 commit bbd8c6b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,12 @@

const int x_axis_home_dir = TOOL_X_HOME_DIR(active_extruder);

const float speed_ratio = homing_feedrate(X_AXIS) / homing_feedrate(Y_AXIS);
const float speed_ratio_inv = homing_feedrate(Y_AXIS) / homing_feedrate(X_AXIS);
const float length_ratio = max_length(X_AXIS) / max_length(Y_AXIS);
const bool length_r_less_than_speed_r = length_ratio < speed_ratio;

const float mlx = length_r_less_than_speed_r ? (max_length(Y_AXIS) * speed_ratio) : (max_length(X_AXIS));
const float mly = length_r_less_than_speed_r ? (max_length(Y_AXIS)) : (max_length(X_AXIS) * speed_ratio_inv);
const float fr_mm_s = SQRT(sq(homing_feedrate(X_AXIS)) + sq(homing_feedrate(Y_AXIS)));
const float hfx = homing_feedrate(X_AXIS), hfy = homing_feedrate(Y_AXIS),
ratio_xy = hfx / hfy, ratio_yx = hfy / hfx,
r_length = max_length(X_AXIS) / max_length(Y_AXIS),
mlx = r_length < ratio_xy ? max_length(Y_AXIS) * ratio_xy : max_length(X_AXIS),
mly = r_length > ratio_xy ? max_length(X_AXIS) * ratio_yx : max_length(Y_AXIS),
fr_mm_s = HYPOT(hfx, hfy);

#if ENABLED(SENSORLESS_HOMING)
sensorless_t stealth_states {
Expand Down

0 comments on commit bbd8c6b

Please sign in to comment.