@@ -415,38 +415,41 @@ void restore_feedrate_and_scaling();
415
415
/* *
416
416
* Homing and Trusted Axes
417
417
*/
418
- typedef IF<(NUM_AXES > 8 ), uint16_t, uint8_t>::type linear_axis_bits_t;
419
- constexpr linear_axis_bits_t linear_bits = _BV(NUM_AXES) - 1 ;
418
+ typedef IF<(NUM_AXES > 8 ), uint16_t, uint8_t>::type main_axes_bits_t;
419
+ constexpr main_axes_bits_t main_axes_mask = _BV(NUM_AXES) - 1 ;
420
+
421
+ typedef IF<(NUM_AXES + EXTRUDERS > 8 ), uint16_t , uint8_t >::type e_axis_bits_t ;
422
+ constexpr e_axis_bits_t e_axis_mask = (_BV(EXTRUDERS) - 1 ) << NUM_AXES;
420
423
421
424
void set_axis_is_at_home (const AxisEnum axis);
422
425
423
426
#if HAS_ENDSTOPS
424
427
/* *
425
- * axis_homed
428
+ * axes_homed
426
429
* Flags that each linear axis was homed.
427
430
* XYZ on cartesian, ABC on delta, ABZ on SCARA.
428
431
*
429
- * axis_trusted
432
+ * axes_trusted
430
433
* Flags that the position is trusted in each linear axis. Set when homed.
431
434
* Cleared whenever a stepper powers off, potentially losing its position.
432
435
*/
433
- extern linear_axis_bits_t axis_homed, axis_trusted ;
436
+ extern main_axes_bits_t axes_homed, axes_trusted ;
434
437
void homeaxis (const AxisEnum axis);
435
438
void set_axis_never_homed (const AxisEnum axis);
436
- linear_axis_bits_t axes_should_home (linear_axis_bits_t axis_bits=linear_bits );
437
- bool homing_needed_error (linear_axis_bits_t axis_bits=linear_bits );
438
- inline void set_axis_unhomed (const AxisEnum axis) { CBI (axis_homed , axis); }
439
- inline void set_axis_untrusted (const AxisEnum axis) { CBI (axis_trusted , axis); }
440
- inline void set_all_unhomed () { axis_homed = axis_trusted = 0 ; }
441
- inline void set_axis_homed (const AxisEnum axis) { SBI (axis_homed , axis); }
442
- inline void set_axis_trusted (const AxisEnum axis) { SBI (axis_trusted , axis); }
443
- inline void set_all_homed () { axis_homed = axis_trusted = linear_bits ; }
439
+ main_axes_bits_t axes_should_home (main_axes_bits_t axes_mask=main_axes_mask );
440
+ bool homing_needed_error (main_axes_bits_t axes_mask=main_axes_mask );
441
+ inline void set_axis_unhomed (const AxisEnum axis) { CBI (axes_homed , axis); }
442
+ inline void set_axis_untrusted (const AxisEnum axis) { CBI (axes_trusted , axis); }
443
+ inline void set_all_unhomed () { axes_homed = axes_trusted = 0 ; }
444
+ inline void set_axis_homed (const AxisEnum axis) { SBI (axes_homed , axis); }
445
+ inline void set_axis_trusted (const AxisEnum axis) { SBI (axes_trusted , axis); }
446
+ inline void set_all_homed () { axes_homed = axes_trusted = main_axes_mask ; }
444
447
#else
445
- constexpr linear_axis_bits_t axis_homed = linear_bits, axis_trusted = linear_bits ; // Zero-endstop machines are always homed and trusted
448
+ constexpr main_axes_bits_t axes_homed = main_axes_mask, axes_trusted = main_axes_mask ; // Zero-endstop machines are always homed and trusted
446
449
inline void homeaxis (const AxisEnum axis) {}
447
450
inline void set_axis_never_homed (const AxisEnum) {}
448
- inline linear_axis_bits_t axes_should_home (linear_axis_bits_t =linear_bits ) { return 0 ; }
449
- inline bool homing_needed_error (linear_axis_bits_t =linear_bits ) { return false ; }
451
+ inline main_axes_bits_t axes_should_home (main_axes_bits_t =main_axes_mask ) { return 0 ; }
452
+ inline bool homing_needed_error (main_axes_bits_t =main_axes_mask ) { return false ; }
450
453
inline void set_axis_unhomed (const AxisEnum axis) {}
451
454
inline void set_axis_untrusted (const AxisEnum axis) {}
452
455
inline void set_all_unhomed () {}
@@ -455,13 +458,13 @@ void set_axis_is_at_home(const AxisEnum axis);
455
458
inline void set_all_homed () {}
456
459
#endif
457
460
458
- inline bool axis_was_homed (const AxisEnum axis) { return TEST (axis_homed , axis); }
459
- inline bool axis_is_trusted (const AxisEnum axis) { return TEST (axis_trusted , axis); }
461
+ inline bool axis_was_homed (const AxisEnum axis) { return TEST (axes_homed , axis); }
462
+ inline bool axis_is_trusted (const AxisEnum axis) { return TEST (axes_trusted , axis); }
460
463
inline bool axis_should_home (const AxisEnum axis) { return (axes_should_home () & _BV (axis)) != 0 ; }
461
- inline bool no_axes_homed () { return !axis_homed ; }
462
- inline bool all_axes_homed () { return linear_bits == (axis_homed & linear_bits ); }
464
+ inline bool no_axes_homed () { return !axes_homed ; }
465
+ inline bool all_axes_homed () { return main_axes_mask == (axes_homed & main_axes_mask ); }
463
466
inline bool homing_needed () { return !all_axes_homed (); }
464
- inline bool all_axes_trusted () { return linear_bits == (axis_trusted & linear_bits ); }
467
+ inline bool all_axes_trusted () { return main_axes_mask == (axes_trusted & main_axes_mask ); }
465
468
466
469
void home_if_needed (const bool keeplev=false );
467
470
0 commit comments