Skip to content

Commit 47cdf22

Browse files
committed
Rename devices after successful paired connection
1 parent ab8d4f7 commit 47cdf22

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Firmware/BlueSMiRF-v2/Bluetooth.ino

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ void bluetoothBegin()
8686
bluetoothStartTasks();
8787
bluetoothState = BT_CONNECTED;
8888
ledState = LED_CONNECTED;
89+
90+
// Change broadcast name to '-Paired'
91+
if (bluetoothSetBroadcastName(broadcastNamePaired) == false)
92+
systemPrintln("An error occurred setting broadcast name");
93+
8994
return;
9095
}
9196

@@ -100,6 +105,11 @@ void bluetoothBegin()
100105
bluetoothStartTasks();
101106
bluetoothState = BT_CONNECTED;
102107
ledState = LED_CONNECTED;
108+
109+
// Change broadcast name to '-Paired'
110+
if (bluetoothSetBroadcastName(broadcastNamePaired) == false)
111+
systemPrintln("An error occurred setting broadcast name");
112+
103113
return;
104114
}
105115

@@ -303,7 +313,7 @@ bool connectToDeviceMac(uint8_t *macAddress, int maxTries)
303313
bluetoothSerial->end();
304314

305315
// Start BT in master mode with the name '-Paired'
306-
if(bluetoothSerial->begin(broadcastNamePaired, true, settings.btRxSize, settings.btTxSize) == false)
316+
if (bluetoothSerial->begin(broadcastNamePaired, true, settings.btRxSize, settings.btTxSize) == false)
307317
{
308318
systemPrintln("An error occurred initializing Bluetooth in master mode");
309319
return (false);
@@ -322,7 +332,7 @@ bool connectToDeviceMac(uint8_t *macAddress, int maxTries)
322332
if (settings.debugBluetooth == true)
323333
systemPrintln("Connected!");
324334

325-
bluetoothState = BT_CONNECTED;
335+
bluetoothState = BT_CONNECTED;
326336
return (true);
327337
}
328338
}
@@ -357,7 +367,7 @@ bool connectToDeviceName(char *deviceName, int maxTries)
357367
bluetoothSerial->end();
358368

359369
// Start BT in master mode with the name '-Paired'
360-
if(bluetoothSerial->begin(broadcastNamePaired, true, settings.btRxSize, settings.btTxSize) == false)
370+
if (bluetoothSerial->begin(broadcastNamePaired, true, settings.btRxSize, settings.btTxSize) == false)
361371
{
362372
systemPrintln("An error occurred initializing Bluetooth in master mode");
363373
return (false);

0 commit comments

Comments
 (0)