Skip to content

Commit

Permalink
disabled some processing if 16bit mode is off
Browse files Browse the repository at this point in the history
  • Loading branch information
Paciente8159 committed Oct 5, 2022
1 parent 798c0c3 commit cc7e7c3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion uCNC/cnc_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ extern "C"
/**
* accept G0 and G1 without explicit target
* */
// #define IGNORE_G0_G1_MISSING_AXIS_WORDS
#define IGNORE_G0_G1_MISSING_AXIS_WORDS

/**
* processes and displays the currently executing gcode numbered line
Expand Down
33 changes: 16 additions & 17 deletions uCNC/src/core/motion_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,18 @@ uint8_t mc_line(float *target, motion_data_t *block_data)
float inv_delta = (!CHECKFLAG(block_data->motion_mode, MOTIONCONTROL_MODE_INVERSEFEED) ? (block_data->feed * inv_dist) : block_data->feed);
block_data->feed = (float)max_steps * inv_delta;

#if ((KINEMATIC == KINEMATIC_DELTA) || defined(BRESENHAM_16BIT))
// this contains a motion. Any tool update will be done here
uint32_t line_segments = 1;
#if (KINEMATIC != KINEMATIC_DELTA)
#if (KINEMATIC == KINEMATIC_DELTA)
line_segments = (uint32_t)ceilf(line_dist * DELTA_MOTION_SEGMENT_FACTOR);
float m_inv = 1.0f / (float)line_segments;
for (uint8_t i = AXIS_COUNT; i != 0;)
{
i--;
motion_segment[i] *= m_inv;
}
#else
if (max_steps > MAX_STEPS_PER_LINE)
{
line_segments += (max_steps >> MAX_STEPS_PER_LINE_BITS);
Expand All @@ -277,14 +286,6 @@ uint8_t mc_line(float *target, motion_data_t *block_data)
motion_segment[i] *= m_inv;
}
}
#else
line_segments = (uint32_t)ceilf(line_dist * DELTA_MOTION_SEGMENT_FACTOR);
float m_inv = 1.0f / (float)line_segments;
for (uint8_t i = AXIS_COUNT; i != 0;)
{
i--;
motion_segment[i] *= m_inv;
}
#endif

while (--line_segments)
Expand All @@ -300,20 +301,18 @@ uint8_t mc_line(float *target, motion_data_t *block_data)
error = mc_line_segment(step_new_pos, block_data);
if (error)
{
memcpy(target, prev_target, sizeof(target));
memcpy(target, prev_target, sizeof(prev_target));
block_data->feed = feed;
return error;
}
}

if (error == STATUS_OK)
if (block_data->motion_flags.bit.is_subsegment)
{
if (block_data->motion_flags.bit.is_subsegment)
{
kinematics_apply_inverse(target, step_new_pos);
}

error = mc_line_segment(step_new_pos, block_data);
kinematics_apply_inverse(target, step_new_pos);
}
#endif
error = mc_line_segment(step_new_pos, block_data);
// stores the new position for the next motion
memcpy(mc_last_target, target, sizeof(mc_last_target));
block_data->feed = feed;
Expand Down

0 comments on commit cc7e7c3

Please sign in to comment.