aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-01-13 21:30:32 -0500
committerKevin O'Connor <kevin@koconnor.net>2020-01-23 20:47:01 -0500
commitd1972b1e9ccc1331d2a2e5d3af108abf8a2858e2 (patch)
treea76dec0c4be0c0b598a534452cf295ed77a29c30 /klippy
parent8bf3e56301283ff9d657bc739b2ff1c3be4197d2 (diff)
downloadkutter-d1972b1e9ccc1331d2a2e5d3af108abf8a2858e2.tar.gz
kutter-d1972b1e9ccc1331d2a2e5d3af108abf8a2858e2.tar.xz
kutter-d1972b1e9ccc1331d2a2e5d3af108abf8a2858e2.zip
itersolve: Add ability to query the active_flags state
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/chelper/__init__.py1
-rw-r--r--klippy/chelper/itersolve.c9
-rw-r--r--klippy/chelper/itersolve.h1
-rw-r--r--klippy/stepper.py3
4 files changed, 14 insertions, 0 deletions
diff --git a/klippy/chelper/__init__.py b/klippy/chelper/__init__.py
index 73058081..c979340b 100644
--- a/klippy/chelper/__init__.py
+++ b/klippy/chelper/__init__.py
@@ -48,6 +48,7 @@ defs_itersolve = """
, double flush_time);
double itersolve_check_active(struct stepper_kinematics *sk
, double flush_time);
+ int32_t itersolve_is_active_axis(struct stepper_kinematics *sk, char axis);
void itersolve_set_trapq(struct stepper_kinematics *sk, struct trapq *tq);
void itersolve_set_stepcompress(struct stepper_kinematics *sk
, struct stepcompress *sc, double step_dist);
diff --git a/klippy/chelper/itersolve.c b/klippy/chelper/itersolve.c
index 1f30bcae..0b7c4b04 100644
--- a/klippy/chelper/itersolve.c
+++ b/klippy/chelper/itersolve.c
@@ -212,6 +212,15 @@ itersolve_check_active(struct stepper_kinematics *sk, double flush_time)
}
}
+// Report if the given stepper is registered for the given axis
+int32_t __visible
+itersolve_is_active_axis(struct stepper_kinematics *sk, char axis)
+{
+ if (axis < 'x' || axis > 'z')
+ return 0;
+ return (sk->active_flags & (AF_X << (axis - 'x'))) != 0;
+}
+
void __visible
itersolve_set_trapq(struct stepper_kinematics *sk, struct trapq *tq)
{
diff --git a/klippy/chelper/itersolve.h b/klippy/chelper/itersolve.h
index 87dad7a9..adb48055 100644
--- a/klippy/chelper/itersolve.h
+++ b/klippy/chelper/itersolve.h
@@ -28,6 +28,7 @@ struct stepper_kinematics {
int32_t itersolve_generate_steps(struct stepper_kinematics *sk
, double flush_time);
double itersolve_check_active(struct stepper_kinematics *sk, double flush_time);
+int32_t itersolve_is_active_axis(struct stepper_kinematics *sk, char axis);
void itersolve_set_trapq(struct stepper_kinematics *sk, struct trapq *tq);
void itersolve_set_stepcompress(struct stepper_kinematics *sk
, struct stepcompress *sc, double step_dist);
diff --git a/klippy/stepper.py b/klippy/stepper.py
index cf7effd7..d4fe63ba 100644
--- a/klippy/stepper.py
+++ b/klippy/stepper.py
@@ -165,6 +165,9 @@ class MCU_stepper:
flush_time)
if ret:
raise error("Internal error in stepcompress")
+ def is_active_axis(self, axis):
+ return self._ffi_lib.itersolve_is_active_axis(
+ self._stepper_kinematics, axis)
# Helper code to build a stepper object from a config section
def PrinterStepper(config, units_in_radians=False):