aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/chelper
diff options
context:
space:
mode:
Diffstat (limited to 'klippy/chelper')
-rw-r--r--klippy/chelper/serialqueue.c17
-rw-r--r--klippy/chelper/serialqueue.h2
2 files changed, 14 insertions, 5 deletions
diff --git a/klippy/chelper/serialqueue.c b/klippy/chelper/serialqueue.c
index bee39837..b74605ff 100644
--- a/klippy/chelper/serialqueue.c
+++ b/klippy/chelper/serialqueue.c
@@ -781,6 +781,17 @@ serialqueue_send_batch(struct serialqueue *sq, struct command_queue *cq
kick_bg_thread(sq);
}
+// Helper to send a single message
+void
+serialqueue_send_one(struct serialqueue *sq, struct command_queue *cq
+ , struct queue_message *qm)
+{
+ struct list_head msgs;
+ list_init(&msgs);
+ list_add_tail(&qm->node, &msgs);
+ serialqueue_send_batch(sq, cq, &msgs);
+}
+
// Schedule the transmission of a message on the serial port at a
// given time and priority.
void __visible
@@ -792,11 +803,7 @@ serialqueue_send(struct serialqueue *sq, struct command_queue *cq, uint8_t *msg
qm->min_clock = min_clock;
qm->req_clock = req_clock;
qm->notify_id = notify_id;
-
- struct list_head msgs;
- list_init(&msgs);
- list_add_tail(&qm->node, &msgs);
- serialqueue_send_batch(sq, cq, &msgs);
+ serialqueue_send_one(sq, cq, qm);
}
// Return a message read from the serial port (or wait for one if none
diff --git a/klippy/chelper/serialqueue.h b/klippy/chelper/serialqueue.h
index 9e66e7f5..724a86a5 100644
--- a/klippy/chelper/serialqueue.h
+++ b/klippy/chelper/serialqueue.h
@@ -36,6 +36,8 @@ void serialqueue_add_fastreader(struct serialqueue *sq, struct fastreader *fr);
void serialqueue_rm_fastreader(struct serialqueue *sq, struct fastreader *fr);
void serialqueue_send_batch(struct serialqueue *sq, struct command_queue *cq
, struct list_head *msgs);
+void serialqueue_send_one(struct serialqueue *sq, struct command_queue *cq
+ , struct queue_message *qm);
void serialqueue_send(struct serialqueue *sq, struct command_queue *cq
, uint8_t *msg, int len, uint64_t min_clock
, uint64_t req_clock, uint64_t notify_id);