aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/chelper/serialqueue.c
Commit message (Collapse)AuthorAgeFilesLines
* serialqueue: Add serialqueue_send_one() helper functionKevin O'Connor2021-06-091-5/+12
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Add "fast reader" supportKevin O'Connor2021-06-091-11/+56
| | | | | | | 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-091-16/+22
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgblock: Move message manipulation code from serialqueue.c to new msgblock.cKevin O'Connor2021-06-091-146/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pollreactor: Move C pollreactor code from serialqueue.c to its own fileKevin O'Connor2021-06-091-200/+25
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Support sending messages over a CAN busKevin O'Connor2021-03-131-25/+72
| | | | 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>
* 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>
* 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>
* 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>
* serialqueue: Support notification of when a command is processedKevin O'Connor2020-02-201-10/+45
| | | | | | | | | Add ability for the host code to get a notification when the ack for a command sent to the micro-controller is received. This is in preparation for improved detection of message loss between mcu and host. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Remove unused serialqueue_encode_and_send() functionKevin O'Connor2020-02-201-16/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Wrap code to 80 columnsKevin O'Connor2019-02-271-3/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Increase receive message debug queue to 100 messagesKevin O'Connor2018-09-021-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chelper: Compile with gcc -fwhole-program optionKevin O'Connor2018-06-201-13/+14
| | | | | | | Use the -fwhole-program option when compiling the host C code. This makes it easier to support inlining across C files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Limit message transmission to available receive buffer sizeKevin O'Connor2018-05-281-3/+20
| | | | | | | | | If the mcu is using a traditional serial port, then only send a new message block if there is space available in the mcu receive buffer. This should make it significantly less likely that high load on the mcu will result in retransmits. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Wait to send ack until after processing commandsKevin O'Connor2018-05-281-5/+9
| | | | | | | Send the ack after processing commands - this gives the host code more information on serial buffer utilization. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Fix batching of BACKGROUND_PRIORITY_CLOCK messagesKevin O'Connor2018-05-051-1/+2
| | | | | | | | | In order to properly delay BACKGROUND_PRIORITY_CLOCK messages, they must be 5ms beyond the minimum defined by MIN_REQTIME_DELTA. So, add both MIN_REQTIME_DELTA and MIN_BACKGROUND_DELTA to the timing of these messages. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chelper: Move the host C code to a new klippy/chelper/ directoryKevin O'Connor2018-04-301-0/+1090
Move the C code out of the main klippy/ directory and into its own directory. This reduces the clutter in the main klippy directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>