mirror of
https://github.com/grblHAL/core.git
synced 2026-08-17 16:41:45 +08:00
adjusted the limit by axis maximum functions to not require the block data
This commit is contained in:
@@ -2376,7 +2376,7 @@ status_code_t gc_execute_block (char *block)
|
||||
if (gc_block.words.e){
|
||||
FAIL(Status_GcodeUnsupportedCommand);
|
||||
break;}
|
||||
else if (!gc_block.word.p){
|
||||
else if (!gc_block.words.p){
|
||||
gc_block.values.p = 1.0f;}
|
||||
else if (gc_block.values.p < 1.0f){
|
||||
FAIL(Status_NegativeValue);}
|
||||
|
||||
@@ -339,7 +339,7 @@ inline static float plan_compute_profile_parameters (plan_block_t *block, float
|
||||
return nominal_speed;
|
||||
}
|
||||
|
||||
static inline float limit_acceleration_by_axis_maximum (float *unit_vec)
|
||||
static inline float limit_acceleration_by_axis_maximum (float *unit_vec,)
|
||||
{
|
||||
uint_fast8_t idx = N_AXIS;
|
||||
float limit_value = SOME_LARGE_VALUE;
|
||||
@@ -348,9 +348,6 @@ static inline float limit_acceleration_by_axis_maximum (float *unit_vec)
|
||||
if (unit_vec[--idx] != 0.0f) // Avoid divide by zero.
|
||||
limit_value = min(limit_value, fabsf(settings.axis[idx].acceleration / unit_vec[idx]));
|
||||
} while(idx);
|
||||
#if ENABLE_ACCELERATION_PROFILES
|
||||
limit_value *= block->acceleration_factor;
|
||||
#endif
|
||||
return limit_value;
|
||||
}
|
||||
|
||||
@@ -364,9 +361,6 @@ static inline float limit_jerk_by_axis_maximum (float *unit_vec)
|
||||
if (unit_vec[--idx] != 0.0f) // Avoid divide by zero.
|
||||
limit_value = min(limit_value, fabsf(settings.axis[idx].jerk / unit_vec[idx]));
|
||||
} while(idx);
|
||||
#if ENABLE_ACCELERATION_PROFILES
|
||||
limit_value *= block->acceleration_factor;
|
||||
#endif
|
||||
return limit_value;
|
||||
}
|
||||
#endif
|
||||
@@ -531,8 +525,14 @@ bool plan_buffer_line (float *target, plan_line_data_t *pl_data)
|
||||
#ifdef KINEMATICS_API
|
||||
block->rate_multiplier = pl_data->rate_multiplier;
|
||||
#endif
|
||||
#ifdef ENABLE_ACCELERATION_PROFILES
|
||||
#if ENABLE_ACCELERATION_PROFILES // recalculate the acceleration limits when enabled.
|
||||
block->acceleration_factor = pl_data->acceleration_factor;
|
||||
#if ENABLE_JERK_ACCELERATION
|
||||
block->max_acceleration *= block->acceleration_factor;
|
||||
block->jerk *= block->acceleration_factor;
|
||||
#else
|
||||
block->acceleration *= block->acceleration_factor;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Store programmed rate.
|
||||
|
||||
+2
-3
@@ -708,14 +708,13 @@ typedef struct {
|
||||
float steps_per_mm;
|
||||
float max_rate;
|
||||
float acceleration;
|
||||
#if ENABLE_JERK_ACCELERATION
|
||||
float jerk;
|
||||
#endif
|
||||
float max_travel;
|
||||
float dual_axis_offset;
|
||||
float homing_seek_rate;
|
||||
float homing_feed_rate;
|
||||
#if ENABLE_JERK_ACCELERATION
|
||||
float jerk;
|
||||
#endif
|
||||
#if ENABLE_BACKLASH_COMPENSATION
|
||||
float backlash;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user