Browse Source

Merge pull request #3222 from thinkyhead/rc_persist_endstop_enabling

M120/M121 also set endstops non-homing state
pull/1/head
Scott Lahteine 9 years ago
parent
commit
d62ba3d87e
  1. 20
      Marlin/Marlin_main.cpp
  2. 19
      Marlin/stepper.cpp
  3. 3
      Marlin/stepper.h

20
Marlin/Marlin_main.cpp

@ -1475,14 +1475,12 @@ static void setup_for_endstop_move() {
inline void raise_z_after_probing() { do_blocking_move_to_z(current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING); } inline void raise_z_after_probing() { do_blocking_move_to_z(current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING); }
static void clean_up_after_endstop_move() { static void clean_up_after_endstop_move() {
#if ENABLED(ENDSTOPS_ONLY_FOR_HOMING) #if ENABLED(DEBUG_LEVELING_FEATURE)
#if ENABLED(DEBUG_LEVELING_FEATURE) if (marlin_debug_flags & DEBUG_LEVELING) {
if (marlin_debug_flags & DEBUG_LEVELING) { SERIAL_ECHOLNPGM("clean_up_after_endstop_move > ENDSTOPS_ONLY_FOR_HOMING > endstops_not_homing()");
SERIAL_ECHOLNPGM("clean_up_after_endstop_move > ENDSTOPS_ONLY_FOR_HOMING > enable_endstops(false)"); }
}
#endif
enable_endstops(false);
#endif #endif
endstops_not_homing();
feedrate = saved_feedrate; feedrate = saved_feedrate;
feedrate_multiplier = saved_feedrate_multiplier; feedrate_multiplier = saved_feedrate_multiplier;
refresh_cmd_timeout(); refresh_cmd_timeout();
@ -4585,14 +4583,14 @@ inline void gcode_M119() {
} }
/** /**
* M120: Enable endstops * M120: Enable endstops and set non-homing endstop state to "enabled"
*/ */
inline void gcode_M120() { enable_endstops(true); } inline void gcode_M120() { enable_endstops_globally(true); }
/** /**
* M121: Disable endstops * M121: Disable endstops and set non-homing endstop state to "disabled"
*/ */
inline void gcode_M121() { enable_endstops(false); } inline void gcode_M121() { enable_endstops_globally(false); }
#if ENABLED(BLINKM) #if ENABLED(BLINKM)

19
Marlin/stepper.cpp

@ -99,6 +99,13 @@ static volatile char endstop_hit_bits = 0; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_
#endif #endif
static bool check_endstops = true; static bool check_endstops = true;
static bool check_endstops_global =
#if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
false
#else
true
#endif
;
volatile long count_position[NUM_AXIS] = { 0 }; // Positions of stepper motors, in step units volatile long count_position[NUM_AXIS] = { 0 }; // Positions of stepper motors, in step units
volatile signed char count_direction[NUM_AXIS] = { 1 }; volatile signed char count_direction[NUM_AXIS] = { 1 };
@ -252,9 +259,13 @@ volatile signed char count_direction[NUM_AXIS] = { 1 };
#define ENABLE_STEPPER_DRIVER_INTERRUPT() SBI(TIMSK1, OCIE1A) #define ENABLE_STEPPER_DRIVER_INTERRUPT() SBI(TIMSK1, OCIE1A)
#define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A) #define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
void endstops_hit_on_purpose() { void enable_endstops(bool check) { check_endstops = check; }
endstop_hit_bits = 0;
} void enable_endstops_globally(bool check) { check_endstops_global = check_endstops = check; }
void endstops_not_homing() { check_endstops = check_endstops_global; }
void endstops_hit_on_purpose() { endstop_hit_bits = 0; }
void checkHitEndstops() { void checkHitEndstops() {
if (endstop_hit_bits) { if (endstop_hit_bits) {
@ -293,8 +304,6 @@ void checkHitEndstops() {
} }
} }
void enable_endstops(bool check) { check_endstops = check; }
// Check endstops - Called from ISR! // Check endstops - Called from ISR!
inline void update_endstops() { inline void update_endstops() {

3
Marlin/stepper.h

@ -54,6 +54,9 @@ void endstops_hit_on_purpose(); //avoid creation of the message, i.e. after homi
void enable_endstops(bool check); // Enable/disable endstop checking void enable_endstops(bool check); // Enable/disable endstop checking
void enable_endstops_globally(bool check);
void endstops_not_homing();
void checkStepperErrors(); //Print errors detected by the stepper void checkStepperErrors(); //Print errors detected by the stepper
void finishAndDisableSteppers(); void finishAndDisableSteppers();

Loading…
Cancel
Save