Skip to content

Commit b449937

Browse files
committed
Small rearrangement
1 parent 9d16ac9 commit b449937

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

teslausb-www/html/index.html

+13-17
Original file line numberDiff line numberDiff line change
@@ -1433,31 +1433,27 @@
14331433
result = request.responseText;
14341434
} else {
14351435
log("unexpected pairing response");
1436-
window.setTimeout(function() { waitforpairing(button, count + 1); }, 5000);
1437-
return;
1436+
result = "";
14381437
}
14391438

14401439
if (result.indexOf("<p>paired</p>") > 0) {
1440+
log("pairing succeeded");
14411441
var msg=document.getElementById('pairtext');
14421442
msg.textContent="Successfully paired with car.";
1443-
button.disabled=false;
1444-
button.textContent="Pair BLE with Car";
1445-
setbuttonsdisabled('group1', false);
1446-
setbuttonsdisabled('group2', false);
1443+
} else if (count > 12) {
1444+
log("pairing failed");
1445+
var msg=document.getElementById('pairtext');
1446+
msg.textContent="Pairing failed. Please try again.";
14471447
} else {
1448-
if (count > 12) {
1449-
log("pairing failed");
1450-
var msg=document.getElementById('pairtext');
1451-
msg.textContent="Pairing failed. Please try again.";
1452-
button.disabled=false;
1453-
button.textContent="Pair BLE with Car";
1454-
setbuttonsdisabled('group1', false);
1455-
setbuttonsdisabled('group2', false);
1456-
return;
1457-
}
1458-
log("waiting for pairing");
1448+
log("Still waiting for pairing");
14591449
window.setTimeout(function() { waitforpairing(button, count + 1); }, 5000);
1450+
return;
14601451
}
1452+
1453+
button.disabled = false;
1454+
button.textContent = "Pair BLE with Car";
1455+
setbuttonsdisabled('group1', false);
1456+
setbuttonsdisabled('group2', false);
14611457
}
14621458
}
14631459
request.send();

0 commit comments

Comments
 (0)