toolhead: M204 must update max_accel_to_decel

The max_accel_to_decel variable must not be greater than the max_accel
variable.  Make sure to check this when M204 changes max_accel.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-10-01 22:02:33 -04:00
parent 357b2f477c
commit 0820394e13
1 changed files with 3 additions and 3 deletions

View File

@ -207,8 +207,7 @@ class ToolHead:
self.max_accel = config.getfloat('max_accel', above=0.) self.max_accel = config.getfloat('max_accel', above=0.)
self.requested_accel_to_decel = config.getfloat( self.requested_accel_to_decel = config.getfloat(
'max_accel_to_decel', self.max_accel * 0.5, above=0.) 'max_accel_to_decel', self.max_accel * 0.5, above=0.)
self.max_accel_to_decel = min(self.requested_accel_to_decel, self.max_accel_to_decel = self.requested_accel_to_decel
self.max_accel)
self.square_corner_velocity = config.getfloat( self.square_corner_velocity = config.getfloat(
'square_corner_velocity', 5., minval=0.) 'square_corner_velocity', 5., minval=0.)
self.config_max_velocity = self.max_velocity self.config_max_velocity = self.max_velocity
@ -421,6 +420,8 @@ class ToolHead:
def _calc_junction_deviation(self): def _calc_junction_deviation(self):
scv2 = self.square_corner_velocity**2 scv2 = self.square_corner_velocity**2
self.junction_deviation = scv2 * (math.sqrt(2.) - 1.) / self.max_accel self.junction_deviation = scv2 * (math.sqrt(2.) - 1.) / self.max_accel
self.max_accel_to_decel = min(self.requested_accel_to_decel,
self.max_accel)
cmd_SET_VELOCITY_LIMIT_help = "Set printer velocity limits" cmd_SET_VELOCITY_LIMIT_help = "Set printer velocity limits"
def cmd_SET_VELOCITY_LIMIT(self, params): def cmd_SET_VELOCITY_LIMIT(self, params):
print_time = self.get_last_move_time() print_time = self.get_last_move_time()
@ -438,7 +439,6 @@ class ToolHead:
'ACCEL_TO_DECEL', params, self.requested_accel_to_decel, above=0.) 'ACCEL_TO_DECEL', params, self.requested_accel_to_decel, above=0.)
self.max_velocity = max_velocity self.max_velocity = max_velocity
self.max_accel = max_accel self.max_accel = max_accel
self.max_accel_to_decel = min(self.requested_accel_to_decel, max_accel)
self.square_corner_velocity = square_corner_velocity self.square_corner_velocity = square_corner_velocity
self._calc_junction_deviation() self._calc_junction_deviation()
msg = ("max_velocity: %.6f\n" msg = ("max_velocity: %.6f\n"