TMC2130 speed and accel limitation (M201, M203) for stealth and normal mode

This commit is contained in:
Robert Pelnar 2018-07-19 19:12:46 +02:00
parent 2ce210a8bb
commit fd0b7c25e5

View file

@ -5765,16 +5765,29 @@ Sigma_Exit:
} }
break; break;
case 201: // M201 case 201: // M201
for(int8_t i=0; i < NUM_AXIS; i++) for (int8_t i = 0; i < NUM_AXIS; i++)
{ {
if(code_seen(axis_codes[i])) if (code_seen(axis_codes[i]))
{ {
max_acceleration_units_per_sq_second[i] = code_value(); int val = code_value();
} #ifdef TMC2130
} if ((i == X_AXIS) || (i == Y_AXIS))
// 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) {
reset_acceleration_rates(); int max_val = 0;
break; if (tmc2130_mode == TMC2130_MODE_NORMAL)
max_val = NORMAL_MAX_ACCEL_XY;
else if (tmc2130_mode == TMC2130_MODE_SILENT)
max_val = SILENT_MAX_ACCEL_XY;
if (val > max_val)
val = max_val;
}
#endif
max_acceleration_units_per_sq_second[i] = val;
}
}
// 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)
reset_acceleration_rates();
break;
#if 0 // Not used for Sprinter/grbl gen6 #if 0 // Not used for Sprinter/grbl gen6
case 202: // M202 case 202: // M202
for(int8_t i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
@ -5783,10 +5796,27 @@ Sigma_Exit:
break; break;
#endif #endif
case 203: // M203 max feedrate mm/sec case 203: // M203 max feedrate mm/sec
for(int8_t i=0; i < NUM_AXIS; i++) { for (int8_t i = 0; i < NUM_AXIS; i++)
if(code_seen(axis_codes[i])) max_feedrate[i] = code_value(); {
} if (code_seen(axis_codes[i]))
break; {
float val = code_value();
#ifdef TMC2130
if ((i == X_AXIS) || (i == Y_AXIS))
{
float max_val = 0;
if (tmc2130_mode == TMC2130_MODE_NORMAL)
max_val = NORMAL_MAX_FEEDRATE_XY;
else if (tmc2130_mode == TMC2130_MODE_SILENT)
max_val = SILENT_MAX_FEEDRATE_XY;
if (val > max_val)
val = max_val;
}
#endif //TMC2130
max_feedrate[i] = val;
}
}
break;
case 204: // M204 acclereration S normal moves T filmanent only moves case 204: // M204 acclereration S normal moves T filmanent only moves
{ {
if(code_seen('S')) acceleration = code_value() ; if(code_seen('S')) acceleration = code_value() ;