gcode: Rename absolutecoord/extrude to absolute_coord/_extrude

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-05-26 20:59:44 -04:00
parent 862b97ce8f
commit 2cff3291c0
1 changed files with 10 additions and 10 deletions

View File

@ -46,7 +46,7 @@ class GCodeParser:
for a in getattr(self, 'cmd_' + cmd + '_aliases', []): for a in getattr(self, 'cmd_' + cmd + '_aliases', []):
self.register_command(a, func, wnr) self.register_command(a, func, wnr)
# G-Code coordinate manipulation # G-Code coordinate manipulation
self.absolutecoord = self.absoluteextrude = True self.absolute_coord = self.absolute_extrude = True
self.base_position = [0.0, 0.0, 0.0, 0.0] self.base_position = [0.0, 0.0, 0.0, 0.0]
self.last_position = [0.0, 0.0, 0.0, 0.0] self.last_position = [0.0, 0.0, 0.0, 0.0]
self.homing_position = [0.0, 0.0, 0.0, 0.0] self.homing_position = [0.0, 0.0, 0.0, 0.0]
@ -117,7 +117,7 @@ class GCodeParser:
'speed_factor': self._get_gcode_speed_override(), 'speed_factor': self._get_gcode_speed_override(),
'speed': self._get_gcode_speed(), 'speed': self._get_gcode_speed(),
'extrude_factor': self.extrude_factor, 'extrude_factor': self.extrude_factor,
'abs_extrude': self.absoluteextrude, 'abs_extrude': self.absolute_extrude,
'busy': busy, 'busy': busy,
'move_xpos': move_position[0], 'move_xpos': move_position[0],
'move_ypos': move_position[1], 'move_ypos': move_position[1],
@ -173,10 +173,10 @@ class GCodeParser:
for eventtime, data in self.input_log: for eventtime, data in self.input_log:
out.append("Read %f: %s" % (eventtime, repr(data))) out.append("Read %f: %s" % (eventtime, repr(data)))
out.append( out.append(
"gcode state: absolutecoord=%s absoluteextrude=%s" "gcode state: absolute_coord=%s absolute_extrude=%s"
" base_position=%s last_position=%s homing_position=%s" " base_position=%s last_position=%s homing_position=%s"
" speed_factor=%s extrude_factor=%s speed=%s" % ( " speed_factor=%s extrude_factor=%s speed=%s" % (
self.absolutecoord, self.absoluteextrude, self.absolute_coord, self.absolute_extrude,
self.base_position, self.last_position, self.homing_position, self.base_position, self.last_position, self.homing_position,
self.speed_factor, self.extrude_factor, self.speed)) self.speed_factor, self.extrude_factor, self.speed))
logging.info("\n".join(out)) logging.info("\n".join(out))
@ -498,7 +498,7 @@ class GCodeParser:
if axis in params: if axis in params:
v = float(params[axis]) v = float(params[axis])
pos = self.axis2pos[axis] pos = self.axis2pos[axis]
if not self.absolutecoord: if not self.absolute_coord:
# value relative to position of last move # value relative to position of last move
self.last_position[pos] += v self.last_position[pos] += v
else: else:
@ -506,7 +506,7 @@ class GCodeParser:
self.last_position[pos] = v + self.base_position[pos] self.last_position[pos] = v + self.base_position[pos]
if 'E' in params: if 'E' in params:
v = float(params['E']) * self.extrude_factor v = float(params['E']) * self.extrude_factor
if not self.absolutecoord or not self.absoluteextrude: if not self.absolute_coord or not self.absolute_extrude:
# value relative to position of last move # value relative to position of last move
self.last_position[3] += v self.last_position[3] += v
else: else:
@ -562,16 +562,16 @@ class GCodeParser:
self.respond_error('Machine does not support G20 (inches) command') self.respond_error('Machine does not support G20 (inches) command')
def cmd_M82(self, params): def cmd_M82(self, params):
# Use absolute distances for extrusion # Use absolute distances for extrusion
self.absoluteextrude = True self.absolute_extrude = True
def cmd_M83(self, params): def cmd_M83(self, params):
# Use relative distances for extrusion # Use relative distances for extrusion
self.absoluteextrude = False self.absolute_extrude = False
def cmd_G90(self, params): def cmd_G90(self, params):
# Use absolute coordinates # Use absolute coordinates
self.absolutecoord = True self.absolute_coord = True
def cmd_G91(self, params): def cmd_G91(self, params):
# Use relative coordinates # Use relative coordinates
self.absolutecoord = False self.absolute_coord = False
def cmd_G92(self, params): def cmd_G92(self, params):
# Set position # Set position
offsets = { p: self.get_float(a, params) offsets = { p: self.get_float(a, params)