@@ -287,9 +287,9 @@ void mc_homing_cycle()
|
||||
// Perform tool length probe cycle. Requires probe switch.
|
||||
// NOTE: Upon probe failure, the program will be stopped and placed into ALARM state.
|
||||
#ifdef USE_LINE_NUMBERS
|
||||
void mc_probe_cycle(float *target, float feed_rate, uint8_t invert_feed_rate, int32_t line_number)
|
||||
void mc_probe_cycle(float *target, float feed_rate, uint8_t invert_feed_rate, uint8_t mode, int32_t line_number)
|
||||
#else
|
||||
void mc_probe_cycle(float *target, float feed_rate, uint8_t invert_feed_rate)
|
||||
void mc_probe_cycle(float *target, float feed_rate, uint8_t invert_feed_rate, uint8_t mode)
|
||||
#endif
|
||||
{
|
||||
// TODO: Need to update this cycle so it obeys a non-auto cycle start.
|
||||
@@ -298,9 +298,10 @@ void mc_homing_cycle()
|
||||
// Finish all queued commands and empty planner buffer before starting probe cycle.
|
||||
protocol_buffer_synchronize();
|
||||
uint8_t auto_start_state = sys.auto_start; // Store run state
|
||||
|
||||
uint8_t perform_pull_off = 1;
|
||||
|
||||
// After syncing, check if probe is already triggered. If so, halt and issue alarm.
|
||||
if (probe_get_state()) {
|
||||
if (probe_get_state(mode) && probe_errors_enabled(mode)) {
|
||||
bit_true_atomic(sys.execute, EXEC_CRIT_EVENT);
|
||||
protocol_execute_runtime();
|
||||
}
|
||||
@@ -314,7 +315,7 @@ void mc_homing_cycle()
|
||||
#endif
|
||||
|
||||
// Activate the probing monitor in the stepper module.
|
||||
sys.probe_state = PROBE_ACTIVE;
|
||||
sys.probe_state = PROBE_ACTIVE | mode;
|
||||
|
||||
// Perform probing cycle. Wait here until probe is triggered or motion completes.
|
||||
bit_true_atomic(sys.execute, EXEC_CYCLE_START);
|
||||
@@ -324,7 +325,15 @@ void mc_homing_cycle()
|
||||
} while ((sys.state != STATE_IDLE) && (sys.state != STATE_QUEUED));
|
||||
|
||||
// Probing motion complete. If the probe has not been triggered, error out.
|
||||
if (sys.probe_state == PROBE_ACTIVE) { bit_true_atomic(sys.execute, EXEC_CRIT_EVENT); }
|
||||
if (sys.probe_state & PROBE_ACTIVE) {
|
||||
|
||||
if (probe_errors_enabled(mode)) {
|
||||
bit_true_atomic(sys.execute, EXEC_CRIT_EVENT);
|
||||
} else {
|
||||
perform_pull_off = 0;
|
||||
probe_finalize(0);
|
||||
}
|
||||
}
|
||||
protocol_execute_runtime(); // Check and execute run-time commands
|
||||
if (sys.abort) { return; } // Check for system abort
|
||||
|
||||
@@ -332,24 +341,26 @@ void mc_homing_cycle()
|
||||
st_reset(); // Reest step segment buffer.
|
||||
plan_reset(); // Reset planner buffer. Zero planner positions. Ensure probing motion is cleared.
|
||||
plan_sync_position(); // Sync planner position to current machine position.
|
||||
|
||||
// Pull-off triggered probe to the trigger location since we had to decelerate a little beyond
|
||||
// it to stop the machine in a controlled manner.
|
||||
uint8_t idx;
|
||||
for(idx=0; idx<N_AXIS; idx++){
|
||||
// NOTE: The target[] variable updated here will be sent back and synced with the g-code parser.
|
||||
target[idx] = (float)sys.probe_position[idx]/settings.steps_per_mm[idx];
|
||||
}
|
||||
#ifdef USE_LINE_NUMBERS
|
||||
mc_line(target, feed_rate, invert_feed_rate, line_number);
|
||||
#else
|
||||
mc_line(target, feed_rate, invert_feed_rate);
|
||||
#endif
|
||||
|
||||
// Execute pull-off motion and wait until it completes.
|
||||
bit_true_atomic(sys.execute, EXEC_CYCLE_START);
|
||||
protocol_buffer_synchronize();
|
||||
if (sys.abort) { return; } // Return if system reset has been issued.
|
||||
if (perform_pull_off) {
|
||||
// Pull-off triggered probe to the trigger location since we had to decelerate a little beyond
|
||||
// it to stop the machine in a controlled manner.
|
||||
uint8_t idx;
|
||||
for(idx=0; idx<N_AXIS; idx++){
|
||||
// NOTE: The target[] variable updated here will be sent back and synced with the g-code parser.
|
||||
target[idx] = (float)sys.probe_position[idx]/settings.steps_per_mm[idx];
|
||||
}
|
||||
#ifdef USE_LINE_NUMBERS
|
||||
mc_line(target, feed_rate, invert_feed_rate, line_number);
|
||||
#else
|
||||
mc_line(target, feed_rate, invert_feed_rate);
|
||||
#endif
|
||||
|
||||
// Execute pull-off motion and wait until it completes.
|
||||
bit_true_atomic(sys.execute, EXEC_CYCLE_START);
|
||||
protocol_buffer_synchronize();
|
||||
if (sys.abort) { return; } // Return if system reset has been issued.
|
||||
}
|
||||
|
||||
sys.auto_start = auto_start_state; // Restore run state before returning
|
||||
|
||||
|
||||
Reference in New Issue
Block a user