Skip to content

Commit a1ec83f

Browse files
committed
Stop provisioning process once limit is reached.
Fix #319
1 parent 20ae5c6 commit a1ec83f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Firmware/RTK_Everywhere/menuPP.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ bool pointperfectProvisionDevice()
221221

222222
do
223223
{
224+
provisionAttempt++;
225+
224226
char hardwareID[15];
225227
snprintf(hardwareID, sizeof(hardwareID), "%02X%02X%02X%02X%02X%02X%02X", btMACAddress[0], btMACAddress[1],
226228
btMACAddress[2], btMACAddress[3], btMACAddress[4], btMACAddress[5],
@@ -342,6 +344,7 @@ bool pointperfectProvisionDevice()
342344
landingPageUrl, hardwareID);
343345

344346
displayAccountExpired(5000);
347+
break;
345348
}
346349
else if (ztpResponse == ZTP_NOT_WHITELISTED)
347350
{
@@ -362,6 +365,7 @@ bool pointperfectProvisionDevice()
362365
landingPageUrl, hardwareID);
363366

364367
displayNotListed(5000);
368+
break;
365369
}
366370
else if (ztpResponse == ZTP_ALREADY_REGISTERED)
367371
{
@@ -373,11 +377,11 @@ bool pointperfectProvisionDevice()
373377
systemPrintf("This device is registered on a different profile. Please contact "
374378
"[email protected] for more assistance. Please reference device ID: %s\r\n",
375379
hardwareID);
380+
break;
376381
}
377382
else if (ztpResponse == ZTP_RESPONSE_TIMEOUT)
378383
{
379384
// The WiFi failed to connect in a timely manner to the API.
380-
provisionAttempt++;
381385
if (provisionAttempt < maxProvisionAttempts)
382386
systemPrintf("Provision server response timed out. Trying again.\r\n");
383387
else
@@ -386,7 +390,6 @@ bool pointperfectProvisionDevice()
386390
else
387391
{
388392
// Unknown error
389-
provisionAttempt++;
390393
if (provisionAttempt < maxProvisionAttempts)
391394
systemPrintf("Unknown provisioning error. Trying again.\r\n");
392395
else

0 commit comments

Comments
 (0)