gcode: Wrap code to 80 columns

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-02-27 13:04:19 -05:00
parent 65d6253fb8
commit 5bbae0710a
1 changed files with 10 additions and 5 deletions

View File

@ -26,7 +26,8 @@ class GCodeParser:
self.is_fileinput = not not printer.get_start_args().get("debuginput")
self.fd_handle = None
if not self.is_fileinput:
self.fd_handle = self.reactor.register_fd(self.fd, self.process_data)
self.fd_handle = self.reactor.register_fd(self.fd,
self.process_data)
self.partial_input = ""
self.pending_commands = []
self.bytes_read = 0
@ -147,7 +148,8 @@ class GCodeParser:
self.toolhead.set_extruder(self.extruder)
self.fan = self.printer.lookup_object('fan', None)
if self.is_fileinput and self.fd_handle is None:
self.fd_handle = self.reactor.register_fd(self.fd, self.process_data)
self.fd_handle = self.reactor.register_fd(self.fd,
self.process_data)
self._respond_state("Ready")
def reset_last_position(self):
self.last_position = self.position_with_transform()
@ -251,7 +253,8 @@ class GCodeParser:
self.process_commands(pending_commands)
pending_commands = self.pending_commands
if self.fd_handle is None:
self.fd_handle = self.reactor.register_fd(self.fd, self.process_data)
self.fd_handle = self.reactor.register_fd(self.fd,
self.process_data)
def process_batch(self, commands):
if self.is_processing_data:
return False
@ -496,12 +499,14 @@ class GCodeParser:
if 'F' in params:
speed = float(params['F'])
if speed <= 0.:
raise error("Invalid speed in '%s'" % (params['#original'],))
raise error("Invalid speed in '%s'" % (
params['#original'],))
self.speed = speed
except ValueError as e:
raise error("Unable to parse move '%s'" % (params['#original'],))
try:
self.move_with_transform(self.last_position, self.speed * self.speed_factor)
self.move_with_transform(self.last_position,
self.speed * self.speed_factor)
except homing.EndstopError as e:
raise error(str(e))
def cmd_G4(self, params):