diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-05-28 17:40:19 -0400 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2019-06-04 09:50:30 -0400 |
commit | 6e88320d625ae80e4b4b87c75ba5540b9f4da146 (patch) | |
tree | fce73b92bdc90b1eb55c0da3f21a72ee7f1d0ba9 /klippy | |
parent | 4ccc218b065897ab4d0e5eebe6a5a92e1a3af28d (diff) | |
download | kutter-6e88320d625ae80e4b4b87c75ba5540b9f4da146.tar.gz kutter-6e88320d625ae80e4b4b87c75ba5540b9f4da146.tar.xz kutter-6e88320d625ae80e4b4b87c75ba5540b9f4da146.zip |
gcode: "gcode_position" and toolhead "position" as get_status() named tuple
Add "gcode_position" named tuple to gcode.get_status(). Add a
"position" named tuple to toolhead.get_status().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/gcode.py | 1 | ||||
-rw-r--r-- | klippy/homing.py | 6 | ||||
-rw-r--r-- | klippy/toolhead.py | 1 |
3 files changed, 6 insertions, 2 deletions
diff --git a/klippy/gcode.py b/klippy/gcode.py index c66008a7..3c545f68 100644 --- a/klippy/gcode.py +++ b/klippy/gcode.py @@ -144,6 +144,7 @@ class GCodeParser: 'homing_xpos': self.homing_position[0], 'homing_ypos': self.homing_position[1], 'homing_zpos': self.homing_position[2], + 'gcode_position': homing.Coord(*move_position), 'action_respond_info': self._action_respond_info, 'action_respond_error': self._action_respond_error, 'action_emergency_stop': self._action_emergency_stop, diff --git a/klippy/homing.py b/klippy/homing.py index ea8967b4..f6f7e5d8 100644 --- a/klippy/homing.py +++ b/klippy/homing.py @@ -1,9 +1,9 @@ # Code for state tracking during homing operations # -# Copyright (C) 2016,2017 Kevin O'Connor <kevin@koconnor.net> +# Copyright (C) 2016-2019 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. -import logging, math +import logging, math, collections HOMING_STEP_DELAY = 0.00000025 HOMING_START_DELAY = 0.001 @@ -152,3 +152,5 @@ class EndstopError(Exception): def EndstopMoveError(pos, msg="Move out of range"): return EndstopError("%s: %.3f %.3f %.3f [%.3f]" % ( msg, pos[0], pos[1], pos[2], pos[3])) + +Coord = collections.namedtuple('Coord', ('x', 'y', 'z', 'e')) diff --git a/klippy/toolhead.py b/klippy/toolhead.py index b7413fb1..713b0009 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -417,6 +417,7 @@ class ToolHead: status = "Ready" return { 'status': status, 'print_time': print_time, 'estimated_print_time': estimated_print_time, + 'position': homing.Coord(*self.commanded_pos), 'printing_time': print_time - last_print_start_time } def _handle_request_restart(self, print_time): self.motor_off() |