max_feedrate and max_acceleration limitation fix (M201, M203)

This commit is contained in:
Robert Pelnar 2018-07-21 12:24:57 +02:00
parent 980c044dac
commit f07d08697a
1 changed files with 18 additions and 16 deletions

View File

@ -5748,18 +5748,19 @@ Sigma_Exit:
{ {
int val = code_value(); int val = code_value();
#ifdef TMC2130 #ifdef TMC2130
int val_silent = val;
if ((i == X_AXIS) || (i == Y_AXIS)) if ((i == X_AXIS) || (i == Y_AXIS))
{ {
int max_val = 0; if (val > NORMAL_MAX_ACCEL_XY)
if (tmc2130_mode == TMC2130_MODE_NORMAL) val = NORMAL_MAX_ACCEL_XY;
max_val = NORMAL_MAX_ACCEL_XY; if (val_silent > SILENT_MAX_ACCEL_XY)
else if (tmc2130_mode == TMC2130_MODE_SILENT) val_silent = SILENT_MAX_ACCEL_XY;
max_val = SILENT_MAX_ACCEL_XY;
if (val > max_val)
val = max_val;
} }
#endif max_acceleration_units_per_sq_second_normal[i] = val;
max_acceleration_units_per_sq_second_silent[i] = val_silent;
#else //TMC2130
max_acceleration_units_per_sq_second[i] = val; max_acceleration_units_per_sq_second[i] = val;
#endif //TMC2130
} }
} }
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner) // steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
@ -5779,18 +5780,19 @@ Sigma_Exit:
{ {
float val = code_value(); float val = code_value();
#ifdef TMC2130 #ifdef TMC2130
float val_silent = val;
if ((i == X_AXIS) || (i == Y_AXIS)) if ((i == X_AXIS) || (i == Y_AXIS))
{ {
float max_val = 0; if (val > NORMAL_MAX_FEEDRATE_XY)
if (tmc2130_mode == TMC2130_MODE_NORMAL) val = NORMAL_MAX_FEEDRATE_XY;
max_val = NORMAL_MAX_FEEDRATE_XY; if (val_silent > SILENT_MAX_FEEDRATE_XY)
else if (tmc2130_mode == TMC2130_MODE_SILENT) val_silent = SILENT_MAX_FEEDRATE_XY;
max_val = SILENT_MAX_FEEDRATE_XY;
if (val > max_val)
val = max_val;
} }
#endif //TMC2130 max_feedrate_normal[i] = val;
max_feedrate_silent[i] = val_silent;
#else //TMC2130
max_feedrate[i] = val; max_feedrate[i] = val;
#endif //TMC2130
} }
} }
break; break;