From c85b6f95079852ea007da53cd1ec516abeccb7f2 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Wed, 7 Dec 2016 11:37:33 -0800 Subject: [PATCH] using calibrated powers for Eddystone --- libs/bluetooth/bluetooth.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/bluetooth/bluetooth.cpp b/libs/bluetooth/bluetooth.cpp index e1f2db3e..75622de9 100644 --- a/libs/bluetooth/bluetooth.cpp +++ b/libs/bluetooth/bluetooth.cpp @@ -120,6 +120,7 @@ namespace bluetooth { registerWithDal(MICROBIT_ID_BLE, MICROBIT_BLE_EVT_DISCONNECTED, body); } + const int8_t CALIBRATED_POWERS[] = {-49, -37, -33, -28, -25, -20, -15, -10}; /** * Advertise an Eddystone URL * @param url the url to transmit. Must be no longer than the supported eddystone url length, eg: "https://pxt.io/" @@ -131,7 +132,7 @@ namespace bluetooth { //% help=bluetooth/advertise-url blockExternalInputs=1 void advertiseUrl(StringData* url, int power, bool connectable) { power = min(MICROBIT_BLE_POWER_LEVELS-1, max(0, power)); - int8_t level = MICROBIT_BLE_POWER_LEVEL[power]; + int8_t level = CALIBRATED_POWERS[power]; uBit.bleManager.advertiseEddystoneUrl(ManagedString(url), level, connectable); uBit.bleManager.setTransmitPower(power); }