install G38.{3,4,5}
This commit is contained in:
parent
f78eebcebf
commit
0f7806938d
22
gcode.c
22
gcode.c
@ -210,11 +210,23 @@ uint8_t gc_execute_line(char *line)
|
|||||||
case 3: gc_block.modal.motion = MOTION_MODE_CCW_ARC; break; // G3
|
case 3: gc_block.modal.motion = MOTION_MODE_CCW_ARC; break; // G3
|
||||||
case 38:
|
case 38:
|
||||||
switch(mantissa) {
|
switch(mantissa) {
|
||||||
case 20: gc_block.modal.motion = MOTION_MODE_PROBE; break; // G38.2
|
case 20:
|
||||||
// NOTE: If G38.3+ are enabled, change mantissa variable type to uint16_t.
|
sys.probe_away = false;
|
||||||
// case 30: gc_block.modal.motion = MOTION_MODE_PROBE_NO_ERROR; break; // G38.3 Not supported.
|
gc_block.modal.motion = MOTION_MODE_PROBE;
|
||||||
// case 40: // Not supported.
|
break; // G38.2
|
||||||
// case 50: // Not supported.
|
case 30:
|
||||||
|
sys.probe_away = false;
|
||||||
|
gc_block.modal.motion = MOTION_MODE_PROBE_NO_ERROR;
|
||||||
|
break; // G38.3
|
||||||
|
case 40:
|
||||||
|
sys.probe_away = true;
|
||||||
|
gc_block.modal.motion = MOTION_MODE_PROBE;
|
||||||
|
break; // G38.4
|
||||||
|
case 50:
|
||||||
|
sys.probe_away = true;
|
||||||
|
gc_block.modal.motion = MOTION_MODE_PROBE_NO_ERROR;
|
||||||
|
break; // G38.5
|
||||||
|
|
||||||
default: FAIL(STATUS_GCODE_UNSUPPORTED_COMMAND); // [Unsupported G38.x command]
|
default: FAIL(STATUS_GCODE_UNSUPPORTED_COMMAND); // [Unsupported G38.x command]
|
||||||
}
|
}
|
||||||
mantissa = 0; // Set to zero to indicate valid non-integer G command.
|
mantissa = 0; // Set to zero to indicate valid non-integer G command.
|
||||||
|
@ -289,7 +289,7 @@ void mc_homing_cycle()
|
|||||||
uint8_t auto_start_state = sys.auto_start; // Store run state
|
uint8_t auto_start_state = sys.auto_start; // Store run state
|
||||||
|
|
||||||
// After syncing, check if probe is already triggered. If so, halt and issue alarm.
|
// After syncing, check if probe is already triggered. If so, halt and issue alarm.
|
||||||
if (probe_get_state()) {
|
if ((sys.probe_away << PROBE_BIT) ^ probe_get_state()) {
|
||||||
bit_true_atomic(sys.execute, EXEC_CRIT_EVENT);
|
bit_true_atomic(sys.execute, EXEC_CRIT_EVENT);
|
||||||
protocol_execute_runtime();
|
protocol_execute_runtime();
|
||||||
}
|
}
|
||||||
|
4
probe.c
4
probe.c
@ -37,6 +37,8 @@ void probe_init()
|
|||||||
PROBE_PORT |= PROBE_MASK; // Enable internal pull-up resistors. Normal high operation.
|
PROBE_PORT |= PROBE_MASK; // Enable internal pull-up resistors. Normal high operation.
|
||||||
probe_invert_mask = PROBE_MASK;
|
probe_invert_mask = PROBE_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sys.probe_away = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -50,7 +52,7 @@ uint8_t probe_get_state() { return((PROBE_PIN & PROBE_MASK) ^ probe_invert_mask)
|
|||||||
void probe_state_monitor()
|
void probe_state_monitor()
|
||||||
{
|
{
|
||||||
if (sys.probe_state == PROBE_ACTIVE) {
|
if (sys.probe_state == PROBE_ACTIVE) {
|
||||||
if (probe_get_state()) {
|
if ((sys.probe_away << PROBE_BIT) ^ probe_get_state()) {
|
||||||
sys.probe_state = PROBE_OFF;
|
sys.probe_state = PROBE_OFF;
|
||||||
memcpy(sys.probe_position, sys.position, sizeof(float)*N_AXIS);
|
memcpy(sys.probe_position, sys.position, sizeof(float)*N_AXIS);
|
||||||
bit_true(sys.execute, EXEC_FEED_HOLD);
|
bit_true(sys.execute, EXEC_FEED_HOLD);
|
||||||
|
1
system.h
1
system.h
@ -79,6 +79,7 @@ typedef struct {
|
|||||||
uint8_t auto_start; // Planner auto-start flag. Toggled off during feed hold. Defaulted by settings.
|
uint8_t auto_start; // Planner auto-start flag. Toggled off during feed hold. Defaulted by settings.
|
||||||
volatile uint8_t probe_state; // Probing state value. Used to coordinate the probing cycle with stepper ISR.
|
volatile uint8_t probe_state; // Probing state value. Used to coordinate the probing cycle with stepper ISR.
|
||||||
int32_t probe_position[N_AXIS]; // Last probe position in machine coordinates and steps.
|
int32_t probe_position[N_AXIS]; // Last probe position in machine coordinates and steps.
|
||||||
|
uint8_t probe_away; // probe away from work by reversing the switch direction (G38.4, G38.5)
|
||||||
} system_t;
|
} system_t;
|
||||||
extern system_t sys;
|
extern system_t sys;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user