@@ -166,21 +166,28 @@ void bluetoothStart()
166166 else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_BLE)
167167 bluetoothSerial = new BTLESerial ();
168168
169- if (pinBluetoothTaskHandle == nullptr )
170- xTaskCreatePinnedToCore (
171- pinBluetoothTask,
172- " BluetoothStart " , // Just for humans
173- 2000 , // Stack Size
174- nullptr , // Task input parameter
175- 0 , // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest
176- &pinBluetoothTaskHandle, // Task handle
177- settings. bluetoothInterruptsCore ); // Core where task should run, 0=core, 1=Arduino
178-
179- while (bluetoothPinned == false ) // Wait for task to run once
180- delay ( 1 );
181-
169+ // Not yet implemented
170+ // if (pinBluetoothTaskHandle == nullptr)
171+ // xTaskCreatePinnedToCore(
172+ // pinBluetoothTask,
173+ // "BluetoothStart", // Just for humans
174+ // 2000 , // Stack Size
175+ // nullptr, // Task input parameter
176+ // 0, // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the
177+ // lowest &pinBluetoothTaskHandle, // Task handle settings.bluetoothInterruptsCore); //
178+ // Core where task should run, 0=core, 1=Arduino
179+
180+ // while (bluetoothPinned == false) // Wait for task to run once
181+ // delay(1);
182182
183+ if (bluetoothSerial->begin (deviceName) == false )
184+ {
185+ systemPrintln (" An error occurred initializing Bluetooth" );
183186
187+ if (productVariant == RTK_SURVEYOR)
188+ digitalWrite (pin_bluetoothStatusLED, LOW);
189+ return ;
190+ }
184191
185192 // Set PIN to 1234 so we can connect to older BT devices, but not require a PIN for modern device pairing
186193 // See issue: https://github.com/sparkfun/SparkFun_RTK_Firmware/issues/5
@@ -227,14 +234,13 @@ void bluetoothStart()
227234// https://github.com/espressif/arduino-esp32/issues/3386
228235void pinBluetoothTask (void *pvParameters)
229236{
237+ if (bluetoothSerial->begin (deviceName) == false )
238+ {
239+ systemPrintln (" An error occurred initializing Bluetooth" );
230240
231- if (bluetoothSerial->begin (deviceName) == false )
232- {
233- systemPrintln (" An error occurred initializing Bluetooth" );
234-
235- if (productVariant == RTK_SURVEYOR)
236- digitalWrite (pin_bluetoothStatusLED, LOW);
237- }
241+ if (productVariant == RTK_SURVEYOR)
242+ digitalWrite (pin_bluetoothStatusLED, LOW);
243+ }
238244
239245 bluetoothPinned = true ;
240246
@@ -252,7 +258,7 @@ void bluetoothStop()
252258 bluetoothSerial->flush (); // Complete any transfers
253259 bluetoothSerial->disconnect (); // Drop any clients
254260 bluetoothSerial->end (); // bluetoothSerial->end() will release significant RAM (~100k!) but a
255- // bluetoothSerial->start will crash.
261+ // bluetoothSerial->start will crash.
256262
257263 log_d (" Bluetooth turned off" );
258264
0 commit comments