gcode: Report the raw MCU position from the M114 command

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-10-03 19:28:20 -04:00
parent 06420b0ddf
commit ce9523fb90
6 changed files with 16 additions and 12 deletions

View File

@ -62,8 +62,8 @@ class CartKinematics:
# Set final homed position
coord[axis] = s.position_endstop + s.get_homed_offset()
homing_state.set_homed_position(coord)
def query_endstops(self, print_time):
return homing.query_endstops(print_time, self.steppers)
def query_endstops(self, print_time, query_flags):
return homing.query_endstops(print_time, query_flags, self.steppers)
def motor_off(self, print_time):
self.limits = [(1.0, -1.0)] * 3
for stepper in self.steppers:

View File

@ -67,8 +67,8 @@ class CoreXYKinematics:
# Support endstop phase detection on Z axis
coord[axis] = s.position_endstop + s.get_homed_offset()
homing_state.set_homed_position(coord)
def query_endstops(self, print_time):
return homing.query_endstops(print_time, self.steppers)
def query_endstops(self, print_time, query_flags):
return homing.query_endstops(print_time, query_flags, self.steppers)
def motor_off(self, print_time):
self.limits = [(1.0, -1.0)] * 3
for stepper in self.steppers:

View File

@ -123,8 +123,8 @@ class DeltaKinematics:
+ self.steppers[i].get_homed_offset()
for i in StepList]
homing_state.set_homed_position(self._actuator_to_cartesian(spos))
def query_endstops(self, print_time):
return homing.query_endstops(print_time, self.steppers)
def query_endstops(self, print_time, query_flags):
return homing.query_endstops(print_time, query_flags, self.steppers)
def motor_off(self, print_time):
self.limit_xy2 = -1.
for stepper in self.steppers:

View File

@ -403,11 +403,11 @@ class GCodeParser:
if self.toolhead is None:
self.cmd_default(params)
return
kinpos = self.toolhead.get_position()
self.respond("X:%.3f Y:%.3f Z:%.3f E:%.3f Count X:%.3f Y:%.3f Z:%.3f" % (
raw_pos = self.toolhead.query_endstops("get_mcu_position")
self.respond("X:%.3f Y:%.3f Z:%.3f E:%.3f Count %s" % (
self.last_position[0], self.last_position[1],
self.last_position[2], self.last_position[3],
kinpos[0], kinpos[1], kinpos[2]))
" ".join(["%s:%d" % (n.upper(), p) for n, p in raw_pos])))
cmd_M115_when_not_ready = True
def cmd_M115(self, params):
# Get Firmware Version and Capabilities

View File

@ -57,7 +57,11 @@ class Homing:
def set_homed_position(self, pos):
self.toolhead.set_position(self._fill_coord(pos))
def query_endstops(print_time, steppers):
def query_endstops(print_time, query_flags, steppers):
if query_flags == "get_mcu_position":
# Only the commanded position is requested
return [(s.name.upper(), s.mcu_stepper.get_mcu_position())
for s in steppers]
for s in steppers:
s.mcu_endstop.query_endstop(print_time)
out = []

View File

@ -349,9 +349,9 @@ class ToolHead:
while (not self.sync_print_time
or self.print_time >= self.mcu.estimated_print_time(eventtime)):
eventtime = self.reactor.pause(eventtime + 0.100)
def query_endstops(self):
def query_endstops(self, query_flags=""):
last_move_time = self.get_last_move_time()
return self.kin.query_endstops(last_move_time)
return self.kin.query_endstops(last_move_time, query_flags)
def set_extruder(self, extruder):
last_move_time = self.get_last_move_time()
self.extruder.set_active(last_move_time, False)