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