Debugging and Compiling

This commit is contained in:
Dietz0r
2024-12-27 02:45:34 +01:00
committed by GitHub
parent ce60b8ff7d
commit c47e6a356e
3 changed files with 32 additions and 30 deletions
+9 -9
View File
@@ -2373,16 +2373,16 @@ status_code_t gc_execute_block (char *block)
#if ENABLE_ACCELERATION_PROFILES
case NonModal_SetAccelerationProfile:
if (gc_block.words.e){
if (gc_block.words.e)
FAIL(Status_GcodeUnsupportedCommand);
break;}
else if (!gc_block.words.p){
gc_block.values.p = 1.0f;}
else if (gc_block.values.p < 1.0f){
FAIL(Status_NegativeValue);}
else if (gc_block.values.p > 5.0f){
FAIL(Status_GcodeValueOutOfRange);}
gc_state.modal.acceleration_profile = gc_block.values.p;
else if (!gc_block.words.p)
gc_block.values.p = 1.0f;
else if (gc_block.values.p < 1.0f)
FAIL(Status_NegativeValue);
else if (gc_block.values.p > 5.0f)
FAIL(Status_GcodeValueOutOfRange);
else
gc_state.modal.acceleration_profile = gc_block.values.p;
break;
#endif
default:
+19 -14
View File
@@ -1196,13 +1196,6 @@ static status_code_t set_axis_setting (setting_id_t setting, float value)
#if ENABLE_JERK_ACCELERATION
case Setting_AxisJerk:
if ((value * 60.0f * 60.0f) < (settings.axis[idx].acceleration * 10.0f)) { //ensuring that the acceleration ramp time is limited to at maximum 100ms (or 10 stepper segments).
settings.axis[idx].jerk = settings.axis[idx].acceleration * 10.0f * 60.0f; // mm/min^2 -> mm/min^3
}
else if ((settings.axis[idx].acceleration / (value * 60.0f * 60.0f * 60.0f)) < (1.0f / ACCELERATION_TICKS_PER_SECOND)) { // Limit Jerk if value is so large that it reverts back to trapezoidal.
settings.axis[idx].jerk = settings.axis[idx].acceleration * ACCELERATION_TICKS_PER_SECOND * 60.0f; // mm/min^2 -> mm/min^3
}
else
settings.axis[idx].jerk = value * 60.0f * 60.0f * 60.0f; // Convert to mm/min^3 for grbl internal use.
break;
#endif
@@ -1284,12 +1277,6 @@ static float get_float (setting_id_t setting)
value = settings.axis[idx].acceleration / (60.0f * 60.0f); // Convert from mm/min^2 to mm/sec^2.
break;
#if ENABLE_JERK_ACCELERATION
case Setting_AxisJerk:
value = settings.axis[idx].jerk / (60.0f * 60.0f * 60.0f); // Convert from mm/min^3 to mm/sec^3.
break;
#endif
case Setting_AxisMaxTravel:
value = -settings.axis[idx].max_travel; // Store as negative for grbl internal use.
break;
@@ -1315,7 +1302,22 @@ static float get_float (setting_id_t setting)
default:
break;
}
} else switch(setting) {
} else if(setting >= Setting_AxisSettingsBase1 && setting <= Setting_AxisSettingsMax1) {
uint_fast8_t idx;
switch(settings_get_axis_base(setting, &idx)) {
#if ENABLE_JERK_ACCELERATION
case Setting_AxisJerk:
value = settings.axis[idx].jerk / (60.0f * 60.0f * 60.0f); // Convert from mm/min^3 to mm/sec^3.
break;
#endif
default:
break;
}
} else switch(setting) {
case Setting_HomingFeedRate:
value = settings.axis[0].homing_feed_rate;
@@ -2017,6 +2019,9 @@ PROGMEM static const setting_detail_t setting_detail[] = {
{ Setting_AxisMaxTravel, Group_Axis0, "-axis maximum travel", axis_dist, Format_Decimal, "#####0.000", NULL, NULL, Setting_IsLegacyFn, set_axis_setting, get_float, NULL, AXIS_OPTS },
#if ENABLE_BACKLASH_COMPENSATION
{ Setting_AxisBacklash, Group_Axis0, "-axis backlash compensation", axis_dist, Format_Decimal, "#####0.000##", NULL, NULL, Setting_IsExtendedFn, set_axis_setting, get_float, NULL, AXIS_OPTS },
#endif
#if ENABLE_JERK_ACCELERATION
{ Setting_AxisJerk, Group_Axis0, "-axis jerk", axis_jerk, Format_Decimal, "#####0.000", NULL, NULL, Setting_IsExtendedFn, set_axis_setting, get_float, NULL, AXIS_OPTS },
#endif
{ Setting_AxisAutoSquareOffset, Group_Axis0, "-axis dual axis offset", "mm", Format_Decimal, "-0.000", "-10", "10", Setting_IsExtendedFn, set_axis_setting, get_float, is_setting_available, AXIS_OPTS },
{ Setting_AxisHomingFeedRate, Group_Axis0, "-axis homing locate feed rate", axis_rate, Format_Decimal, "###0", NULL, NULL, Setting_NonCoreFn, set_axis_setting, get_float, is_setting_available, AXIS_OPTS },
+4 -7
View File
@@ -898,8 +898,8 @@ void st_prep_buffer (void)
case Ramp_Accel:
// NOTE: Acceleration ramp only computes during first do-while loop.
#if ENABLE_JERK_ACCELERATION
if (((mm_remaining - prep.accelerate_until) / (prep.current_speed + 1.0f)) <= (last_segment_accel / pl_block->jerk)) {
//+1.0f to avoid divide by 0 speed, minor effect on jerk ramp
if (((mm_remaining - prep.accelerate_until) / (prep.current_speed + 0.001f)) <= (last_segment_accel / pl_block->jerk)) {
//+0.001f to avoid divide by 0 speed, minor effect on jerk ramp (+1.0f was too large for low jerk values)
// Check if we are on ramp up or ramp down. Ramp down if time to end of acceleration is less than time needed to reach 0 acceleration.
// Then limit acceleration change by jerk up to max acceleration and update for next segment.
// Minimum acceleration jerk per time_var to ensure acceleartion completes. Acceleration change at end of ramp is in acceptable jerk range.
@@ -942,8 +942,8 @@ void st_prep_buffer (void)
default: // case Ramp_Decel:
// NOTE: mm_var used as a misc worker variable to prevent errors when near zero speed.
#if ENABLE_JERK_ACCELERATION
if ((mm_remaining / (prep.current_speed + 1.0f)) <= (last_segment_accel / pl_block->jerk)) {
//+1.0f to avoid divide by 0 speed, minor effect on jerk ramp
if ((mm_remaining / (prep.current_speed + 0.001f)) <= (last_segment_accel / pl_block->jerk)) {
//+0.001f to avoid divide by 0 speed, minor effect on jerk ramp (+1.0f was too large for low jerk values)
// Check if we are on ramp up or ramp down. Ramp down if time to end of deceleration is less than time needed to reach 0 acceleration.
// Then limit acceleration change by jerk up to max acceleration and update for next segment.
// Minimum acceleration of jerk per time_var to ensure acceleration completes. Acceleration change at end of ramp is in acceptable jerk range.
@@ -968,9 +968,6 @@ void st_prep_buffer (void)
time_var = 2.0f * (mm_remaining - prep.mm_complete) / (prep.current_speed + prep.exit_speed);
mm_remaining = prep.mm_complete;
prep.current_speed = prep.exit_speed;
#if ENABLE_JERK_ACCELERATION
last_segment_accel = 0.0f; // reset acceleration variable to 0 for next accel ramp
#endif
}
dt += time_var; // Add computed ramp time to total segment time.