Move axis_homed, axis_known_position to motion.*

This commit is contained in:
Scott Lahteine
2018-10-31 17:07:52 -05:00
parent 946cf8b453
commit 44f2a82a56
9 changed files with 31 additions and 31 deletions

View File

@ -73,7 +73,7 @@ void recalc_delta_settings() {
delta_diagonal_rod_2_tower[B_AXIS] = sq(delta_diagonal_rod + drt[B_AXIS]);
delta_diagonal_rod_2_tower[C_AXIS] = sq(delta_diagonal_rod + drt[C_AXIS]);
update_software_endstops(Z_AXIS);
axis_homed = 0;
set_all_unhomed();
}
/**

View File

@ -68,6 +68,17 @@ XYZ_CONSTS(float, max_length, MAX_LENGTH);
XYZ_CONSTS(float, home_bump_mm, HOME_BUMP_MM);
XYZ_CONSTS(signed char, home_dir, HOME_DIR);
/**
* axis_homed
* Flags that each linear axis was homed.
* XYZ on cartesian, ABC on delta, ABZ on SCARA.
*
* axis_known_position
* Flags that the position is known in each linear axis. Set when homed.
* Cleared whenever a stepper powers off, potentially losing its position.
*/
uint8_t axis_homed, axis_known_position; // = 0
// Relative Mode. Enable with G91, disable with G90.
bool relative_mode; // = false;

View File

@ -26,9 +26,7 @@
* High-level motion commands to feed the planner
* Some of these methods may migrate to the planner class.
*/
#ifndef MOTION_H
#define MOTION_H
#pragma once
#include "../inc/MarlinConfig.h"
@ -36,6 +34,14 @@
#include "../module/scara.h"
#endif
// Axis homed and known-position states
extern uint8_t axis_homed, axis_known_position;
constexpr uint8_t xyz_bits = _BV(X_AXIS) | _BV(Y_AXIS) | _BV(Z_AXIS);
FORCE_INLINE bool all_axes_homed() { return (axis_homed & xyz_bits) == xyz_bits; }
FORCE_INLINE bool all_axes_known() { return (axis_known_position & xyz_bits) == xyz_bits; }
FORCE_INLINE void set_all_unhomed() { axis_homed = 0; }
FORCE_INLINE void set_all_unknown() { axis_known_position = 0; }
// Error margin to work around float imprecision
constexpr float slop = 0.0001;
@ -359,5 +365,3 @@ void homeaxis(const AxisEnum axis);
#if HAS_M206_COMMAND
void set_home_offset(const AxisEnum axis, const float v);
#endif
#endif // MOTION_H