@@ -475,18 +475,13 @@ void setup()
475475 metaRxChar.setWriteCallback (handleMetaWritten);
476476 disableMagnetometerRx.setWriteCallback (handleDisableMagnetometerRxWritten);
477477
478- #if 0
479- // Start the core BLE engine.
480- if (!BLE.begin())
481- {
482- Serial.println("Failed to initialized BLE!");
483- setState(ERROR_STATE);
484- while (1) showErrorLed();
485- }
486- #endif
487478
488- #if 0
489- String address = BLE.address();
479+ uint8_t mac[6 ];
480+ char mac_str[20 ];
481+ Bluefruit.getAddr (mac);
482+ sprintf (mac_str, " %02X:%02X:%02X:%02X:%02X:%02X" , mac[5 ], mac[4 ], mac[3 ], mac[2 ], mac[1 ], mac[0 ]);
483+
484+ String address (mac_str);
490485
491486 // Output BLE settings over Serial.
492487 Serial.print (" address = " );
@@ -506,17 +501,13 @@ void setup()
506501
507502 Serial.print (" localName = " );
508503 Serial.println (deviceName);
504+
509505 // Set up properties for the whole service.
510- BLE.setLocalName(deviceName.c_str());
511- BLE.setDeviceName(deviceName.c_str());
512- BLE.setAdvertisedService(service);
513- #endif
506+ Bluefruit.setName (deviceName.c_str ());
514507
515508 // Advertising packet
516509 Bluefruit.Advertising .addFlags (BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
517510 Bluefruit.Advertising .addTxPower ();
518-
519- // Include bleuart 128-bit uuid
520511 Bluefruit.Advertising .addService (service);
521512
522513 // Secondary Scan Response packet (optional)
0 commit comments