diff --git a/module.json b/module.json index 57e5cae..b90fe24 100644 --- a/module.json +++ b/module.json @@ -1,6 +1,6 @@ { "name": "microbit-dal", - "version": "1.2.3", + "version": "1.2.4", "license": "Apache2", "description": "The runtime library for the BBC micro:bit, developed by Lancaster University", "keywords": [ diff --git a/source/MicroBitSuperMain.cpp b/source/MicroBitSuperMain.cpp index bb029db..857c0fc 100644 --- a/source/MicroBitSuperMain.cpp +++ b/source/MicroBitSuperMain.cpp @@ -60,18 +60,18 @@ int main() uBit.ble = new BLEDevice(); uBit.ble->init(); uBit.ble->onDisconnection(bleDisconnectionCallback); + + // Ensure we're advertising. + uBit.ble->accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); + uBit.ble->accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)MICROBIT_BLE_DEVICE_NAME, sizeof(MICROBIT_BLE_DEVICE_NAME)); + uBit.ble->setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); + uBit.ble->setAdvertisingInterval(Gap::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(200)); + uBit.ble->startAdvertising(); } if (!uBit.ble_firmware_update_service) uBit.ble_firmware_update_service = new MicroBitDFUService(*uBit.ble); - // Ensure we're advertising. - uBit.ble->accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); - uBit.ble->accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)MICROBIT_BLE_DEVICE_NAME, strlen(MICROBIT_BLE_DEVICE_NAME)+1); - uBit.ble->setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); - uBit.ble->setAdvertisingInterval(Gap::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(1000)); - uBit.ble->startAdvertising(); - // enter BLUE ZONE mode. uBit.ble_firmware_update_service->pair(); }