Add custom types for position (#15204)

This commit is contained in:
Scott Lahteine
2019-09-29 04:25:39 -05:00
committed by GitHub
parent 43d6e9fa43
commit 50e4545255
227 changed files with 3147 additions and 3264 deletions

View File

@ -36,9 +36,9 @@
bool GcodeSuite::select_coordinate_system(const int8_t _new) {
if (active_coordinate_system == _new) return false;
active_coordinate_system = _new;
float new_offset[XYZ] = { 0 };
xyz_float_t new_offset{0};
if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1))
COPY(new_offset, coordinate_system[_new]);
new_offset = coordinate_system[_new];
LOOP_XYZ(i) {
if (position_shift[i] != new_offset[i]) {
position_shift[i] = new_offset[i];

View File

@ -86,7 +86,7 @@ void GcodeSuite::G92() {
#elif HAS_POSITION_SHIFT
if (i == E_AXIS) {
didE = true;
current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly
current_position.e = v; // When using coordinate spaces, only E is set directly
}
else {
position_shift[i] += d; // Other axes simply offset the coordinate space
@ -102,7 +102,7 @@ void GcodeSuite::G92() {
#if ENABLED(CNC_COORDINATE_SYSTEMS)
// Apply workspace offset to the active coordinate system
if (WITHIN(active_coordinate_system, 0, MAX_COORDINATE_SYSTEMS - 1))
COPY(coordinate_system[active_coordinate_system], position_shift);
coordinate_system[active_coordinate_system] = position_shift;
#endif
if (didXYZ) sync_plan_position();

View File

@ -63,7 +63,7 @@ void GcodeSuite::M206() {
void GcodeSuite::M428() {
if (axis_unhomed_error()) return;
float diff[XYZ];
xyz_float_t diff;
LOOP_XYZ(i) {
diff[i] = base_home_pos((AxisEnum)i) - current_position[i];
if (!WITHIN(diff[i], -20, 20) && home_dir((AxisEnum)i) > 0)