Option to show babysteps total since G28 (#13580)

This commit is contained in:
Roxy-3D
2019-04-06 18:04:34 -05:00
committed by Scott Lahteine
parent 3221658a78
commit 9cee81d47e
91 changed files with 443 additions and 123 deletions

View File

@ -63,6 +63,10 @@
#include "../feature/fwretract.h"
#endif
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
#include "../feature/babystep.h"
#endif
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../core/debug_out.h"
@ -1316,6 +1320,14 @@ void set_axis_is_at_home(const AxisEnum axis) {
}
#endif
#if ENABLED(I2C_POSITION_ENCODERS)
I2CPEM.homed(axis);
#endif
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
babystep.reset_total(axis);
#endif
if (DEBUGGING(LEVELING)) {
#if HAS_HOME_OFFSET
DEBUG_ECHOLNPAIR("> home_offset[", axis_codes[axis], "] = ", home_offset[axis]);
@ -1323,10 +1335,6 @@ void set_axis_is_at_home(const AxisEnum axis) {
DEBUG_POS("", current_position);
DEBUG_ECHOLNPAIR("<<< set_axis_is_at_home(", axis_codes[axis], ")");
}
#if ENABLED(I2C_POSITION_ENCODERS)
I2CPEM.homed(axis);
#endif
}
/**

View File

@ -44,7 +44,7 @@
#endif
#if ENABLED(BABYSTEPPING)
#include "../module/motion.h"
#include "../feature/babystep.h"
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
#include "../gcode/gcode.h"
#endif
@ -239,10 +239,6 @@ hotend_info_t Temperature::temp_hotend[HOTENDS]; // = { 0 }
//hotend_pid_t Temperature::pid[HOTENDS];
#endif
#if ENABLED(BABYSTEPPING)
volatile int16_t Temperature::babystepsTodo[XYZ] = { 0 };
#endif
#if ENABLED(PREVENT_COLD_EXTRUSION)
bool Temperature::allow_cold_extrude = false;
int16_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
@ -2516,21 +2512,7 @@ void Temperature::isr() {
//
#if ENABLED(BABYSTEPPING)
#if EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS)
LOOP_XYZ(axis) {
const int16_t curTodo = babystepsTodo[axis]; // get rid of volatile for performance
if (curTodo) {
stepper.babystep((AxisEnum)axis, curTodo > 0);
if (curTodo > 0) babystepsTodo[axis]--; else babystepsTodo[axis]++;
}
}
#else
const int16_t curTodo = babystepsTodo[Z_AXIS];
if (curTodo) {
stepper.babystep(Z_AXIS, curTodo > 0);
if (curTodo > 0) babystepsTodo[Z_AXIS]--; else babystepsTodo[Z_AXIS]++;
}
#endif
babystep.task();
#endif
// Poll endstops state, if required
@ -2540,70 +2522,6 @@ void Temperature::isr() {
planner.tick();
}
#if ENABLED(BABYSTEPPING)
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
#define BSA_ENABLE(AXIS) do{ switch (AXIS) { case X_AXIS: enable_X(); break; case Y_AXIS: enable_Y(); break; case Z_AXIS: enable_Z(); } }while(0)
#else
#define BSA_ENABLE(AXIS) NOOP
#endif
#if ENABLED(BABYSTEP_WITHOUT_HOMING)
#define CAN_BABYSTEP(AXIS) true
#else
#define CAN_BABYSTEP(AXIS) TEST(axis_known_position, AXIS)
#endif
extern uint8_t axis_known_position;
void Temperature::babystep_axis(const AxisEnum axis, const int16_t distance) {
if (!CAN_BABYSTEP(axis)) return;
#if IS_CORE
#if ENABLED(BABYSTEP_XY)
switch (axis) {
case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ
BSA_ENABLE(CORE_AXIS_1);
BSA_ENABLE(CORE_AXIS_2);
babystepsTodo[CORE_AXIS_1] += distance * 2;
babystepsTodo[CORE_AXIS_2] += distance * 2;
break;
case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ
BSA_ENABLE(CORE_AXIS_1);
BSA_ENABLE(CORE_AXIS_2);
babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2);
babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2);
break;
case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ
default:
BSA_ENABLE(NORMAL_AXIS);
babystepsTodo[NORMAL_AXIS] += distance;
break;
}
#elif CORE_IS_XZ || CORE_IS_YZ
// Only Z stepping needs to be handled here
BSA_ENABLE(CORE_AXIS_1);
BSA_ENABLE(CORE_AXIS_2);
babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2);
babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2);
#else
BSA_ENABLE(Z_AXIS);
babystepsTodo[Z_AXIS] += distance;
#endif
#else
#if ENABLED(BABYSTEP_XY)
BSA_ENABLE(axis);
#else
BSA_ENABLE(Z_AXIS);
#endif
babystepsTodo[axis] += distance;
#endif
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
gcode.reset_stepper_timeout();
#endif
}
#endif // BABYSTEPPING
#if HAS_TEMP_SENSOR
#include "../gcode/gcode.h"

View File

@ -266,10 +266,6 @@ class Temperature {
soft_pwm_count_fan[FAN_COUNT];
#endif
#if ENABLED(BABYSTEPPING)
static volatile int16_t babystepsTodo[3];
#endif
#if ENABLED(PREVENT_COLD_EXTRUSION)
static bool allow_cold_extrude;
static int16_t extrude_min_temp;
@ -689,10 +685,6 @@ class Temperature {
#endif
#if ENABLED(BABYSTEPPING)
static void babystep_axis(const AxisEnum axis, const int16_t distance);
#endif
#if ENABLED(PROBING_HEATERS_OFF)
static void pause(const bool p);
FORCE_INLINE static bool is_paused() { return paused; }