Skip to content

Commit

Permalink
Merge pull request #562 from Paciente8159/fix-coolant-m7-m8
Browse files Browse the repository at this point in the history
fixed coolant pin control via M7 and M8
  • Loading branch information
Paciente8159 committed Nov 11, 2023
2 parents 71c6784 + fe5d235 commit 167a16d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
9 changes: 3 additions & 6 deletions uCNC/src/core/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -2304,20 +2304,17 @@ static uint8_t parser_mcode_word(uint8_t code, uint8_t mantissa, parser_state_t
new_group |= GCODE_GROUP_TOOLCHANGE;
break;
#endif
#if ASSERT_PIN(COOLANT_MIST)
case 7:
#endif
#ifdef M7_SAME_AS_M8
case 7:
#endif
case 8:
#ifdef ENABLE_COOLANT
cmd->groups |= GCODE_GROUP_COOLANT; // word overlapping allowed
#if ASSERT_PIN(COOLANT_MIST)
#ifndef M7_SAME_AS_M8
new_state->groups.coolant |= ((code == 8) ? M8 : M7);
#else
new_state->groups.coolant |= M8;
#endif
return STATUS_OK;
#endif
case 9:
cmd->groups |= GCODE_GROUP_COOLANT;
new_state->groups.coolant = M9;
Expand Down
4 changes: 2 additions & 2 deletions uCNC/src/core/planner.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,8 @@ void planner_sync_tools(motion_data_t *block_data)
{
#if TOOL_COUNT > 0
g_planner_state.spindle_speed = block_data->spindle;
g_planner_state.state_flags.reg &= ~STATE_COPY_FLAG_MASK;
g_planner_state.state_flags.reg |= (block_data->motion_flags.reg & STATE_COPY_FLAG_MASK);
g_planner_state.state_flags.reg &= ~TOOL_STATE_COPY_FLAG_MASK;
g_planner_state.state_flags.reg |= (block_data->motion_flags.reg & TOOL_STATE_COPY_FLAG_MASK);
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion uCNC/src/core/planner.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern "C"
#define PLANNER_MOTION_EXACT_STOP 64
#define PLANNER_MOTION_CONTINUOUS 128

#define STATE_COPY_FLAG_MASK 0x1F
#define TOOL_STATE_COPY_FLAG_MASK 0x78
typedef motion_flags_t planner_flags_t;

typedef struct planner_block_
Expand Down
4 changes: 2 additions & 2 deletions uCNC/src/hal/tools/tool_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ extern "C"
* */
#define SET_COOLANT(X, Y, Z) \
{ \
io_set_pinvalue(X, (Z && COOLANT_MASK)); \
io_set_pinvalue(Y, (Z && MIST_MASK)); \
io_set_pinvalue(X, (Z & COOLANT_MASK)); \
io_set_pinvalue(Y, (Z & MIST_MASK)); \
}

#ifdef __cplusplus
Expand Down

0 comments on commit 167a16d

Please sign in to comment.