handle arbitration loss

This commit is contained in:
john30
2017-04-17 21:08:41 +02:00
parent f252b079b1
commit e1030c7889
+9 -3
View File
@@ -92,7 +92,7 @@ $input=$hexinput="";
echo "server: running\n";
$endtime=time()+15;
$firstsend=time()+5;
$secondsend=time()+10;
$secondsend=$firstsend+5;
$expectnext="";
$error=0;
while (time()<$endtime) {
@@ -104,8 +104,14 @@ while (time()<$endtime) {
echo "server: <$output\n";
if ($expectnext) {
if ($expectnext!=$output) {
echo "server: error unexpected answer (should be $expectnext)\n";
$error=1;
if (substr($output,0,2)!='ff') {
echo "server: arbitration lost for ".substr($output,0,2).", retry\n";
$firstsend=time()+5;
$secondsend=$firstsend+5;
} else {
echo "server: error unexpected answer (should be $expectnext)\n";
$error=1;
}
}
$expectnext="";
}