From ab09b8906f51e094e699d9894b769f0de2b4ec43 Mon Sep 17 00:00:00 2001 From: Alden Hart Date: Mon, 2 Jan 2017 10:24:29 -0500 Subject: [PATCH] Fixes and regressions for G28/G30 operating in absolute_distance_mode; Most of the files are the change from ABSOLUTE_MODE to ABSOLUTE_DISTANCE_MODE and similar for INCREMENTAL_MODE. --- g2core/canonical_machine.cpp | 56 ++++++++++--------- g2core/canonical_machine.h | 8 +-- g2core/cycle_homing.cpp | 2 +- g2core/cycle_jogging.cpp | 2 +- g2core/cycle_probing.cpp | 4 +- g2core/gcode_parser.cpp | 8 +-- g2core/plan_arc.cpp | 4 +- g2core/settings/settings_Printrbot_Play.h | 2 +- g2core/settings/settings_Printrbot_Plus.h | 2 +- .../settings/settings_Printrbot_Simple_1403.h | 2 +- .../settings/settings_Printrbot_Simple_1608.h | 2 +- g2core/settings/settings_Ultimaker.h | 2 +- g2core/settings/settings_default.h | 2 +- g2core/settings/settings_makeblock.h | 2 +- g2core/settings/settings_othermill.h | 2 +- g2core/settings/settings_othermill_test.h | 2 +- g2core/settings/settings_probotixV90.h | 2 +- g2core/settings/settings_shapeoko2.h | 2 +- g2core/settings/settings_shopbot_sbv300.h | 2 +- g2core/settings/settings_shopbot_test.h | 2 +- g2core/settings/settings_test.h | 2 +- 21 files changed, 57 insertions(+), 55 deletions(-) mode change 100755 => 100644 g2core/cycle_homing.cpp mode change 100755 => 100644 g2core/cycle_jogging.cpp mode change 100755 => 100644 g2core/cycle_probing.cpp mode change 100755 => 100644 g2core/settings/settings_Printrbot_Play.h mode change 100755 => 100644 g2core/settings/settings_Printrbot_Plus.h mode change 100755 => 100644 g2core/settings/settings_Printrbot_Simple_1403.h mode change 100755 => 100644 g2core/settings/settings_Printrbot_Simple_1608.h mode change 100755 => 100644 g2core/settings/settings_Ultimaker.h mode change 100755 => 100644 g2core/settings/settings_othermill.h mode change 100755 => 100644 g2core/settings/settings_othermill_test.h mode change 100755 => 100644 g2core/settings/settings_probotixV90.h mode change 100755 => 100644 g2core/settings/settings_shapeoko2.h mode change 100755 => 100644 g2core/settings/settings_shopbot_sbv300.h mode change 100755 => 100644 g2core/settings/settings_shopbot_test.h mode change 100755 => 100644 g2core/settings/settings_test.h diff --git a/g2core/canonical_machine.cpp b/g2core/canonical_machine.cpp index 2740d814..1d07d2ae 100644 --- a/g2core/canonical_machine.cpp +++ b/g2core/canonical_machine.cpp @@ -610,7 +610,7 @@ void cm_set_model_target(const float target[], const bool flags[]) if (!flags[axis] || cm.a[axis].axis_mode == AXIS_DISABLED) { continue; // skip axis if not flagged for update or its disabled } else if ((cm.a[axis].axis_mode == AXIS_STANDARD) || (cm.a[axis].axis_mode == AXIS_INHIBITED)) { - if (cm.gm.distance_mode == ABSOLUTE_MODE) { + if (cm.gm.distance_mode == ABSOLUTE_DISTANCE_MODE) { cm.gm.target[axis] = cm_get_active_coord_offset(axis) + _to_millimeters(target[axis]); } else { cm.gm.target[axis] += _to_millimeters(target[axis]); @@ -624,7 +624,7 @@ void cm_set_model_target(const float target[], const bool flags[]) } else { tmp = _calc_ABC(axis, target); } - if (cm.gm.distance_mode == ABSOLUTE_MODE) { + if (cm.gm.distance_mode == ABSOLUTE_DISTANCE_MODE) { cm.gm.target[axis] = tmp + cm_get_active_coord_offset(axis); // sacidu93's fix to Issue #22 } else { cm.gm.target[axis] += tmp; @@ -719,7 +719,7 @@ void canonical_machine_reset() cm_select_plane(cm.default_select_plane); cm_set_path_control(MODEL, cm.default_path_control); cm_set_distance_mode(cm.default_distance_mode); - cm_set_arc_distance_mode(INCREMENTAL_MODE); // always the default + cm_set_arc_distance_mode(INCREMENTAL_DISTANCE_MODE); // always the default cm_set_feed_rate_mode(UNITS_PER_MINUTE_MODE); // always the default cm_reset_overrides(); // set overrides to initial conditions @@ -1327,39 +1327,41 @@ stat_t cm_straight_traverse(const float target[], const bool flags[]) } /* - * cm_set_g28_position() - G28.1 - * cm_goto_g28_position() - G28 - * cm_set_g30_position() - G30.1 - * cm_goto_g30_position() - G30 + * cm_set_g28_position() - G28.1 + * cm_goto_g28_position() - G28 + * cm_set_g30_position() - G30.1 + * cm_goto_g30_position() - G30 + * _goto_stored_position() - helper */ -stat_t _goto_stored_position(const float stored_position[], // always in mm - const float intermediate_target[], // in current units - const bool flags[]) // all false if no intermediate move +stat_t _goto_stored_position(const float stored_position[], // always in mm + const float intermediate_target[], // in current units (G20/G21) + const bool flags[]) // all false if no intermediate move { // Go through intermediate point if one is provided - while (mp_planner_is_full()); // Make sure you have available buffers - ritorno(cm_straight_traverse(intermediate_target, flags)); + while (mp_planner_is_full()); // Make sure you have available buffers + ritorno(cm_straight_traverse(intermediate_target, flags)); // w/no action if no axis flags - float target[AXES]; // need a local stored position as it gets modified + // If G20 adjust stored position (always in mm) to inches so traverse will be correct + float target[AXES]; // make a local stored position as it may be modified copy_vector(target, stored_position); + if (cm.gm.units_mode == INCHES) { + for (uint8_t i=0; i