@ -1743,7 +1743,7 @@ float Planner::get_axis_position_mm(const AxisEnum axis) {
else
else
axis_steps = stepper . position ( axis ) ;
axis_steps = stepper . position ( axis ) ;
# elif E NABLED(MARKFORGED_XY )
# elif E ITHER(MARKFORGED_XY, MARKFORGED_YX )
// Requesting one of the joined axes?
// Requesting one of the joined axes?
if ( axis = = CORE_AXIS_1 | | axis = = CORE_AXIS_2 ) {
if ( axis = = CORE_AXIS_1 | | axis = = CORE_AXIS_2 ) {
@ -1917,10 +1917,13 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
// Compute direction bit-mask for this block
// Compute direction bit-mask for this block
axis_bits_t dm = 0 ;
axis_bits_t dm = 0 ;
# if CORE_IS_XY
# if ANY( CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX)
if ( da < 0 ) SBI ( dm , X_HEAD ) ; // Save the toolhead's true direction in X
if ( da < 0 ) SBI ( dm , X_HEAD ) ; // Save the toolhead's true direction in X
if ( db < 0 ) SBI ( dm , Y_HEAD ) ; // ...and Y
if ( db < 0 ) SBI ( dm , Y_HEAD ) ; // ...and Y
if ( dc < 0 ) SBI ( dm , Z_AXIS ) ;
if ( dc < 0 ) SBI ( dm , Z_AXIS ) ;
# endif
# if IS_CORE
# if CORE_IS_XY
if ( da + db < 0 ) SBI ( dm , A_AXIS ) ; // Motor A direction
if ( da + db < 0 ) SBI ( dm , A_AXIS ) ; // Motor A direction
if ( CORESIGN ( da - db ) < 0 ) SBI ( dm , B_AXIS ) ; // Motor B direction
if ( CORESIGN ( da - db ) < 0 ) SBI ( dm , B_AXIS ) ; // Motor B direction
# elif CORE_IS_XZ
# elif CORE_IS_XZ
@ -1935,12 +1938,22 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
if ( dc < 0 ) SBI ( dm , Z_HEAD ) ; // ...and Z
if ( dc < 0 ) SBI ( dm , Z_HEAD ) ; // ...and Z
if ( db + dc < 0 ) SBI ( dm , B_AXIS ) ; // Motor B direction
if ( db + dc < 0 ) SBI ( dm , B_AXIS ) ; // Motor B direction
if ( CORESIGN ( db - dc ) < 0 ) SBI ( dm , C_AXIS ) ; // Motor C direction
if ( CORESIGN ( db - dc ) < 0 ) SBI ( dm , C_AXIS ) ; // Motor C direction
# endif
# if LINEAR_AXES >= 4
if ( di < 0 ) SBI ( dm , I_AXIS ) ;
# endif
# if LINEAR_AXES >= 5
if ( dj < 0 ) SBI ( dm , J_AXIS ) ;
# endif
# if LINEAR_AXES >= 6
if ( dk < 0 ) SBI ( dm , K_AXIS ) ;
# endif
# elif ENABLED(MARKFORGED_XY)
# elif ENABLED(MARKFORGED_XY)
if ( da < 0 ) SBI ( dm , X_HEAD ) ; // Save the toolhead's true direction in X
if ( db < 0 ) SBI ( dm , Y_HEAD ) ; // ...and Y
if ( dc < 0 ) SBI ( dm , Z_AXIS ) ;
if ( da + db < 0 ) SBI ( dm , A_AXIS ) ; // Motor A direction
if ( da + db < 0 ) SBI ( dm , A_AXIS ) ; // Motor A direction
if ( db < 0 ) SBI ( dm , B_AXIS ) ; // Motor B direction
if ( db < 0 ) SBI ( dm , B_AXIS ) ; // Motor B direction
# elif ENABLED(MARKFORGED_YX)
if ( da < 0 ) SBI ( dm , A_AXIS ) ; // Motor A direction
if ( db + da < 0 ) SBI ( dm , B_AXIS ) ; // Motor B direction
# else
# else
LINEAR_AXIS_CODE (
LINEAR_AXIS_CODE (
if ( da < 0 ) SBI ( dm , X_AXIS ) ,
if ( da < 0 ) SBI ( dm , X_AXIS ) ,
@ -1952,21 +1965,8 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
) ;
) ;
# endif
# endif
# if IS_CORE
# if LINEAR_AXES >= 4
if ( di < 0 ) SBI ( dm , I_AXIS ) ;
# endif
# if LINEAR_AXES >= 5
if ( dj < 0 ) SBI ( dm , J_AXIS ) ;
# endif
# if LINEAR_AXES >= 6
if ( dk < 0 ) SBI ( dm , K_AXIS ) ;
# endif
# endif
TERN_ ( HAS_EXTRUDERS , if ( de < 0 ) SBI ( dm , E_AXIS ) ) ;
# if HAS_EXTRUDERS
# if HAS_EXTRUDERS
if ( de < 0 ) SBI ( dm , E_AXIS ) ;
const float esteps_float = de * e_factor [ extruder ] ;
const float esteps_float = de * e_factor [ extruder ] ;
const uint32_t esteps = ABS ( esteps_float ) + 0.5f ;
const uint32_t esteps = ABS ( esteps_float ) + 0.5f ;
# else
# else
@ -1996,6 +1996,8 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
block - > steps . set ( LINEAR_AXIS_LIST ( ABS ( da ) , ABS ( db + dc ) , ABS ( db - dc ) , ABS ( di ) , ABS ( dj ) , ABS ( dk ) ) ) ;
block - > steps . set ( LINEAR_AXIS_LIST ( ABS ( da ) , ABS ( db + dc ) , ABS ( db - dc ) , ABS ( di ) , ABS ( dj ) , ABS ( dk ) ) ) ;
# elif ENABLED(MARKFORGED_XY)
# elif ENABLED(MARKFORGED_XY)
block - > steps . set ( LINEAR_AXIS_LIST ( ABS ( da + db ) , ABS ( db ) , ABS ( dc ) , ABS ( di ) , ABS ( dj ) , ABS ( dk ) ) ) ;
block - > steps . set ( LINEAR_AXIS_LIST ( ABS ( da + db ) , ABS ( db ) , ABS ( dc ) , ABS ( di ) , ABS ( dj ) , ABS ( dk ) ) ) ;
# elif ENABLED(MARKFORGED_YX)
block - > steps . set ( LINEAR_AXIS_LIST ( ABS ( da ) , ABS ( db + da ) , ABS ( dc ) , ABS ( di ) , ABS ( dj ) , ABS ( dk ) ) ) ;
# elif IS_SCARA
# elif IS_SCARA
block - > steps . set ( LINEAR_AXIS_LIST ( ABS ( da ) , ABS ( db ) , ABS ( dc ) , ABS ( di ) , ABS ( dj ) , ABS ( dk ) ) ) ;
block - > steps . set ( LINEAR_AXIS_LIST ( ABS ( da ) , ABS ( db ) , ABS ( dc ) , ABS ( di ) , ABS ( dj ) , ABS ( dk ) ) ) ;
# else
# else
@ -2012,15 +2014,18 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
* Having the real displacement of the head , we can calculate the total movement length and apply the desired speed .
* Having the real displacement of the head , we can calculate the total movement length and apply the desired speed .
*/
*/
struct DistanceMM : abce_float_t {
struct DistanceMM : abce_float_t {
# if EITHER(IS_CORE, MARKFORGED_XY )
# if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX )
struct { float x , y , z ; } head ;
struct { float x , y , z ; } head ;
# endif
# endif
} steps_dist_mm ;
} steps_dist_mm ;
# if IS_CORE
# if CORE_IS_XY
# if ANY( CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX)
steps_dist_mm . head . x = da * mm_per_step [ A_AXIS ] ;
steps_dist_mm . head . x = da * mm_per_step [ A_AXIS ] ;
steps_dist_mm . head . y = db * mm_per_step [ B_AXIS ] ;
steps_dist_mm . head . y = db * mm_per_step [ B_AXIS ] ;
steps_dist_mm . z = dc * mm_per_step [ Z_AXIS ] ;
steps_dist_mm . z = dc * mm_per_step [ Z_AXIS ] ;
# endif
# if IS_CORE
# if CORE_IS_XY
steps_dist_mm . a = ( da + db ) * mm_per_step [ A_AXIS ] ;
steps_dist_mm . a = ( da + db ) * mm_per_step [ A_AXIS ] ;
steps_dist_mm . b = CORESIGN ( da - db ) * mm_per_step [ B_AXIS ] ;
steps_dist_mm . b = CORESIGN ( da - db ) * mm_per_step [ B_AXIS ] ;
# elif CORE_IS_XZ
# elif CORE_IS_XZ
@ -2046,11 +2051,11 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
steps_dist_mm . k = dk * mm_per_step [ K_AXIS ] ;
steps_dist_mm . k = dk * mm_per_step [ K_AXIS ] ;
# endif
# endif
# elif ENABLED(MARKFORGED_XY)
# elif ENABLED(MARKFORGED_XY)
steps_dist_mm . head . x = da * mm_per_step [ A_AXIS ] ;
steps_dist_mm . head . y = db * mm_per_step [ B_AXIS ] ;
steps_dist_mm . z = dc * mm_per_step [ Z_AXIS ] ;
steps_dist_mm . a = ( da - db ) * mm_per_step [ A_AXIS ] ;
steps_dist_mm . a = ( da - db ) * mm_per_step [ A_AXIS ] ;
steps_dist_mm . b = db * mm_per_step [ B_AXIS ] ;
steps_dist_mm . b = db * mm_per_step [ B_AXIS ] ;
# elif ENABLED(MARKFORGED_YX)
steps_dist_mm . a = da * mm_per_step [ A_AXIS ] ;
steps_dist_mm . b = ( db - da ) * mm_per_step [ B_AXIS ] ;
# else
# else
LINEAR_AXIS_CODE (
LINEAR_AXIS_CODE (
steps_dist_mm . a = da * mm_per_step [ A_AXIS ] ,
steps_dist_mm . a = da * mm_per_step [ A_AXIS ] ,
@ -2082,7 +2087,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
block - > millimeters = millimeters ;
block - > millimeters = millimeters ;
else {
else {
block - > millimeters = SQRT (
block - > millimeters = SQRT (
# if EITHER(CORE_IS_XY, MARKFORGED_XY )
# if ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX )
LINEAR_AXIS_GANG (
LINEAR_AXIS_GANG (
sq ( steps_dist_mm . head . x ) , + sq ( steps_dist_mm . head . y ) , + sq ( steps_dist_mm . z ) ,
sq ( steps_dist_mm . head . x ) , + sq ( steps_dist_mm . head . y ) , + sq ( steps_dist_mm . z ) ,
+ sq ( steps_dist_mm . i ) , + sq ( steps_dist_mm . j ) , + sq ( steps_dist_mm . k )
+ sq ( steps_dist_mm . i ) , + sq ( steps_dist_mm . j ) , + sq ( steps_dist_mm . k )
@ -2161,7 +2166,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
# endif
# endif
// Enable active axes
// Enable active axes
# if EITHER(CORE_IS_XY, MARKFORGED_XY )
# if ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX )
if ( block - > steps . a | | block - > steps . b ) {
if ( block - > steps . a | | block - > steps . b ) {
stepper . enable_axis ( X_AXIS ) ;
stepper . enable_axis ( X_AXIS ) ;
stepper . enable_axis ( Y_AXIS ) ;
stepper . enable_axis ( Y_AXIS ) ;
@ -2191,7 +2196,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
if ( block - > steps . k ) stepper . enable_axis ( K_AXIS )
if ( block - > steps . k ) stepper . enable_axis ( K_AXIS )
) ;
) ;
# endif
# endif
# if EITHER(IS_CORE, MARKFORGED_XY )
# if ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX )
# if LINEAR_AXES >= 4
# if LINEAR_AXES >= 4
if ( block - > steps . i ) stepper . enable_axis ( I_AXIS ) ;
if ( block - > steps . i ) stepper . enable_axis ( I_AXIS ) ;
# endif
# endif
@ -2549,7 +2554,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
* = > normalize the complete junction vector .
* = > normalize the complete junction vector .
* Elsewise , when needed JD will factor - in the E component
* Elsewise , when needed JD will factor - in the E component
*/
*/
if ( EITHER ( IS_CORE , MARKFORGED_XY ) | | esteps > 0 )
if ( ANY ( IS_CORE , MARKFORGED_XY , MARKFORGED_YX ) | | esteps > 0 )
normalize_junction_vector ( unit_vec ) ; // Normalize with XYZE components
normalize_junction_vector ( unit_vec ) ; // Normalize with XYZE components
else
else
unit_vec * = inverse_millimeters ; // Use pre-calculated (1 / SQRT(x^2 + y^2 + z^2))
unit_vec * = inverse_millimeters ; // Use pre-calculated (1 / SQRT(x^2 + y^2 + z^2))