aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/chelper
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2023-10-13 20:43:27 -0400
committerKevin O'Connor <kevin@koconnor.net>2023-11-16 22:07:15 -0500
commit48a05eaa542bfd4a1099c2224bda443049a6fa64 (patch)
treeacda1bae545fdf49e6b4ca8dd3f3b7b857143df8 /klippy/chelper
parent4688c21c54dfb89ef9902b607521a8cc0e99c94a (diff)
downloadkutter-48a05eaa542bfd4a1099c2224bda443049a6fa64.tar.gz
kutter-48a05eaa542bfd4a1099c2224bda443049a6fa64.tar.xz
kutter-48a05eaa542bfd4a1099c2224bda443049a6fa64.zip
stepcompress: Add support for queuing messages that consume move queue space
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/chelper')
-rw-r--r--klippy/chelper/__init__.py2
-rw-r--r--klippy/chelper/stepcompress.c15
-rw-r--r--klippy/chelper/stepcompress.h2
3 files changed, 19 insertions, 0 deletions
diff --git a/klippy/chelper/__init__.py b/klippy/chelper/__init__.py
index c94e9677..290234c5 100644
--- a/klippy/chelper/__init__.py
+++ b/klippy/chelper/__init__.py
@@ -49,6 +49,8 @@ defs_stepcompress = """
, uint64_t clock);
int stepcompress_queue_msg(struct stepcompress *sc
, uint32_t *data, int len);
+ int stepcompress_queue_mq_msg(struct stepcompress *sc, uint64_t req_clock
+ , uint32_t *data, int len);
int stepcompress_extract_old(struct stepcompress *sc
, struct pull_history_steps *p, int max
, uint64_t start_clock, uint64_t end_clock);
diff --git a/klippy/chelper/stepcompress.c b/klippy/chelper/stepcompress.c
index e261f1d3..e5514b95 100644
--- a/klippy/chelper/stepcompress.c
+++ b/klippy/chelper/stepcompress.c
@@ -623,6 +623,21 @@ stepcompress_queue_msg(struct stepcompress *sc, uint32_t *data, int len)
return 0;
}
+// Queue an mcu command that will consume space in the mcu move queue
+int __visible
+stepcompress_queue_mq_msg(struct stepcompress *sc, uint64_t req_clock
+ , uint32_t *data, int len)
+{
+ int ret = stepcompress_flush(sc, UINT64_MAX);
+ if (ret)
+ return ret;
+
+ struct queue_message *qm = message_alloc_and_encode(data, len);
+ qm->min_clock = qm->req_clock = req_clock;
+ list_add_tail(&qm->node, &sc->msg_queue);
+ return 0;
+}
+
// Return history of queue_step commands
int __visible
stepcompress_extract_old(struct stepcompress *sc, struct pull_history_steps *p
diff --git a/klippy/chelper/stepcompress.h b/klippy/chelper/stepcompress.h
index b8a95057..bfc0dfcd 100644
--- a/klippy/chelper/stepcompress.h
+++ b/klippy/chelper/stepcompress.h
@@ -29,6 +29,8 @@ int stepcompress_set_last_position(struct stepcompress *sc, uint64_t clock
int64_t stepcompress_find_past_position(struct stepcompress *sc
, uint64_t clock);
int stepcompress_queue_msg(struct stepcompress *sc, uint32_t *data, int len);
+int stepcompress_queue_mq_msg(struct stepcompress *sc, uint64_t req_clock
+ , uint32_t *data, int len);
int stepcompress_extract_old(struct stepcompress *sc
, struct pull_history_steps *p, int max
, uint64_t start_clock, uint64_t end_clock);