aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/msgproto.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-02-04 16:33:03 -0500
committerKevin O'Connor <kevin@koconnor.net>2021-02-18 15:21:32 -0500
commit81da5379d406236b8284921d34f23e877464db63 (patch)
tree5d48ff2fa546f1693f943faaa89fe61b9e829e76 /klippy/msgproto.py
parentefa497dfd86bc64b3f9b991f6fc1a10ff23f7596 (diff)
downloadkutter-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/msgproto.py')
-rw-r--r--klippy/msgproto.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/klippy/msgproto.py b/klippy/msgproto.py
index d1f461b8..c3c0cda9 100644
--- a/klippy/msgproto.py
+++ b/klippy/msgproto.py
@@ -357,14 +357,17 @@ class MessageParser:
start_value, count = value
for i in range(count):
enums[enum_root + str(start_enum + i)] = start_value + i
- def _init_messages(self, messages, command_ids=[], output_ids=[]):
- for msgformat, msgid in messages.items():
+ def _init_messages(self, messages, command_tags=[], output_tags=[]):
+ for msgformat, msgtag in messages.items():
msgtype = 'response'
- if msgid in command_ids:
+ if msgtag in command_tags:
msgtype = 'command'
- elif msgid in output_ids:
+ elif msgtag in output_tags:
msgtype = 'output'
- self.messages.append((msgid, msgtype, msgformat))
+ self.messages.append((msgtag, msgtype, msgformat))
+ if msgtag < -32 or msgtag > 95:
+ raise error("Multi-byte msgtag not supported")
+ msgid = msgtag & 0x7f
if msgtype == 'output':
self.messages_by_id[msgid] = OutputFormat(msgid, msgformat)
else: