diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-02-04 16:33:03 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-02-18 15:21:32 -0500 |
commit | 81da5379d406236b8284921d34f23e877464db63 (patch) | |
tree | 5d48ff2fa546f1693f943faaa89fe61b9e829e76 /klippy/chelper/stepcompress.c | |
parent | efa497dfd86bc64b3f9b991f6fc1a10ff23f7596 (diff) | |
download | kutter-81da5379d406236b8284921d34f23e877464db63.tar.gz kutter-81da5379d406236b8284921d34f23e877464db63.tar.xz kutter-81da5379d406236b8284921d34f23e877464db63.zip |
buildcommands: Extend number of available mcu messages from 96 to 128
Some internal code treats the message ids as encoded "variable length
quantities", while other internal code assumes the message id is
always one byte long. Continue using this scheme, but convert the VLQ
users to use the name "msgtag" while the 1-byte users use "msgid".
Increase the number of available msgids from 96 to 127 - the higher
values get encoded as negative "msgtags".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/chelper/stepcompress.c')
-rw-r--r-- | klippy/chelper/stepcompress.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/klippy/chelper/stepcompress.c b/klippy/chelper/stepcompress.c index 812a3b50..cd803ae7 100644 --- a/klippy/chelper/stepcompress.c +++ b/klippy/chelper/stepcompress.c @@ -1,6 +1,6 @@ // Stepper pulse schedule compression // -// Copyright (C) 2016-2020 Kevin O'Connor <kevin@koconnor.net> +// Copyright (C) 2016-2021 Kevin O'Connor <kevin@koconnor.net> // // This file may be distributed under the terms of the GNU GPLv3 license. @@ -36,7 +36,8 @@ struct stepcompress { // Message generation uint64_t last_step_clock; struct list_head msg_queue; - uint32_t queue_step_msgid, set_next_step_dir_msgid, oid; + uint32_t oid; + int32_t queue_step_msgtag, set_next_step_dir_msgtag; int sdir, invert_sdir; // Step+dir+step filter uint64_t next_step_clock; @@ -244,13 +245,13 @@ stepcompress_alloc(uint32_t oid) // Fill message id information void __visible stepcompress_fill(struct stepcompress *sc, uint32_t max_error - , uint32_t invert_sdir, uint32_t queue_step_msgid - , uint32_t set_next_step_dir_msgid) + , uint32_t invert_sdir, int32_t queue_step_msgtag + , int32_t set_next_step_dir_msgtag) { sc->max_error = max_error; sc->invert_sdir = !!invert_sdir; - sc->queue_step_msgid = queue_step_msgid; - sc->set_next_step_dir_msgid = set_next_step_dir_msgid; + sc->queue_step_msgtag = queue_step_msgtag; + sc->set_next_step_dir_msgtag = set_next_step_dir_msgtag; } // Free memory associated with a 'stepcompress' object @@ -307,7 +308,7 @@ queue_flush(struct stepcompress *sc, uint64_t move_clock) return ret; uint32_t msg[5] = { - sc->queue_step_msgid, sc->oid, move.interval, move.count, move.add + sc->queue_step_msgtag, sc->oid, move.interval, move.count, move.add }; struct queue_message *qm = message_alloc_and_encode(msg, 5); qm->min_clock = qm->req_clock = sc->last_step_clock; @@ -331,7 +332,7 @@ static int stepcompress_flush_far(struct stepcompress *sc, uint64_t abs_step_clock) { uint32_t msg[5] = { - sc->queue_step_msgid, sc->oid, abs_step_clock - sc->last_step_clock, + sc->queue_step_msgtag, sc->oid, abs_step_clock - sc->last_step_clock, 1, 0 }; struct queue_message *qm = message_alloc_and_encode(msg, 5); @@ -353,7 +354,7 @@ set_next_step_dir(struct stepcompress *sc, int sdir) if (ret) return ret; uint32_t msg[3] = { - sc->set_next_step_dir_msgid, sc->oid, sdir ^ sc->invert_sdir + sc->set_next_step_dir_msgtag, sc->oid, sdir ^ sc->invert_sdir }; struct queue_message *qm = message_alloc_and_encode(msg, 3); qm->req_clock = sc->last_step_clock; |