Currently, Klipper encodes multiple commands in message blocks.
Each message block can have a size of up to 64 bytes.
Where the usable bytes are: 59 = (MESSAGE_MAX - MESSAGE_HEADER_SIZE - MESSAGE_TRAILER_SIZE).
Which in the limit translates to 53 59 noop commands
Or most probably 10-20 normal ones.
In case of a CAN network, that message will be split into up to 8 CAN frames. Because each CAN frame can only transmit 8 data bytes.
On top of that, there is a sort of congestion control, which enforces waits between data sends, to allow the network and MCU to process the data.
Several packages can be transmitted simultaneously, up to MAX_PENDING_BLOCKS (12), which is a sort of TCP send window.
There can be errors in transmission due to different reasons. But as long as the line is working, some data should pass end-to-end.
I assume that 1 frame has a higher possible chance to pass end-to-end.
So, the basic idea is to provide a sort of feedback loop from the retransmit code to the send code.
(This is also a sort of congestion control).
If the line is ābadā, it should be possible to reduce the size of the following messages.
It is not possible to limit the real size, because some commands will not fit.
But it is possible to reduce the number of commands per message block.
Which in the end, could end up as 1 command per CAN frame.
Which sounds suboptimal, but it should allow the machine to progress farther, instead of retrying indefinitely and dying.
This is a PoC Patch V2
The main concern that I can see, and I agree with. This is not a fix for issues with communication. It will mask them, more than retry do.
Maybe fail early, fail fast, fail hard is still better here.
Also, there will be high transmission overhead, so with too bad communication lines, there will be a failure anyway.
Any thoughts?
Thanks.