Tune the protocol for a more reliable and efficient data transfer in case of a slow target with a single byte buffer in its serial port (high risk of character lost by the target):
- Extend immediate value to a stack of two values (full & consistent reverse polish logic)
- Index of command is the previous immediate value - consumed by the command
- Remove suffixes to allow any command to end a token and make space optional
- Define 'X' as token restart (upon token error)
- Add echo from target to any character from host
- Except on invalid token when echo is 'X' in place of the faulty character
- Wait for echo before sending next token character
- Resend no echoed character after timeout (limit number of tries)
- Cancel current token whenever echo is 'X'
- Retry cancelled token (limit number of tries)
- No more status returned for immediate command
- Redefine 'Z' as completion event for delayed command
Examples before tuning:
'J0 ' returns '12 Z0 '
'12 K0 ' returns 'Z0 Z0 '
'1234 S 5678 O R R R ' returns 'Z0 Z0 Z0 Z0 AA Z0 BB Z0 CC Z0 '
'1234 S 5678 O AA W BB W CC W ' returns 'Z0 Z0 Z0 Z0 Z0 Z0 Z0 Z0 Z0 Z0 '
'1234 S 5678 O P ' returns 'Z0 Z0 Z0 Z0 Z0 '
'T ' returns 'Z0 Zx '
And after tuning:
'0J' returns '0J12 '
'12 0K' returns '12 0K'
'1234S5678ORRR' returns '1234S5678ORAA RBB RCC ' (-50% from host / -33% from target)
'1234S5678OAAWBBWCCW' returns '1234S5678OAAWBBWCCW' (-40% from host / -50% from target)
'1234S5678OP' returns '1234S5678OP...Z'
'T' returns 'T...xZ''
Tune the protocol for a more reliable and efficient data transfer in case of a slow target with a single byte buffer in its serial port (high risk of character lost by the target):
Examples before tuning:
And after tuning: