Closed hmueller01 closed 5 years ago
Did you also try out a EOT;EOT; SYNC; SYNC scheme instead of your EOT;SYNC;EOT;SYNC?
I'm asking, because the Vitosoft Demo communications I logged show the former:
...
2017/12/05 21:32:11 term 05 |.|
2017/12/05 21:32:13 term 05 |.|
2017/12/05 21:32:15 tcp 04 |.|
2017/12/05 21:32:15 term 05 |.|
2017/12/05 21:32:16 tcp 04 |.|
2017/12/05 21:32:18 term 05 |.|
2017/12/05 21:32:18 tcp 16 |.|
2017/12/05 21:32:18 tcp 00 |.|
2017/12/05 21:32:18 tcp 00 |.|
2017/12/05 21:32:18 term 06 |.|
2017/12/05 21:32:18 tcp 16 |.|
2017/12/05 21:32:18 tcp 00 00 |..|
2017/12/05 21:32:18 term 06 |.|
2017/12/05 21:32:19 tcp 41 |A|
2017/12/05 21:32:19 tcp 05 00 01 00 f0 02 f8 |.......|
2017/12/05 21:32:19 term 06 41 06 03 01 00 f0 01 |.A......|
2017/12/05 21:32:19 term 01 fc |..|
2017/12/05 21:32:19 tcp 06 |.|
2017/12/05 21:32:19 tcp 41 |A|
2017/12/05 21:32:19 tcp 05 |.|
...
No, I did not try this. This is really interesting. But does it really make sense? As far as I understand an EOT;SYNC sequence is needed to start communication. If a bit is wrong the sequence needs to be repeated. For me it makes no sense to send EOT;EOT;SYNC;SYNC. If the second EOT is wrong transmitted (e.g. 0x14) we have no reset and SYNC might not work (as shown in my logs). What do you think?
In your sequence, a successful switch to P300 is depending solely on the last SYNC, as previous SYNC state gets reset by the preceding EOT.
So I have no preference. Let's stick to you sequence, as you already implemented it.
The for
loop is stopped after the first successful (answer 0x06) of the EOT;SYNC sequence. So, if the communication path is stable only one EOT;SYNC block is send. If this fails another EOT;SYNC block is send and so on. Until a successful sync or the max. attempts are done. It is strange why Vitosoft Demo sends two SYNC frames, even the first SYNC is ACK (0x06). Sending two EOTs might making the stop more robust as there is no answer (the 0x05 answer is send by vito periodic). If you like I can try this.
I have seen in my logs that the repeated sending of the sync sequence
0x16 0x00 0x00
is not enough if the EOT (0x04
) was not received by vitronic.So I propose to send the EOT in all (currently 3) attempts first before sending the sync sequence. This helps in my case that P300 communication can be established.
PS: Sorry, I branched this from my previous formatting branch #36.