1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-30 15:26:18 +00:00

Cosmetic updates from 14044

This commit is contained in:
Scott Lahteine 2019-07-24 01:52:36 -05:00
parent 05f4033a34
commit 1088846cae
10 changed files with 36 additions and 45 deletions

View File

@ -687,9 +687,12 @@ void idle(
#if ENABLED(I2C_POSITION_ENCODERS) #if ENABLED(I2C_POSITION_ENCODERS)
static millis_t i2cpem_next_update_ms; static millis_t i2cpem_next_update_ms;
if (planner.has_blocks_queued() && ELAPSED(millis(), i2cpem_next_update_ms)) { if (planner.has_blocks_queued()) {
I2CPEM.update(); const millis_t ms = millis();
i2cpem_next_update_ms = millis() + I2CPE_MIN_UPD_TIME_MS; if (ELAPSED(ms, i2cpem_next_update_ms)) {
I2CPEM.update();
i2cpem_next_update_ms = ms + I2CPE_MIN_UPD_TIME_MS;
}
} }
#endif #endif

View File

@ -348,17 +348,15 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
#endif #endif
/** /**
* TMC2130 specific sensorless homing using stallGuard2. * TMC2130-specific sensorless homing using stallGuard2.
* stallGuard2 only works when in spreadCycle mode. * stallGuard2 only works when in spreadCycle mode.
* spreadCycle and stealthChop are mutually exclusive. * spreadCycle and stealthChop are mutually-exclusive.
* *
* Defined here because of limitations with templates and headers. * Defined here because of limitations with templates and headers.
*/ */
#if USE_SENSORLESS #if USE_SENSORLESS
// Track enabled status of stealthChop and only re-enable where applicable // Track enabled status of stealthChop and only re-enable where applicable
struct sensorless_t { struct sensorless_t { bool x, y, z, x2, y2, z2, z3; };
bool x, y, z, x2, y2, z2, z3;
};
bool tmc_enable_stallguard(TMC2130Stepper &st); bool tmc_enable_stallguard(TMC2130Stepper &st);
void tmc_disable_stallguard(TMC2130Stepper &st, const bool restore_stealth); void tmc_disable_stallguard(TMC2130Stepper &st, const bool restore_stealth);

View File

@ -78,7 +78,7 @@
fr_mm_s = _MIN(homing_feedrate(X_AXIS), homing_feedrate(Y_AXIS)) * SQRT(sq(mlratio) + 1.0); fr_mm_s = _MIN(homing_feedrate(X_AXIS), homing_feedrate(Y_AXIS)) * SQRT(sq(mlratio) + 1.0);
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
sensorless_t stealth_states { false, false, false, false, false, false, false }; sensorless_t stealth_states { false };
stealth_states.x = tmc_enable_stallguard(stepperX); stealth_states.x = tmc_enable_stallguard(stepperX);
stealth_states.y = tmc_enable_stallguard(stepperY); stealth_states.y = tmc_enable_stallguard(stepperY);
#if AXIS_HAS_STALLGUARD(X2) #if AXIS_HAS_STALLGUARD(X2)

View File

@ -65,7 +65,7 @@ void GcodeSuite::M201() {
planner.settings.max_acceleration_mm_per_s2[a] = parser.value_axis_units((AxisEnum)a); planner.settings.max_acceleration_mm_per_s2[a] = parser.value_axis_units((AxisEnum)a);
} }
} }
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
planner.reset_acceleration_rates(); planner.reset_acceleration_rates();
} }

View File

@ -2060,22 +2060,24 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#if ENABLED(DELTA) && !BOTH(STEALTHCHOP_XY, STEALTHCHOP_Z) #if ENABLED(DELTA) && !BOTH(STEALTHCHOP_XY, STEALTHCHOP_Z)
#error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP_XY and STEALTHCHOP_Z." #error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP_XY and STEALTHCHOP_Z."
#elif X_SENSORLESS && X_HOME_DIR == -1 && (X_MIN_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMIN))
#error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMIN when homing to X_MIN."
#elif X_SENSORLESS && X_HOME_DIR == 1 && (X_MAX_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMAX))
#error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMAX when homing to X_MAX."
#elif Y_SENSORLESS && Y_HOME_DIR == -1 && (Y_MIN_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMIN))
#error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMIN when homing to Y_MIN."
#elif Y_SENSORLESS && Y_HOME_DIR == 1 && (Y_MAX_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMAX))
#error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMAX when homing to Y_MAX."
#elif Z_SENSORLESS && Z_HOME_DIR == -1 && (Z_MIN_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMIN))
#error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMIN when homing to Z_MIN."
#elif Z_SENSORLESS && Z_HOME_DIR == 1 && (Z_MAX_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMAX))
#error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMAX when homing to Z_MAX."
#elif ENDSTOP_NOISE_THRESHOLD #elif ENDSTOP_NOISE_THRESHOLD
#error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_THRESHOLD." #error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_THRESHOLD."
#elif !(X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS) #elif !(X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS)
#error "SENSORLESS_HOMING requires a TMC stepper driver with StallGuard on X, Y, or Z axes." #error "SENSORLESS_HOMING requires a TMC stepper driver with StallGuard on X, Y, or Z axes."
#elif DISABLED(SPI_ENDSTOPS)
#if X_SENSORLESS && X_HOME_DIR < 0 && (X_MIN_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMIN))
#error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMIN when homing to X_MIN."
#elif X_SENSORLESS && X_HOME_DIR > 0 && (X_MAX_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMAX))
#error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMAX when homing to X_MAX."
#elif Y_SENSORLESS && Y_HOME_DIR < 0 && (Y_MIN_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMIN))
#error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMIN when homing to Y_MIN."
#elif Y_SENSORLESS && Y_HOME_DIR > 0 && (Y_MAX_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMAX))
#error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMAX when homing to Y_MAX."
#elif Z_SENSORLESS && Z_HOME_DIR < 0 && (Z_MIN_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMIN))
#error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMIN when homing to Z_MIN."
#elif Z_SENSORLESS && Z_HOME_DIR > 0 && (Z_MAX_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMAX))
#error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMAX when homing to Z_MAX."
#endif
#endif #endif
#undef X_ENDSTOP_INVERTING #undef X_ENDSTOP_INVERTING

View File

@ -227,7 +227,7 @@ void home_delta() {
// Disable stealthChop if used. Enable diag1 pin on driver. // Disable stealthChop if used. Enable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
sensorless_t stealth_states { false, false, false, false, false, false, false }; sensorless_t stealth_states { false };
stealth_states.x = tmc_enable_stallguard(stepperX); stealth_states.x = tmc_enable_stallguard(stepperX);
stealth_states.y = tmc_enable_stallguard(stepperY); stealth_states.y = tmc_enable_stallguard(stepperY);
stealth_states.z = tmc_enable_stallguard(stepperZ); stealth_states.z = tmc_enable_stallguard(stepperZ);

View File

@ -783,14 +783,13 @@ void Endstops::update() {
bool Endstops::monitor_flag = false; bool Endstops::monitor_flag = false;
/** /**
* monitors endstops & Z probe for changes * Monitor Endstops and Z Probe for changes
* *
* If a change is detected then the LED is toggled and * If a change is detected then the LED is toggled and
* a message is sent out the serial port * a message is sent out the serial port.
* *
* Yes, we could miss a rapid back & forth change but * Yes, we could miss a rapid back & forth change but
* that won't matter because this is all manual. * that won't matter because this is all manual.
*
*/ */
void Endstops::monitor() { void Endstops::monitor() {

View File

@ -29,27 +29,16 @@
#include <stdint.h> #include <stdint.h>
enum EndstopEnum : char { enum EndstopEnum : char {
X_MIN, X_MIN, Y_MIN, Z_MIN, Z_MIN_PROBE,
Y_MIN, X_MAX, Y_MAX, Z_MAX,
Z_MIN, X2_MIN, X2_MAX,
Z_MIN_PROBE, Y2_MIN, Y2_MAX,
X_MAX, Z2_MIN, Z2_MAX,
Y_MAX, Z3_MIN, Z3_MAX
Z_MAX,
X2_MIN,
X2_MAX,
Y2_MIN,
Y2_MAX,
Z2_MIN,
Z2_MAX,
Z3_MIN,
Z3_MAX
}; };
class Endstops { class Endstops {
public: public:
#if HAS_EXTRA_ENDSTOPS #if HAS_EXTRA_ENDSTOPS
typedef uint16_t esbits_t; typedef uint16_t esbits_t;
#if ENABLED(X_DUAL_ENDSTOPS) #if ENABLED(X_DUAL_ENDSTOPS)

View File

@ -1071,7 +1071,7 @@ float get_homing_bump_feedrate(const AxisEnum axis) {
* Set sensorless homing if the axis has it, accounting for Core Kinematics. * Set sensorless homing if the axis has it, accounting for Core Kinematics.
*/ */
sensorless_t start_sensorless_homing_per_axis(const AxisEnum axis) { sensorless_t start_sensorless_homing_per_axis(const AxisEnum axis) {
sensorless_t stealth_states { false, false, false, false, false, false, false }; sensorless_t stealth_states { false };
switch (axis) { switch (axis) {
default: break; default: break;

View File

@ -540,7 +540,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
// Disable stealthChop if used. Enable diag1 pin on driver. // Disable stealthChop if used. Enable diag1 pin on driver.
#if ENABLED(SENSORLESS_PROBING) #if ENABLED(SENSORLESS_PROBING)
sensorless_t stealth_states { false, false, false, false, false, false, false }; sensorless_t stealth_states { false };
#if ENABLED(DELTA) #if ENABLED(DELTA)
stealth_states.x = tmc_enable_stallguard(stepperX); stealth_states.x = tmc_enable_stallguard(stepperX);
stealth_states.y = tmc_enable_stallguard(stepperY); stealth_states.y = tmc_enable_stallguard(stepperY);