Macros to eliminate 'f + 0.0' (#21568)
This commit is contained in:
@ -248,7 +248,7 @@ void home_delta() {
|
||||
#endif
|
||||
|
||||
// Move all carriages together linearly until an endstop is hit.
|
||||
current_position.z = (delta_height + 10 - TERN0(HAS_BED_PROBE, probe.offset.z));
|
||||
current_position.z = DIFF_TERN(HAS_BED_PROBE, delta_height + 10, probe.offset.z);
|
||||
line_to_current_position(homing_feedrate(Z_AXIS));
|
||||
planner.synchronize();
|
||||
|
||||
|
@ -583,7 +583,7 @@ void restore_feedrate_and_scaling() {
|
||||
#elif ENABLED(DELTA)
|
||||
|
||||
soft_endstop.min[axis] = base_min_pos(axis);
|
||||
soft_endstop.max[axis] = (axis == Z_AXIS) ? delta_height - TERN0(HAS_BED_PROBE, probe.offset.z) : base_max_pos(axis);
|
||||
soft_endstop.max[axis] = (axis == Z_AXIS) ? DIFF_TERN(HAS_BED_PROBE, delta_height, probe.offset.z) : base_max_pos(axis);
|
||||
|
||||
switch (axis) {
|
||||
case X_AXIS:
|
||||
@ -1847,7 +1847,7 @@ void set_axis_is_at_home(const AxisEnum axis) {
|
||||
#if EITHER(MORGAN_SCARA, AXEL_TPARA)
|
||||
scara_set_axis_is_at_home(axis);
|
||||
#elif ENABLED(DELTA)
|
||||
current_position[axis] = (axis == Z_AXIS) ? delta_height - TERN0(HAS_BED_PROBE, probe.offset.z) : base_home_pos(axis);
|
||||
current_position[axis] = (axis == Z_AXIS) ? DIFF_TERN(HAS_BED_PROBE, delta_height, probe.offset.z) : base_home_pos(axis);
|
||||
#else
|
||||
current_position[axis] = base_home_pos(axis);
|
||||
#endif
|
||||
|
@ -2997,7 +2997,7 @@ 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);
|
||||
|
||||
const float e_new = e - TERN0(FWRETRACT, fwretract.current_retract[active_extruder]);
|
||||
const float e_new = DIFF_TERN(FWRETRACT, e, fwretract.current_retract[active_extruder]);
|
||||
position.e = LROUND(settings.axis_steps_per_mm[axis_index] * e_new);
|
||||
TERN_(HAS_POSITION_FLOAT, position_float.e = e_new);
|
||||
TERN_(IS_KINEMATIC, position_cart.e = e);
|
||||
|
@ -51,8 +51,8 @@ float segments_per_second = TERN(AXEL_TPARA, TPARA_SEGMENTS_PER_SECOND, SCARA_SE
|
||||
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,
|
||||
b_cos = cos(RADIANS(b + TERN0(MP_SCARA, a))) * L2;
|
||||
b_sin = sin(RADIANS(SUM_TERN(MP_SCARA, b, a))) * L2,
|
||||
b_cos = cos(RADIANS(SUM_TERN(MP_SCARA, b, a))) * L2;
|
||||
|
||||
cartes.x = a_cos + b_cos + scara_offset.x; // theta
|
||||
cartes.y = a_sin + b_sin + scara_offset.y; // phi
|
||||
@ -127,7 +127,7 @@ float segments_per_second = TERN(AXEL_TPARA, TPARA_SEGMENTS_PER_SECOND, SCARA_SE
|
||||
// Angle of Arm2
|
||||
PSI = ATAN2(S2, C2);
|
||||
|
||||
delta.set(DEGREES(THETA), DEGREES(PSI + TERN0(MORGAN_SCARA, THETA)), raw.z);
|
||||
delta.set(DEGREES(THETA), DEGREES(SUM_TERN(MORGAN_SCARA, PSI, THETA)), raw.z);
|
||||
|
||||
/*
|
||||
DEBUG_POS("SCARA IK", raw);
|
||||
|
@ -359,7 +359,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
|
||||
// STEP 6
|
||||
|
||||
current_position.x = midpos - TERN0(HAS_HOTEND_OFFSET, hotend_offset[new_tool].x);
|
||||
current_position.x = DIFF_TERN(HAS_HOTEND_OFFSET, midpos, hotend_offset[new_tool].x);
|
||||
|
||||
DEBUG_SYNCHRONIZE();
|
||||
DEBUG_POS("(6) Move midway between hotends", current_position);
|
||||
|
Reference in New Issue
Block a user