aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/msgproto.py
Commit message (Collapse)AuthorAgeFilesLines
* msgproto: Fix return type for create_command()Kevin O'Connor2024-11-131-1/+1
| | | | | | | Return an empty list instead of an emptry string if no command found. This improves compatibility within console.py on python3. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Support multi-byte command and response idsKevin O'Connor2024-06-101-31/+30
| | | | | | | | Update the msgproto.py code so that it can support message ids that are larger than a single byte. (The host C code in klippy/chelper/msgblock.c already supports multi-byte ids.) Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Move lookup_command_tag() to CommandWrapper classKevin O'Connor2023-02-221-0/+7
| | | | | | | | Use mcu.lookup_command().get_command_tag() instead of mcu.lookup_command_tag(). This improves error reporting on a protocol mismatch. It also enables support for a msgtag that is negative. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* parsedump: Support running on both python2 and python3Kevin O'Connor2022-12-071-10/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_flash: Make SD updates more tolerant of flaky boardsJustin Schuh2021-07-201-0/+2
| | | | | | | | | | Validation passes if either of the following succeeds (in order): 1. Active firmware's raw dictionary changed after update 2. Checksum of firmware.cur matches expected Additionally, deletes firmware.bin if found after update succeeds. Signed-off-by: Justin Schuh <code@justinschuh.com>
* mcu: Raise config_error (not protocol error) on pin enumeration errorsKevin O'Connor2021-06-091-8/+16
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Support prepending a warn_prefix to error and log messagesKevin O'Connor2021-06-091-15/+18
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* buildcommands: Extend number of available mcu messages from 96 to 128Kevin O'Connor2021-02-181-5/+8
| | | | | | | | | | | 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>
* msgproto: Avoid peeking into the msgproto class membersKevin O'Connor2021-02-181-28/+42
| | | | | | | Update callers to only use exported methods of the msgproto objects. This makes it easier to make internal changes to the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Improve Python3 compatibilityKevin O'Connor2020-06-151-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: unresolved symbol fixedPetri Honkala2019-11-151-1/+1
| | | | Signed-off-by: Petri Honkala <cruwaller@gmail.com>
* bus: Support bus enumerations and add support for reserved pinsKevin O'Connor2019-04-041-0/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Propagate original error message in create_command()Kevin O'Connor2019-03-281-0/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Convert static strings to a more generic enumeration systemKevin O'Connor2019-03-171-28/+79
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* buildcommands: Use dictionaries to describe commands, responses, and outputKevin O'Connor2019-03-171-9/+12
| | | | | | | Avoid transmitting lists of message ids for commands and responses - gzip doesn't do a good job of compressing them. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Wrap code to 80 columnsKevin O'Connor2019-02-271-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Add support for a get_constant_int() methodKevin O'Connor2018-05-281-10/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Support sending empty strings from create_message()Kevin O'Connor2018-05-071-1/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Add a wrapper around the results of lookup_command()Kevin O'Connor2018-02-271-1/+1
| | | | | | | | Add a lookup_command() method to the SerialReader class that provides a wrapper that stores the serial and commandqueue references. This makes it easier to run the send() method. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Support default values in get_constant() callsKevin O'Connor2018-01-291-5/+9
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Add gcc and binutils version to mcu data dictionaryKevin O'Connor2017-12-211-1/+2
| | | | | | | | Store the gcc and binutils versions used in the compilation of the firmware in the firmware data dictionary. Forward that information to the log so it is available during debugging. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Avoid using '%' syntax when calling logging moduleKevin O'Connor2017-09-271-1/+1
| | | | | | | The logging module can build strings directly from printf syntax - no need to build the string first. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* console: Add LIST command that shows available commands and variablesKevin O'Connor2017-08-081-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Catch exceptions during identify data parsingKevin O'Connor2017-07-041-12/+18
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Export static_strings from mcu to host as a dictionaryKevin O'Connor2017-07-021-3/+4
| | | | | | Export the static strings as a dictionary instead of as a list. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Remove some obscure python2 dependenciesKevin O'Connor2017-06-101-1/+1
| | | | | | | Don't modify dictionaries while iterating them and be careful to use // when doing an integer divide. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Wrap strings passed via output() in repr()Kevin O'Connor2017-05-021-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Rework dump() so it also works with paramsKevin O'Connor2017-04-251-21/+24
| | | | | | | | | Always call the regular .parse() method for each message type during dump() - add a new .format_params() method for dumping a verbose representation of the parsed message. This allows the new format_params() to also be used with data already parsed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Support reset commandKevin O'Connor2017-04-131-0/+1
| | | | | | | Extend the FIRMWARE_RESTART command so that it can use the firmware "reset" command instead of the "arduino" mechanism. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Warn the user on common errors due to old firmwareKevin O'Connor2017-01-101-0/+12
| | | | | | | | Check for msgproto.error and warn the user about version firmware version mismatch. Raise msgproto.error when extracting firmware constants. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: No need to define __str__ and __init__ methods on exception classesKevin O'Connor2016-11-291-4/+1
| | | | | | The base Exception class already defines these methods. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Initial commit of source code.Kevin O'Connor2016-05-251-0/+313
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>