aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/chelper
Commit message (Collapse)AuthorAgeFilesLines
* extruder: Allow dynamic adjustment of pressure advance (#6635)Dmitry Butyugin2024-07-112-15/+71
| | | Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* toolhead: Keep stepcompress move history relative to current time (#6439)Francois Chagnon2023-12-305-16/+35
| | | | | Expire history relative to current time rather than last move in history queue Signed-off-by: Francois Chagnon <fc@francoischagnon.net>
* serialqueue: Simplify sequence number upconversionKevin O'Connor2023-12-071-4/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Add support for queuing messages that consume move queue spaceKevin O'Connor2023-11-163-0/+19
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Eventually time out if unable to write CANbus messagesKevin O'Connor2023-10-041-0/+9
| | | | | | | | | | | | | Klipper logs an error on a failed CANbus write. Unfortunately, if the bus becomes permanently disabled (eg, due to a user removing power to devices on the CANbus) then it can result in the logs filling with error messages. Permanently disable the low-level processing of messages if CANbus writes continually fail for at least 10 seconds. This avoids filling the log with redundant messages. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* idex_modes: COPY and MIRROR mode implementation (#6297)Dmitry Butyugin2023-08-014-46/+95
| | | | | | | | | | | COPY and MIRROR mode implementation Correctly apply input shaper params to new dual_carriage Added SAVE_/RESTORE_IDEX_STATE commands Documentation updates for the new IDEX modes Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* input_shaper: Correctly initialize input shaper stepper_kinematicsDmitry Butyugin2023-06-061-0/+3
| | | | | | | | | If the stepper already executed some steps with the basic stepper_kinematics, subsequent creation of a new one for input_shaper would result in stepcompress errors unless position and time tracking flags are also copied over. Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* input_shaper: Fixed tracking of step_generation_scan_timeDmitry Butyugin2023-06-062-11/+6
| | | | Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* serialqueue: Rename stalled_bytes stat to upcoming_bytesKevin O'Connor2023-04-071-16/+16
| | | | | | | | | The stalled_bytes counter refers to the number of bytes that are not yet eligible for transmission. However, the naming leads to confusion as it could be interpretted as an inability to transmit data. Rename to upcoming_bytes to try to avoid that confusion. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chelper: Minor declaration movement in __init__.pyKevin O'Connor2023-01-071-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Minor code movement in trapq.cKevin O'Connor2023-01-072-53/+53
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Add comment to do_write()Kevin O'Connor2023-01-051-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* kinematics: Add deltesian printers (#5743)Tircown2022-09-012-4/+50
| | | | | Initial push of the working deltesian kinematics after some successful tests. Signed-off-by: Fabrice GALLET <tircown@gmail.com>
* serialqueue: Improve canbus timingKevin O'Connor2022-07-293-22/+47
| | | | | | | Adjust timing based on the minimum transmission time of canbus messages. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Add support for reversing the direction of extruder stepper movementKevin O'Connor2022-02-103-6/+19
| | | | | | | Extend SET_EXTRUDER_ROTATION_DISTANCE to support reversing the direction of extruder movement. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Don't store pressure_advance value in trapq movesKevin O'Connor2022-01-162-13/+19
| | | | | | | | | Store the pressure_advance value in "struct extruder_stepper" instead of in the trapq's "struct move". This makes it possible for multiple stepper motors to have different pressure advance values while still using the same trapq. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* input_shaper: Factored out AxisInputShaper classDmitry Butyugin2021-10-262-16/+15
| | | | Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* input_shaper: Define input shapers in a single place in Python codeDmitry Butyugin2021-10-262-211/+24
| | | | Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* trapq: Prune interrupted moves from history on trapq_set_position()Kevin O'Connor2021-08-061-1/+16
| | | | | | | | It is possible for a homing move to not fully complete. Fixup the trapq history to make processing of the history easier for callers. Similarly, do not add artificial "null" moves to the trapq history. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Pass clock to stepcompress_set_last_position()Kevin O'Connor2021-08-063-4/+5
| | | | | | | | | Using sc->last_step_clock for the last position marker does not work properly, because the stepper.py code calls stepcompress_reset() prior to calling stepcompress_set_last_position(). Fix by passing an explicit clock to stepcompress_set_last_position(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Support extracting stepcompress historyKevin O'Connor2021-07-293-4/+53
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Rename 'struct history_move' to 'struct history_steps'Kevin O'Connor2021-07-291-25/+25
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Store toolhead.set_position() updates in trapq historyKevin O'Connor2021-07-293-0/+21
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Keep history of recent trapq movesKevin O'Connor2021-07-293-4/+71
| | | | | | | Store trapq moves in a separate "history" list after each move is nominally expired. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Rename trapq_free_moves() to trapq_finalize_moves()Kevin O'Connor2021-07-293-4/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* kinematics: Add dual_carriage to hybrid-corexyz (#4296)Tircown2021-06-272-0/+40
| | | | | | | - Add dual_carriage abilities for hybrid-corexy and hybrid-corexz - Introduce the module idex_mode - Fix add_stepper to the correct rail in hybrid-corexy Signed-off-by: Fabrice GALLET <tircown@gmail.com>
* stepcompress: Add missing functions to stepcompress.hKevin O'Connor2021-06-111-0/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trdispatch: Support fast responses to trsync_state messagesKevin O'Connor2021-06-092-4/+244
| | | | | | | Add C code that can process trsync_state messages and dispatch responses with low-latency. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Add serialqueue_send_one() helper functionKevin O'Connor2021-06-092-5/+14
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Add "fast reader" supportKevin O'Connor2021-06-092-11/+69
| | | | | | | Add ability to run C code directly from the low-level socket reading thread. This enables host based low-latency handlers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgblock: Add clock estimation helper functionsKevin O'Connor2021-06-095-18/+61
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgblock: Add msgblock_decode()Kevin O'Connor2021-06-092-0/+34
| | | | | | | Add function that can parse a simple VLQ encoded message to an array of integers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgblock: Move message manipulation code from serialqueue.c to new msgblock.cKevin O'Connor2021-06-095-181/+201
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pollreactor: Move C pollreactor code from serialqueue.c to its own fileKevin O'Connor2021-06-094-201/+226
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Improve numerical stability of step+dir+step filterKevin O'Connor2021-04-111-1/+1
| | | | | | | Apply the step+dir+step filter even if, for some reason, a negative time is found. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Add support for tracking history of queue_step commandsKevin O'Connor2021-03-132-27/+120
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Support sending messages over a CAN busKevin O'Connor2021-03-133-27/+76
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: correctly report EOF errorsLasse Dalegaard2021-03-011-1/+4
| | | | | | | | | If `klippy` loses connection to a device, the next `read()` from the device file descriptor will result in a zero-byte result, i.e. an `EOF`. Right now this gives a confusing error message, so this simply handles the special case of `EOF` and outputs a better log message. Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
* chelper: Move logging_callback() to global scopeKevin O'Connor2021-03-011-4/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* buildcommands: Extend number of available mcu messages from 96 to 128Kevin O'Connor2021-02-183-14/+15
| | | | | | | | | | | 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>
* serialqueue: Batch multiple message blocks in a single write()Kevin O'Connor2021-02-121-29/+38
| | | | | | | | Some communication protocols are more efficient if fewer write() calls are invoked. If multiple message blocks can be sent at the same time then batch them into a single write() call. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Improve timing of sleep durationsKevin O'Connor2021-02-121-4/+10
| | | | | | | | If any callback is invoked from the pollreactor then obtain a new eventtime before calculating a sleep duration. This improves the timing of events. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chelper: Fix check for failed code buildKevin O'Connor2021-02-071-2/+11
| | | | | | | Commit 73b78af6 inadvertently removed the check for a successful gcc compilation. Add the check back in. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Improve checking of out-of-order messagesKevin O'Connor2021-02-011-15/+23
| | | | | | | Consider any message block that acks a message never sent as an out-of-order block and discard it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Convert iterative solver to use "secant method"Kevin O'Connor2020-11-021-100/+79
| | | | | | | | | | The previous code calculates each step time via an "exponential search" followed by a "false position with Illinois algorithm" search. Replace with a "secant method" with "bounds check" search. This simplifies the code, improves the performance, and does a better job of finding steps near a direction change. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Fix registration of serial fd in debug modeKevin O'Connor2020-10-301-5/+6
| | | | | | | | When in debug output mode, make sure to register the fd correctly. Otherwise, the poll() call will use the 0 fd which could cause random results. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* kin_extruder: Fix numerical stability when using pressure advanceKevin O'Connor2020-10-231-7/+11
| | | | | | | | | Avoid using the absolute E position when calculating pressure advance as that position can grow arbitrarily large, which can result in "numerical stability" problems. That instability could eventually lead to internal errors during step compression. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chelper: Add missing serialqueue_set_receive_window() def to serialqueue.hKevin O'Connor2020-09-261-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chelper: Use standard C type definition for pyhelper_logging_callbackKevin O'Connor2020-09-261-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chelper: Rework check for building C codeKevin O'Connor2020-09-261-22/+26
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>