@@ -177,6 +177,10 @@ void menuPointPerfectKeys()
177177bool pointperfectProvisionDevice ()
178178{
179179#ifdef COMPILE_WIFI
180+ bool bluetoothOriginallyConnected = false ;
181+ if (bluetoothState == BT_CONNECTED)
182+ bluetoothOriginallyConnected = true ;
183+
180184 bluetoothStop (); // Free heap before starting secure client (requires ~70KB)
181185
182186 DynamicJsonDocument *jsonZtp = nullptr ;
@@ -202,7 +206,6 @@ bool pointperfectProvisionDevice()
202206 char givenName[100 ];
203207 char versionString[9 ];
204208 getFirmwareVersion (versionString, sizeof (versionString), false );
205- systemPrintf (" versionString: %s\r\n " , versionString);
206209
207210 if (productVariant == RTK_FACET_LBAND)
208211 {
@@ -334,7 +337,8 @@ bool pointperfectProvisionDevice()
334337 if (jsonZtp)
335338 delete jsonZtp;
336339
337- bluetoothStart ();
340+ if (bluetoothOriginallyConnected == true )
341+ bluetoothStart ();
338342
339343 return (retVal);
340344#else // COMPILE_WIFI
@@ -433,6 +437,10 @@ void erasePointperfectCredentials()
433437bool pointperfectUpdateKeys ()
434438{
435439#ifdef COMPILE_WIFI
440+ bool bluetoothOriginallyConnected = false ;
441+ if (bluetoothState == BT_CONNECTED)
442+ bluetoothOriginallyConnected = true ;
443+
436444 bluetoothStop (); // Release available heap to allow room for TLS
437445
438446 char *certificateContents = nullptr ; // Holds the contents of the keys prior to MQTT connection
@@ -550,7 +558,8 @@ bool pointperfectUpdateKeys()
550558 if (certificateContents)
551559 free (certificateContents);
552560
553- bluetoothStart ();
561+ if (bluetoothOriginallyConnected == true )
562+ bluetoothStart ();
554563
555564 // Return the key status
556565 return (gotKeys);
0 commit comments