Replace 'const float &' with 'const_float_t' (#21505)

This commit is contained in:
Scott Lahteine
2021-04-01 17:59:57 -05:00
committed by GitHub
parent 600ef1e47c
commit 62f37669dc
79 changed files with 376 additions and 366 deletions

View File

@ -177,7 +177,7 @@ float delta_safe_distance_from_top() {
*
* The result is stored in the cartes[] array.
*/
void forward_kinematics(const float &z1, const float &z2, const float &z3) {
void forward_kinematics(const_float_t z1, const_float_t z2, const_float_t z3) {
// Create a vector in old coordinates along x axis of new coordinate
const float p12[3] = { delta_tower[B_AXIS].x - delta_tower[A_AXIS].x, delta_tower[B_AXIS].y - delta_tower[A_AXIS].y, z2 - z1 },

View File

@ -120,7 +120,7 @@ float delta_safe_distance_from_top();
*
* The result is stored in the cartes[] array.
*/
void forward_kinematics(const float &z1, const float &z2, const float &z3);
void forward_kinematics(const_float_t z1, const_float_t z2, const_float_t z3);
FORCE_INLINE void forward_kinematics(const abc_float_t &point) {
forward_kinematics(point.a, point.b, point.c);

View File

@ -311,12 +311,12 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
* Move the planner to the current position from wherever it last moved
* (or from wherever it has been told it is located).
*/
void line_to_current_position(const feedRate_t &fr_mm_s/*=feedrate_mm_s*/) {
void line_to_current_position(const_feedRate_t fr_mm_s/*=feedrate_mm_s*/) {
planner.buffer_line(current_position, fr_mm_s, active_extruder);
}
#if EXTRUDERS
void unscaled_e_move(const float &length, const feedRate_t &fr_mm_s) {
void unscaled_e_move(const_float_t length, const_feedRate_t fr_mm_s) {
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
current_position.e += length / planner.e_factor[active_extruder];
line_to_current_position(fr_mm_s);
@ -329,7 +329,7 @@ void line_to_current_position(const feedRate_t &fr_mm_s/*=feedrate_mm_s*/) {
/**
* Buffer a fast move without interpolation. Set current_position to destination
*/
void prepare_fast_move_to_destination(const feedRate_t &scaled_fr_mm_s/*=MMS_SCALED(feedrate_mm_s)*/) {
void prepare_fast_move_to_destination(const_feedRate_t scaled_fr_mm_s/*=MMS_SCALED(feedrate_mm_s)*/) {
if (DEBUGGING(LEVELING)) DEBUG_POS("prepare_fast_move_to_destination", destination);
#if UBL_SEGMENTED
@ -351,7 +351,7 @@ void line_to_current_position(const feedRate_t &fr_mm_s/*=feedrate_mm_s*/) {
* - Move at normal speed regardless of feedrate percentage.
* - Extrude the specified length regardless of flow percentage.
*/
void _internal_move_to_destination(const feedRate_t &fr_mm_s/*=0.0f*/
void _internal_move_to_destination(const_feedRate_t fr_mm_s/*=0.0f*/
#if IS_KINEMATIC
, const bool is_fast/*=false*/
#endif
@ -384,7 +384,7 @@ void _internal_move_to_destination(const feedRate_t &fr_mm_s/*=0.0f*/
/**
* Plan a move to (X, Y, Z) and set the current_position
*/
void do_blocking_move_to(const float rx, const float ry, const float rz, const feedRate_t &fr_mm_s/*=0.0*/) {
void do_blocking_move_to(const float rx, const float ry, const float rz, const_feedRate_t fr_mm_s/*=0.0*/) {
DEBUG_SECTION(log_move, "do_blocking_move_to", DEBUGGING(LEVELING));
if (DEBUGGING(LEVELING)) DEBUG_XYZ("> ", rx, ry, rz);
@ -473,38 +473,38 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const f
planner.synchronize();
}
void do_blocking_move_to(const xy_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
void do_blocking_move_to(const xy_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(raw.x, raw.y, current_position.z, fr_mm_s);
}
void do_blocking_move_to(const xyz_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
void do_blocking_move_to(const xyz_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(raw.x, raw.y, raw.z, fr_mm_s);
}
void do_blocking_move_to(const xyze_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(raw.x, raw.y, raw.z, fr_mm_s);
}
void do_blocking_move_to_x(const float &rx, const feedRate_t &fr_mm_s/*=0.0*/) {
void do_blocking_move_to_x(const_float_t rx, const_feedRate_t fr_mm_s/*=0.0*/) {
do_blocking_move_to(rx, current_position.y, current_position.z, fr_mm_s);
}
void do_blocking_move_to_y(const float &ry, const feedRate_t &fr_mm_s/*=0.0*/) {
void do_blocking_move_to_y(const_float_t ry, const_feedRate_t fr_mm_s/*=0.0*/) {
do_blocking_move_to(current_position.x, ry, current_position.z, fr_mm_s);
}
void do_blocking_move_to_z(const float &rz, const feedRate_t &fr_mm_s/*=0.0*/) {
void do_blocking_move_to_z(const_float_t rz, const_feedRate_t fr_mm_s/*=0.0*/) {
do_blocking_move_to_xy_z(current_position, rz, fr_mm_s);
}
void do_blocking_move_to_xy(const float &rx, const float &ry, const feedRate_t &fr_mm_s/*=0.0*/) {
void do_blocking_move_to_xy(const_float_t rx, const_float_t ry, const_feedRate_t fr_mm_s/*=0.0*/) {
do_blocking_move_to(rx, ry, current_position.z, fr_mm_s);
}
void do_blocking_move_to_xy(const xy_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
void do_blocking_move_to_xy(const xy_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to_xy(raw.x, raw.y, fr_mm_s);
}
void do_blocking_move_to_xy_z(const xy_pos_t &raw, const float &z, const feedRate_t &fr_mm_s/*=0.0f*/) {
void do_blocking_move_to_xy_z(const xy_pos_t &raw, const_float_t z, const_feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(raw.x, raw.y, z, fr_mm_s);
}
void do_z_clearance(const float &zclear, const bool lower_allowed/*=false*/) {
void do_z_clearance(const_float_t zclear, const bool lower_allowed/*=false*/) {
float zdest = zclear;
if (!lower_allowed) NOLESS(zdest, current_position.z);
do_blocking_move_to_z(_MIN(zdest, Z_MAX_POS), TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS)));
@ -826,7 +826,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
* small incremental moves. This allows the planner to
* apply more detailed bed leveling to the full move.
*/
inline void segmented_line_to_destination(const feedRate_t &fr_mm_s, const float segment_size=LEVELED_SEGMENT_LENGTH) {
inline void segmented_line_to_destination(const_feedRate_t fr_mm_s, const float segment_size=LEVELED_SEGMENT_LENGTH) {
const xyze_float_t diff = destination - current_position;

View File

@ -229,28 +229,28 @@ void sync_plan_position_e();
* Move the planner to the current position from wherever it last moved
* (or from wherever it has been told it is located).
*/
void line_to_current_position(const feedRate_t &fr_mm_s=feedrate_mm_s);
void line_to_current_position(const_feedRate_t fr_mm_s=feedrate_mm_s);
#if EXTRUDERS
void unscaled_e_move(const float &length, const feedRate_t &fr_mm_s);
void unscaled_e_move(const_float_t length, const_feedRate_t fr_mm_s);
#endif
void prepare_line_to_destination();
void _internal_move_to_destination(const feedRate_t &fr_mm_s=0.0f
void _internal_move_to_destination(const_feedRate_t fr_mm_s=0.0f
#if IS_KINEMATIC
, const bool is_fast=false
#endif
);
inline void prepare_internal_move_to_destination(const feedRate_t &fr_mm_s=0.0f) {
inline void prepare_internal_move_to_destination(const_feedRate_t fr_mm_s=0.0f) {
_internal_move_to_destination(fr_mm_s);
}
#if IS_KINEMATIC
void prepare_fast_move_to_destination(const feedRate_t &scaled_fr_mm_s=MMS_SCALED(feedrate_mm_s));
void prepare_fast_move_to_destination(const_feedRate_t scaled_fr_mm_s=MMS_SCALED(feedrate_mm_s));
inline void prepare_internal_fast_move_to_destination(const feedRate_t &fr_mm_s=0.0f) {
inline void prepare_internal_fast_move_to_destination(const_feedRate_t fr_mm_s=0.0f) {
_internal_move_to_destination(fr_mm_s, true);
}
#endif
@ -258,29 +258,29 @@ inline void prepare_internal_move_to_destination(const feedRate_t &fr_mm_s=0.0f)
/**
* Blocking movement and shorthand functions
*/
void do_blocking_move_to(const float rx, const float ry, const float rz, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to(const xy_pos_t &raw, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to(const xyz_pos_t &raw, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to(const xyze_pos_t &raw, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to(const float rx, const float ry, const float rz, const_feedRate_t fr_mm_s=0.0f);
void do_blocking_move_to(const xy_pos_t &raw, const_feedRate_t fr_mm_s=0.0f);
void do_blocking_move_to(const xyz_pos_t &raw, const_feedRate_t fr_mm_s=0.0f);
void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s=0.0f);
void do_blocking_move_to_x(const float &rx, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to_y(const float &ry, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to_z(const float &rz, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to_x(const_float_t rx, const_feedRate_t fr_mm_s=0.0f);
void do_blocking_move_to_y(const_float_t ry, const_feedRate_t fr_mm_s=0.0f);
void do_blocking_move_to_z(const_float_t rz, const_feedRate_t fr_mm_s=0.0f);
void do_blocking_move_to_xy(const float &rx, const float &ry, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to_xy(const xy_pos_t &raw, const feedRate_t &fr_mm_s=0.0f);
FORCE_INLINE void do_blocking_move_to_xy(const xyz_pos_t &raw, const feedRate_t &fr_mm_s=0.0f) { do_blocking_move_to_xy(xy_pos_t(raw), fr_mm_s); }
FORCE_INLINE void do_blocking_move_to_xy(const xyze_pos_t &raw, const feedRate_t &fr_mm_s=0.0f) { do_blocking_move_to_xy(xy_pos_t(raw), fr_mm_s); }
void do_blocking_move_to_xy(const_float_t rx, const_float_t ry, const_feedRate_t fr_mm_s=0.0f);
void do_blocking_move_to_xy(const xy_pos_t &raw, const_feedRate_t fr_mm_s=0.0f);
FORCE_INLINE void do_blocking_move_to_xy(const xyz_pos_t &raw, const_feedRate_t fr_mm_s=0.0f) { do_blocking_move_to_xy(xy_pos_t(raw), fr_mm_s); }
FORCE_INLINE void do_blocking_move_to_xy(const xyze_pos_t &raw, const_feedRate_t fr_mm_s=0.0f) { do_blocking_move_to_xy(xy_pos_t(raw), fr_mm_s); }
void do_blocking_move_to_xy_z(const xy_pos_t &raw, const float &z, const feedRate_t &fr_mm_s=0.0f);
FORCE_INLINE void do_blocking_move_to_xy_z(const xyz_pos_t &raw, const float &z, const feedRate_t &fr_mm_s=0.0f) { do_blocking_move_to_xy_z(xy_pos_t(raw), z, fr_mm_s); }
FORCE_INLINE void do_blocking_move_to_xy_z(const xyze_pos_t &raw, const float &z, const feedRate_t &fr_mm_s=0.0f) { do_blocking_move_to_xy_z(xy_pos_t(raw), z, fr_mm_s); }
void do_blocking_move_to_xy_z(const xy_pos_t &raw, const_float_t z, const_feedRate_t fr_mm_s=0.0f);
FORCE_INLINE void do_blocking_move_to_xy_z(const xyz_pos_t &raw, const_float_t z, const_feedRate_t fr_mm_s=0.0f) { do_blocking_move_to_xy_z(xy_pos_t(raw), z, fr_mm_s); }
FORCE_INLINE void do_blocking_move_to_xy_z(const xyze_pos_t &raw, const_float_t z, const_feedRate_t fr_mm_s=0.0f) { do_blocking_move_to_xy_z(xy_pos_t(raw), z, fr_mm_s); }
void remember_feedrate_and_scaling();
void remember_feedrate_scaling_off();
void restore_feedrate_and_scaling();
void do_z_clearance(const float &zclear, const bool lower_allowed=false);
void do_z_clearance(const_float_t zclear, const bool lower_allowed=false);
/**
* Homing and Trusted Axes
@ -393,7 +393,7 @@ FORCE_INLINE bool all_axes_trusted() { return xyz_bits ==
#endif
// Return true if the given point is within the printable area
inline bool position_is_reachable(const float &rx, const float &ry, const float inset=0) {
inline bool position_is_reachable(const_float_t rx, const_float_t ry, const float inset=0) {
#if ENABLED(DELTA)
return HYPOT2(rx, ry) <= sq(DELTA_PRINTABLE_RADIUS - inset + fslop);
@ -428,7 +428,7 @@ FORCE_INLINE bool all_axes_trusted() { return xyz_bits ==
#else // CARTESIAN
// Return true if the given position is within the machine bounds.
inline bool position_is_reachable(const float &rx, const float &ry) {
inline bool position_is_reachable(const_float_t rx, const_float_t ry) {
if (!COORDINATE_OKAY(ry, Y_MIN_POS - fslop, Y_MAX_POS + fslop)) return false;
#if ENABLED(DUAL_X_CARRIAGE)
if (active_extruder)

View File

@ -775,7 +775,7 @@ block_t* Planner::get_current_block() {
* is not and will not use the block while we modify it, so it is safe to
* alter its values.
*/
void Planner::calculate_trapezoid_for_block(block_t * const block, const float &entry_factor, const float &exit_factor) {
void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t entry_factor, const_float_t exit_factor) {
uint32_t initial_rate = CEIL(block->nominal_rate * entry_factor),
final_rate = CEIL(block->nominal_rate * exit_factor); // (steps per second)
@ -1463,7 +1463,7 @@ void Planner::check_axes_activity() {
* This is the reciprocal of the circular cross-section area.
* Return 1.0 with volumetric off or a diameter of 0.0.
*/
inline float calculate_volumetric_multiplier(const float &diameter) {
inline float calculate_volumetric_multiplier(const_float_t diameter) {
return (parser.volumetric_enabled && diameter) ? 1.0f / CIRCLE_AREA(diameter * 0.5f) : 1;
}
@ -1745,7 +1745,7 @@ bool Planner::_buffer_steps(const xyze_long_t &target
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#endif
, feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters
, feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters
) {
// Wait for the next available block
@ -1811,7 +1811,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#endif
, feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/
, feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters/*=0.0*/
) {
const int32_t da = target.a - position.a,
@ -2745,11 +2745,11 @@ void Planner::buffer_sync_block(TERN_(LASER_SYNCHRONOUS_M106_M107, uint8_t sync_
*
* Return 'false' if no segment was queued due to cleaning, cold extrusion, full queue, etc.
*/
bool Planner::buffer_segment(const float &a, const float &b, const float &c, const float &e
bool Planner::buffer_segment(const_float_t a, const_float_t b, const_float_t c, const_float_t e
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#endif
, const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/
, const_feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters/*=0.0*/
) {
// If we are cleaning, do not accept queuing of movements
@ -2839,9 +2839,9 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
* millimeters - the length of the movement, if known
* inv_duration - the reciprocal if the duration of the movement, if known (kinematic only if feeedrate scaling is enabled)
*/
bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, const float &e, const feedRate_t &fr_mm_s, const uint8_t extruder, const float millimeters
bool Planner::buffer_line(const_float_t rx, const_float_t ry, const_float_t rz, const_float_t e, const_feedRate_t fr_mm_s, const uint8_t extruder, const float millimeters
#if ENABLED(SCARA_FEEDRATE_SCALING)
, const float &inv_duration
, const_float_t inv_duration
#endif
) {
xyze_pos_t machine = { rx, ry, rz, e };
@ -2960,7 +2960,7 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con
* The provided ABC position is in machine units.
*/
void Planner::set_machine_position_mm(const float &a, const float &b, const float &c, const float &e) {
void Planner::set_machine_position_mm(const_float_t a, const_float_t b, const_float_t c, const_float_t e) {
TERN_(DISTINCT_E_FACTORS, last_extruder = active_extruder);
TERN_(HAS_POSITION_FLOAT, position_float.set(a, b, c, e));
position.set(LROUND(a * settings.axis_steps_per_mm[A_AXIS]),
@ -2976,7 +2976,7 @@ void Planner::set_machine_position_mm(const float &a, const float &b, const floa
stepper.set_position(position);
}
void Planner::set_position_mm(const float &rx, const float &ry, const float &rz, const float &e) {
void Planner::set_position_mm(const_float_t rx, const_float_t ry, const_float_t rz, const_float_t e) {
xyze_pos_t machine = { rx, ry, rz, e };
#if HAS_POSITION_MODIFIERS
apply_modifiers(machine, true);
@ -2993,7 +2993,7 @@ void Planner::set_position_mm(const float &rx, const float &ry, const float &rz,
/**
* Setters for planner position (also setting stepper position).
*/
void Planner::set_e_position_mm(const float &e) {
void Planner::set_e_position_mm(const_float_t e) {
const uint8_t axis_index = E_AXIS_N(active_extruder);
TERN_(DISTINCT_E_FACTORS, last_extruder = active_extruder);

View File

@ -491,7 +491,7 @@ class Planner {
#if HAS_CLASSIC_JERK
static void set_max_jerk(const AxisEnum axis, float inMaxJerkMMS);
#else
static inline void set_max_jerk(const AxisEnum, const float&) {}
static inline void set_max_jerk(const AxisEnum, const_float_t ) {}
#endif
#if EXTRUDERS
@ -541,7 +541,7 @@ class Planner {
static void calculate_volumetric_extruder_limits();
#endif
FORCE_INLINE static void set_filament_size(const uint8_t e, const float &v) {
FORCE_INLINE static void set_filament_size(const uint8_t e, const_float_t v) {
filament_size[e] = v;
if (v > 0) volumetric_area_nominal = CIRCLE_AREA(v * 0.5); //TODO: should it be per extruder
// make sure all extruders have some sane value for the filament size
@ -552,7 +552,7 @@ class Planner {
#endif
#if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
FORCE_INLINE static void set_volumetric_extruder_limit(const uint8_t e, const float &v) {
FORCE_INLINE static void set_volumetric_extruder_limit(const uint8_t e, const_float_t v) {
volumetric_extruder_limit[e] = v;
calculate_volumetric_extruder_limit(e);
}
@ -567,7 +567,7 @@ class Planner {
* Returns 1.0 if planner.z_fade_height is 0.0.
* Returns 0.0 if Z is past the specified 'Fade Height'.
*/
static inline float fade_scaling_factor_for_z(const float &rz) {
static inline float fade_scaling_factor_for_z(const_float_t rz) {
static float z_fade_factor = 1;
if (!z_fade_height) return 1;
if (rz >= z_fade_height) return 0;
@ -580,27 +580,27 @@ class Planner {
FORCE_INLINE static void force_fade_recalc() { last_fade_z = -999.999f; }
FORCE_INLINE static void set_z_fade_height(const float &zfh) {
FORCE_INLINE static void set_z_fade_height(const_float_t zfh) {
z_fade_height = zfh > 0 ? zfh : 0;
inverse_z_fade_height = RECIPROCAL(z_fade_height);
force_fade_recalc();
}
FORCE_INLINE static bool leveling_active_at_z(const float &rz) {
FORCE_INLINE static bool leveling_active_at_z(const_float_t rz) {
return !z_fade_height || rz < z_fade_height;
}
#else
FORCE_INLINE static float fade_scaling_factor_for_z(const float&) { return 1; }
FORCE_INLINE static float fade_scaling_factor_for_z(const_float_t ) { return 1; }
FORCE_INLINE static bool leveling_active_at_z(const float&) { return true; }
FORCE_INLINE static bool leveling_active_at_z(const_float_t ) { return true; }
#endif
#if ENABLED(SKEW_CORRECTION)
FORCE_INLINE static void skew(float &cx, float &cy, const float &cz) {
FORCE_INLINE static void skew(float &cx, float &cy, const_float_t cz) {
if (COORDINATE_OKAY(cx, X_MIN_POS + 1, X_MAX_POS) && COORDINATE_OKAY(cy, Y_MIN_POS + 1, Y_MAX_POS)) {
const float sx = cx - cy * skew_factor.xy - cz * (skew_factor.xz - (skew_factor.xy * skew_factor.yz)),
sy = cy - cz * skew_factor.yz;
@ -611,7 +611,7 @@ class Planner {
}
FORCE_INLINE static void skew(xyz_pos_t &raw) { skew(raw.x, raw.y, raw.z); }
FORCE_INLINE static void unskew(float &cx, float &cy, const float &cz) {
FORCE_INLINE static void unskew(float &cx, float &cy, const_float_t cz) {
if (COORDINATE_OKAY(cx, X_MIN_POS, X_MAX_POS) && COORDINATE_OKAY(cy, Y_MIN_POS, Y_MAX_POS)) {
const float sx = cx + cy * skew_factor.xy + cz * skew_factor.xz,
sy = cy + cz * skew_factor.yz;
@ -713,7 +713,7 @@ class Planner {
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#endif
, feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
, feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters=0.0
);
/**
@ -736,7 +736,7 @@ class Planner {
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#endif
, feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
, feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters=0.0
);
/**
@ -767,18 +767,18 @@ class Planner {
* extruder - target extruder
* millimeters - the length of the movement, if known
*/
static bool buffer_segment(const float &a, const float &b, const float &c, const float &e
static bool buffer_segment(const_float_t a, const_float_t b, const_float_t c, const_float_t e
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#endif
, const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
, const_feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters=0.0
);
FORCE_INLINE static bool buffer_segment(abce_pos_t &abce
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#endif
, const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
, const_feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters=0.0
) {
return buffer_segment(abce.a, abce.b, abce.c, abce.e
#if HAS_DIST_MM_ARG
@ -800,15 +800,15 @@ class Planner {
* millimeters - the length of the movement, if known
* inv_duration - the reciprocal if the duration of the movement, if known (kinematic only if feeedrate scaling is enabled)
*/
static bool buffer_line(const float &rx, const float &ry, const float &rz, const float &e, const feedRate_t &fr_mm_s, const uint8_t extruder, const float millimeters=0.0
static bool buffer_line(const_float_t rx, const_float_t ry, const_float_t rz, const_float_t e, const_feedRate_t fr_mm_s, const uint8_t extruder, const float millimeters=0.0
#if ENABLED(SCARA_FEEDRATE_SCALING)
, const float &inv_duration=0.0
, const_float_t inv_duration=0.0
#endif
);
FORCE_INLINE static bool buffer_line(const xyze_pos_t &cart, const feedRate_t &fr_mm_s, const uint8_t extruder, const float millimeters=0.0
FORCE_INLINE static bool buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s, const uint8_t extruder, const float millimeters=0.0
#if ENABLED(SCARA_FEEDRATE_SCALING)
, const float &inv_duration=0.0
, const_float_t inv_duration=0.0
#endif
) {
return buffer_line(cart.x, cart.y, cart.z, cart.e, fr_mm_s, extruder, millimeters
@ -835,9 +835,9 @@ class Planner {
*
* Clears previous speed values.
*/
static void set_position_mm(const float &rx, const float &ry, const float &rz, const float &e);
static void set_position_mm(const_float_t rx, const_float_t ry, const_float_t rz, const_float_t e);
FORCE_INLINE static void set_position_mm(const xyze_pos_t &cart) { set_position_mm(cart.x, cart.y, cart.z, cart.e); }
static void set_e_position_mm(const float &e);
static void set_e_position_mm(const_float_t e);
/**
* Set the planner.position and individual stepper positions.
@ -845,7 +845,7 @@ class Planner {
* The supplied position is in machine space, and no additional
* conversions are applied.
*/
static void set_machine_position_mm(const float &a, const float &b, const float &c, const float &e);
static void set_machine_position_mm(const_float_t a, const_float_t b, const_float_t c, const_float_t e);
FORCE_INLINE static void set_machine_position_mm(const abce_pos_t &abce) { set_machine_position_mm(abce.a, abce.b, abce.c, abce.e); }
/**
@ -957,7 +957,7 @@ class Planner {
* Calculate the distance (not time) it takes to accelerate
* from initial_rate to target_rate using the given acceleration:
*/
static float estimate_acceleration_distance(const float &initial_rate, const float &target_rate, const float &accel) {
static float estimate_acceleration_distance(const_float_t initial_rate, const_float_t target_rate, const_float_t accel) {
if (accel == 0) return 0; // accel was 0, set acceleration distance to 0
return (sq(target_rate) - sq(initial_rate)) / (accel * 2);
}
@ -970,7 +970,7 @@ class Planner {
* This is used to compute the intersection point between acceleration and deceleration
* in cases where the "trapezoid" has no plateau (i.e., never reaches maximum speed)
*/
static float intersection_distance(const float &initial_rate, const float &final_rate, const float &accel, const float &distance) {
static float intersection_distance(const_float_t initial_rate, const_float_t final_rate, const_float_t accel, const_float_t distance) {
if (accel == 0) return 0; // accel was 0, set intersection distance to 0
return (accel * 2 * distance - sq(initial_rate) + sq(final_rate)) / (accel * 4);
}
@ -980,7 +980,7 @@ class Planner {
* to reach 'target_velocity_sqr' using 'acceleration' within a given
* 'distance'.
*/
static float max_allowable_speed_sqr(const float &accel, const float &target_velocity_sqr, const float &distance) {
static float max_allowable_speed_sqr(const_float_t accel, const_float_t target_velocity_sqr, const_float_t distance) {
return target_velocity_sqr - 2 * accel * distance;
}
@ -988,12 +988,12 @@ class Planner {
/**
* Calculate the speed reached given initial speed, acceleration and distance
*/
static float final_speed(const float &initial_velocity, const float &accel, const float &distance) {
static float final_speed(const_float_t initial_velocity, const_float_t accel, const_float_t distance) {
return SQRT(sq(initial_velocity) + 2 * accel * distance);
}
#endif
static void calculate_trapezoid_for_block(block_t * const block, const float &entry_factor, const float &exit_factor);
static void calculate_trapezoid_for_block(block_t * const block, const_float_t entry_factor, const_float_t exit_factor);
static void reverse_pass_kernel(block_t * const current, const block_t * const next);
static void forward_pass_kernel(const block_t * const previous, block_t * const current, uint8_t block_index);
@ -1013,7 +1013,7 @@ class Planner {
vector *= RSQRT(magnitude_sq);
}
FORCE_INLINE static float limit_value_by_axis_maximum(const float &max_value, xyze_float_t &unit_vec) {
FORCE_INLINE static float limit_value_by_axis_maximum(const_float_t max_value, xyze_float_t &unit_vec) {
float limit_value = max_value;
LOOP_XYZE(idx) {
if (unit_vec[idx]) {

View File

@ -43,7 +43,7 @@
#define SIGMA 0.1f
// Compute the linear interpolation between two real numbers.
static inline float interp(const float &a, const float &b, const float &t) { return (1 - t) * a + t * b; }
static inline float interp(const_float_t a, const_float_t b, const_float_t t) { return (1 - t) * a + t * b; }
/**
* Compute a Bézier curve using the De Casteljau's algorithm (see
@ -51,7 +51,7 @@ static inline float interp(const float &a, const float &b, const float &t) { ret
* easy to code and has good numerical stability (very important,
* since Arudino works with limited precision real numbers).
*/
static inline float eval_bezier(const float &a, const float &b, const float &c, const float &d, const float &t) {
static inline float eval_bezier(const_float_t a, const_float_t b, const_float_t c, const_float_t d, const_float_t t) {
const float iab = interp(a, b, t),
ibc = interp(b, c, t),
icd = interp(c, d, t),
@ -64,7 +64,7 @@ static inline float eval_bezier(const float &a, const float &b, const float &c,
* We approximate Euclidean distance with the sum of the coordinates
* offset (so-called "norm 1"), which is quicker to compute.
*/
static inline float dist1(const float &x1, const float &y1, const float &x2, const float &y2) { return ABS(x1 - x2) + ABS(y1 - y2); }
static inline float dist1(const_float_t x1, const_float_t y1, const_float_t x2, const_float_t y2) { return ABS(x1 - x2) + ABS(y1 - y2); }
/**
* The algorithm for computing the step is loosely based on the one in Kig
@ -109,7 +109,7 @@ void cubic_b_spline(
const xyze_pos_t &position, // current position
const xyze_pos_t &target, // target position
const xy_pos_t (&offsets)[2], // a pair of offsets
const feedRate_t &scaled_fr_mm_s, // mm/s scaled by feedrate %
const_feedRate_t scaled_fr_mm_s, // mm/s scaled by feedrate %
const uint8_t extruder
) {
// Absolute first and second control points are recovered.

View File

@ -33,6 +33,6 @@ void cubic_b_spline(
const xyze_pos_t &position, // current position
const xyze_pos_t &target, // target position
const xy_pos_t (&offsets)[2], // a pair of offsets
const feedRate_t &scaled_fr_mm_s, // mm/s scaled by feedrate %
const_feedRate_t scaled_fr_mm_s, // mm/s scaled by feedrate %
const uint8_t extruder
);

View File

@ -475,7 +475,7 @@ bool Probe::set_deployed(const bool deploy) {
*
* @return TRUE if the probe failed to trigger.
*/
bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
DEBUG_SECTION(log_probe, "Probe::probe_down_to_z", DEBUGGING(LEVELING));
#if BOTH(HAS_HEATED_BED, WAIT_FOR_BED_HEATER)
@ -588,7 +588,7 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
float Probe::run_z_probe(const bool sanity_check/*=true*/) {
DEBUG_SECTION(log_probe, "Probe::run_z_probe", DEBUGGING(LEVELING));
auto try_to_probe = [&](PGM_P const plbl, const float &z_probe_low_point, const feedRate_t fr_mm_s, const bool scheck, const float clearance) -> bool {
auto try_to_probe = [&](PGM_P const plbl, const_float_t z_probe_low_point, const feedRate_t fr_mm_s, const bool scheck, const float clearance) -> bool {
// Tare the probe, if supported
if (TERN0(PROBE_TARE, tare())) return true;
@ -743,7 +743,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
* - Raise to the BETWEEN height
* - Return the probed Z position
*/
float Probe::probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_after/*=PROBE_PT_NONE*/, const uint8_t verbose_level/*=0*/, const bool probe_relative/*=true*/, const bool sanity_check/*=true*/) {
float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRaise raise_after/*=PROBE_PT_NONE*/, const uint8_t verbose_level/*=0*/, const bool probe_relative/*=true*/, const bool sanity_check/*=true*/) {
DEBUG_SECTION(log_probe, "Probe::probe_at_point", DEBUGGING(LEVELING));
if (DEBUGGING(LEVELING)) {

View File

@ -71,12 +71,12 @@ public:
#if HAS_PROBE_XY_OFFSET
// Return true if the both nozzle and the probe can reach the given point.
// Note: This won't work on SCARA since the probe offset rotates with the arm.
static bool can_reach(const float &rx, const float &ry) {
static bool can_reach(const_float_t rx, const_float_t ry) {
return position_is_reachable(rx - offset_xy.x, ry - offset_xy.y) // The nozzle can go where it needs to go?
&& position_is_reachable(rx, ry, ABS(PROBING_MARGIN)); // Can the nozzle also go near there?
}
#else
static bool can_reach(const float &rx, const float &ry) {
static bool can_reach(const_float_t rx, const_float_t ry) {
return position_is_reachable(rx, ry, PROBING_MARGIN);
}
#endif
@ -90,7 +90,7 @@ public:
* Example: For a probe offset of -10,+10, then for the probe to reach 0,0 the
* nozzle must be be able to reach +10,-10.
*/
static bool can_reach(const float &rx, const float &ry) {
static bool can_reach(const_float_t rx, const_float_t ry) {
return position_is_reachable(rx - offset_xy.x, ry - offset_xy.y)
&& COORDINATE_OKAY(rx, min_x() - fslop, max_x() + fslop)
&& COORDINATE_OKAY(ry, min_y() - fslop, max_y() + fslop);
@ -103,7 +103,7 @@ public:
do_z_clearance(Z_AFTER_PROBING, true); // Move down still permitted
#endif
}
static float probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true, const bool sanity_check=true);
static float probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true, const bool sanity_check=true);
static float probe_at_point(const xy_pos_t &pos, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true, const bool sanity_check=true) {
return probe_at_point(pos.x, pos.y, raise_after, verbose_level, probe_relative, sanity_check);
}
@ -114,7 +114,7 @@ public:
static bool set_deployed(const bool) { return false; }
static bool can_reach(const float &rx, const float &ry) { return position_is_reachable(rx, ry); }
static bool can_reach(const_float_t rx, const_float_t ry) { return position_is_reachable(rx, ry); }
#endif
@ -257,7 +257,7 @@ public:
#endif
private:
static bool probe_down_to_z(const float z, const feedRate_t fr_mm_s);
static bool probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s);
static void do_z_raise(const float z_raise);
static float run_z_probe(const bool sanity_check=true);
};

View File

@ -48,7 +48,7 @@ float segments_per_second = TERN(AXEL_TPARA, TPARA_SEGMENTS_PER_SECOND, SCARA_SE
* Maths and first version by QHARLEY.
* Integrated into Marlin and slightly restructured by Joachim Cerny.
*/
void forward_kinematics(const float &a, const float &b) {
void forward_kinematics(const_float_t a, const_float_t b) {
const float a_sin = sin(RADIANS(a)) * L1,
a_cos = cos(RADIANS(a)) * L1,
b_sin = sin(RADIANS(b + TERN0(MP_SCARA, a))) * L2,
@ -197,7 +197,7 @@ float segments_per_second = TERN(AXEL_TPARA, TPARA_SEGMENTS_PER_SECOND, SCARA_SE
}
// Convert ABC inputs in degrees to XYZ outputs in mm
void forward_kinematics(const float &a, const float &b, const float &c) {
void forward_kinematics(const_float_t a, const_float_t b, const_float_t c) {
const float w = c - b,
r = L1 * cos(RADIANS(b)) + L2 * sin(RADIANS(w - (90 - b))),
x = r * cos(RADIANS(a)),

View File

@ -35,7 +35,7 @@ extern float segments_per_second;
L1_2 = sq(float(L1)), L1_2_2 = 2.0 * L1_2,
L2_2 = sq(float(L2));
void forward_kinematics(const float &a, const float &b, const float &c);
void forward_kinematics(const_float_t a, const_float_t b, const_float_t c);
void home_TPARA();
#else
@ -44,7 +44,7 @@ extern float segments_per_second;
L1_2 = sq(float(L1)), L1_2_2 = 2.0 * L1_2,
L2_2 = sq(float(L2));
void forward_kinematics(const float &a, const float &b);
void forward_kinematics(const_float_t a, const_float_t b);
#endif

View File

@ -499,7 +499,7 @@ volatile bool Temperature::raw_temps_ready = false;
* Needs sufficient heater power to make some overshoot at target
* temperature to succeed.
*/
void Temperature::PID_autotune(const float &target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result/*=false*/) {
void Temperature::PID_autotune(const_float_t target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result/*=false*/) {
float current_temp = 0.0;
int cycles = 0;
bool heating = true;
@ -2336,7 +2336,7 @@ void Temperature::init() {
*
* TODO: Embed the last 3 parameters during init, if not less optimal
*/
void Temperature::tr_state_machine_t::run(const float &current, const float &target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_t hysteresis_degc) {
void Temperature::tr_state_machine_t::run(const_float_t current, const_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_t hysteresis_degc) {
#if HEATER_IDLE_HANDLER
// Convert the given heater_id_t to an idle array index
@ -3371,7 +3371,7 @@ void Temperature::tick() {
#include "../gcode/gcode.h"
static void print_heater_state(const float &c, const float &t
static void print_heater_state(const_float_t c, const_float_t t
#if ENABLED(SHOW_TEMP_ADC_VALUES)
, const float r
#endif
@ -3804,7 +3804,7 @@ void Temperature::tick() {
#define MIN_DELTA_SLOPE_TIME_PROBE 600
#endif
bool Temperature::wait_for_probe(const float target_temp, bool no_wait_for_cooling/*=true*/) {
bool Temperature::wait_for_probe(const_float_t target_temp, bool no_wait_for_cooling/*=true*/) {
const bool wants_to_cool = isProbeAboveTemp(target_temp);
const bool will_wait = !(wants_to_cool && no_wait_for_cooling);

View File

@ -688,7 +688,7 @@ class Temperature {
return degTargetHotend(e) > TEMP_HYSTERESIS && ABS(degHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS;
}
FORCE_INLINE static bool degHotendNear(const uint8_t e, const float &temp) {
FORCE_INLINE static bool degHotendNear(const uint8_t e, const_float_t temp) {
return ABS(degHotend(e) - temp) < (TEMP_HYSTERESIS);
}
@ -724,7 +724,7 @@ class Temperature {
static void wait_for_bed_heating();
FORCE_INLINE static bool degBedNear(const float &temp) {
FORCE_INLINE static bool degBedNear(const_float_t temp) {
return ABS(degBed() - temp) < (TEMP_BED_HYSTERESIS);
}
@ -735,9 +735,9 @@ class Temperature {
FORCE_INLINE static int16_t rawProbeTemp() { return temp_probe.raw; }
#endif
FORCE_INLINE static float degProbe() { return temp_probe.celsius; }
FORCE_INLINE static bool isProbeBelowTemp(const float target_temp) { return temp_probe.celsius < target_temp; }
FORCE_INLINE static bool isProbeAboveTemp(const float target_temp) { return temp_probe.celsius > target_temp; }
static bool wait_for_probe(const float target_temp, bool no_wait_for_cooling=true);
FORCE_INLINE static bool isProbeBelowTemp(const_float_t target_temp) { return temp_probe.celsius < target_temp; }
FORCE_INLINE static bool isProbeAboveTemp(const_float_t target_temp) { return temp_probe.celsius > target_temp; }
static bool wait_for_probe(const_float_t target_temp, bool no_wait_for_cooling=true);
#endif
#if WATCH_PROBE
@ -825,7 +825,7 @@ class Temperature {
static bool pid_debug_flag;
#endif
static void PID_autotune(const float &target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result=false);
static void PID_autotune(const_float_t target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result=false);
#if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
static bool adaptive_fan_slowing;
@ -959,7 +959,7 @@ class Temperature {
millis_t timer = 0;
TRState state = TRInactive;
float running_temp;
void run(const float &current, const float &target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_t hysteresis_degc);
void run(const_float_t current, const_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_t hysteresis_degc);
} tr_state_machine_t;
static tr_state_machine_t tr_state_machine[NR_HEATER_RUNAWAY];