Skip to content

Commit 6c1433e

Browse files
Simplify the BLE - Device Info - Model Number to only indicate V2. (#255)
There is no need for BLE apps or devices to distinguish between different V2 versions, just as we currently don't differentiate between V1.3 and V1.5. Fixes #208 Related to #137
1 parent 3f551e2 commit 6c1433e

File tree

4 files changed

+7
-20
lines changed

4 files changed

+7
-20
lines changed

inc/bluetooth/MicroBitBLEManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class MicroBitBLEManager : public CodalComponent
123123
* bleManager.init(uBit.getName(), uBit.getSerial(), uBit.messageBus, true);
124124
* @endcode
125125
*/
126-
void init(ManagedString deviceName, ManagedString serialNumber, EventModel &messageBus, MicroBitStorage &keyValuestorage, bool enableBonding, uint16_t board = 0x9904);
126+
void init(ManagedString deviceName, ManagedString serialNumber, EventModel &messageBus, MicroBitStorage &keyValuestorage, bool enableBonding);
127127

128128
/**
129129
* Change the output power level of the transmitter to the given value.

model/MicroBit.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,6 @@ int MicroBit::init()
221221

222222
power.readInterfaceRequest();
223223

224-
#if CONFIG_ENABLED(DEVICE_BLE) && ( CONFIG_ENABLED(MICROBIT_BLE_PAIRING_MODE) || CONFIG_ENABLED(MICROBIT_BLE_ENABLED))
225-
MicroBitVersion version = power.getVersion();
226-
#endif
227-
228224
#if CONFIG_ENABLED(DEVICE_BLE) && CONFIG_ENABLED(MICROBIT_BLE_PAIRING_MODE)
229225
int i=0;
230226
// Test if we need to enter BLE pairing mode
@@ -255,7 +251,7 @@ int MicroBit::init()
255251
delete flashIncomplete;
256252

257253
// Start the BLE stack, if it isn't already running.
258-
bleManager.init( ManagedString( microbit_friendly_name()), getSerial(), messageBus, storage, true, version.board);
254+
bleManager.init( ManagedString( microbit_friendly_name()), getSerial(), messageBus, storage, true);
259255

260256
// Enter pairing mode, using the LED matrix for any necessary pairing operations
261257
bleManager.pairingMode(display, buttonA);
@@ -265,7 +261,7 @@ int MicroBit::init()
265261

266262
#if CONFIG_ENABLED(DEVICE_BLE) && CONFIG_ENABLED(MICROBIT_BLE_ENABLED)
267263
// Start the BLE stack, if it isn't already running.
268-
bleManager.init( ManagedString( microbit_friendly_name()), getSerial(), messageBus, storage, false, version.board);
264+
bleManager.init( ManagedString( microbit_friendly_name()), getSerial(), messageBus, storage, false);
269265
#endif
270266

271267
// Deschedule for a little while, just to allow for any components that finialise initialisation

source/MicroBitPowerManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ MicroBitVersion MicroBitPowerManager::getVersion()
116116
switch(version.board)
117117
{
118118
// V2.00 KL27
119-
case 39172:
119+
case 0x9904:
120120
status |= MICROBIT_USB_INTERFACE_ALWAYS_NOP;
121121
break;
122122

source/bluetooth/MicroBitBLEManager.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ DEALINGS IN THE SOFTWARE.
111111

112112
const char *MICROBIT_BLE_MANUFACTURER = NULL;
113113
const char *MICROBIT_BLE_MODEL = "BBC micro:bit";
114-
const char *MICROBIT_BLE_VERSION[2] = { "2.0", "2.X" };
115114
const char *MICROBIT_BLE_HARDWARE_VERSION = NULL;
116115
const char *MICROBIT_BLE_FIRMWARE_VERSION = MICROBIT_DAL_VERSION;
117116
const char *MICROBIT_BLE_SOFTWARE_VERSION = NULL;
@@ -229,7 +228,7 @@ MicroBitBLEManager *MicroBitBLEManager::getInstance()
229228
* bleManager.init(uBit.getName(), uBit.getSerial(), uBit.messageBus, true);
230229
* @endcode
231230
*/
232-
void MicroBitBLEManager::init( ManagedString deviceName, ManagedString serialNumber, EventModel &messageBus, MicroBitStorage &keyValueStorage, bool enableBonding, uint16_t board)
231+
void MicroBitBLEManager::init( ManagedString deviceName, ManagedString serialNumber, EventModel &messageBus, MicroBitStorage &keyValueStorage, bool enableBonding)
233232
{
234233
if ( this->status & DEVICE_COMPONENT_RUNNING)
235234
return;
@@ -436,18 +435,10 @@ void MicroBitBLEManager::init( ManagedString deviceName, ManagedString serialNum
436435

437436
#if CONFIG_ENABLED(MICROBIT_BLE_DEVICE_INFORMATION_SERVICE)
438437
MICROBIT_DEBUG_DMESG( "DEVICE_INFORMATION_SERVICE");
439-
440-
int versionIdx = 0;
441-
switch ( board)
442-
{
443-
case 0x9903:
444-
case 0x9904: break;
445-
default: versionIdx = 1; break;
446-
}
447438

448-
ManagedString modelVersion( MICROBIT_BLE_VERSION[versionIdx]);
439+
ManagedString modelVersion("V2");
449440
ManagedString disName( MICROBIT_BLE_MODEL);
450-
disName = disName + " V" + modelVersion;
441+
disName = disName + " " + modelVersion;
451442

452443
ble_dis_init_t disi;
453444
memset( &disi, 0, sizeof(disi));

0 commit comments

Comments
 (0)