diff --git a/CHANGELOG.md b/CHANGELOG.md
index a5f6fa74..9369cff7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated kit purchasing links.
- MIN_ERG_CADENCE created and changed from 20 to 30.
- Fixed DNS server in AP mode.
+- Fixed an issue with IC4 and variants not displaying device name in Bluetooth scanner. Fixes #500
### Hardware
- Wire diameter reduced from 7.2mm to 6.0mm on the window passthrough to accommodate the latest batch of cables.
diff --git a/data/bluetoothscanner.html b/data/bluetoothscanner.html
index 5c92e7ab..27d41497 100644
--- a/data/bluetoothscanner.html
+++ b/data/bluetoothscanner.html
@@ -177,7 +177,6 @@
else if (t_obj[key].address) {
optionRemote.text = t_obj[key].address;
}
- optionRemote.selected;
remoteDropdown.add(optionRemote);
}
}
@@ -202,6 +201,7 @@
let noneOptionHR = document.createElement('option');
noneOptionHR.text = 'none';
let noneOptionRemote = document.createElement('option');
+ noneOptionRemote.selected;
noneOptionRemote.text = 'none';
PMDropdown.add(noneOptionPM);
HRDropdown.add(noneOptionHR);
diff --git a/lib/SS2K/include/Constants.h b/lib/SS2K/include/Constants.h
index faa52a13..e32cba0a 100644
--- a/lib/SS2K/include/Constants.h
+++ b/lib/SS2K/include/Constants.h
@@ -13,13 +13,16 @@
#define SMARTSPIN2K_SERVICE_UUID NimBLEUUID("77776277-7877-7774-4466-896665500000")
#define SMARTSPIN2K_CHARACTERISTIC_UUID NimBLEUUID("77776277-7877-7774-4466-896665500001")
+// Device Information Service
+#define DEVICEINFORMATIONSERVICE_UUID NimBLEUUID((uint16_t)0x180A)
+
// Heart Service
#define HEARTSERVICE_UUID NimBLEUUID((uint16_t)0x180D)
#define HEARTCHARACTERISTIC_UUID NimBLEUUID((uint16_t)0x2A37)
-//BatteryLevel Service
-#define BATTERYSERVICE_UUID NimBLEUUID((uint16_t)0x180F) // heart rate sensor service uuid, as defined in gatt specifications
-#define BATTERYCHARACTERISTIC_UUID NimBLEUUID ((uint16_t)0x2A19)
+// BatteryLevel Service
+#define BATTERYSERVICE_UUID NimBLEUUID((uint16_t)0x180F) // heart rate sensor service uuid, as defined in gatt specifications
+#define BATTERYCHARACTERISTIC_UUID NimBLEUUID((uint16_t)0x2A19)
// Cycling Power Service
#define CSCSERVICE_UUID NimBLEUUID((uint16_t)0x1816)
@@ -66,21 +69,21 @@
#define PELOTON_REQ_POS 1
#define PELOTON_CHECKSUM_POS 2
-//BLE HID
-#define APPEARANCE_HID_GENERIC_UUID NimBLEUUID((uint16_t)0x3C0)
-#define APPEARANCE_HID_KEYBOARD_UUID NimBLEUUID((uint16_t)0x3C1)
-#define APPEARANCE_HID_MOUSE_UUID NimBLEUUID((uint16_t) 0x3C2)
-#define APPEARANCE_HID_JOYSTICK_UUID NimBLEUUID((uint16_t)0x3C3)
-#define APPEARANCE_HID_GAMEPAD_UUID NimBLEUUID((uint16_t)0x3C4)
-#define APPEARANCE_HID_DIGITIZER_TABLET_UUID NimBLEUUID((uint16_t)0x3C5)
-#define APPEARANCE_HID_CARD_READER_UUID NimBLEUUID((uint16_t)0x3C6)
-#define APPEARANCE_HID_DIGITAL_PEN_UUID NimBLEUUID((uint16_t)0x3C7)
-#define APPEARANCE_HID_BARCODE_SCANNER_UUID NimBLEUUID((uint16_t)0x3C8)
-#define APPEARANCE_HID_TOUCHPAD_UUID NimBLEUUID((uint16_t)0x3C9)
-#define APPEARANCE_HID_PRESENTATION_REMOTE_UUID NimBLEUUID((uint16_t)0x3CA)
+// BLE HID
+#define APPEARANCE_HID_GENERIC_UUID NimBLEUUID((uint16_t)0x3C0)
+#define APPEARANCE_HID_KEYBOARD_UUID NimBLEUUID((uint16_t)0x3C1)
+#define APPEARANCE_HID_MOUSE_UUID NimBLEUUID((uint16_t)0x3C2)
+#define APPEARANCE_HID_JOYSTICK_UUID NimBLEUUID((uint16_t)0x3C3)
+#define APPEARANCE_HID_GAMEPAD_UUID NimBLEUUID((uint16_t)0x3C4)
+#define APPEARANCE_HID_DIGITIZER_TABLET_UUID NimBLEUUID((uint16_t)0x3C5)
+#define APPEARANCE_HID_CARD_READER_UUID NimBLEUUID((uint16_t)0x3C6)
+#define APPEARANCE_HID_DIGITAL_PEN_UUID NimBLEUUID((uint16_t)0x3C7)
+#define APPEARANCE_HID_BARCODE_SCANNER_UUID NimBLEUUID((uint16_t)0x3C8)
+#define APPEARANCE_HID_TOUCHPAD_UUID NimBLEUUID((uint16_t)0x3C9)
+#define APPEARANCE_HID_PRESENTATION_REMOTE_UUID NimBLEUUID((uint16_t)0x3CA)
-#define HID_SERVICE_UUID NimBLEUUID((uint16_t)0x1812)
-#define HID_INFORMATION_UUID NimBLEUUID((uint16_t)0x2A4A)
-#define HID_REPORT_MAP_UUID NimBLEUUID((uint16_t)0x2A4B)
+#define HID_SERVICE_UUID NimBLEUUID((uint16_t)0x1812)
+#define HID_INFORMATION_UUID NimBLEUUID((uint16_t)0x2A4A)
+#define HID_REPORT_MAP_UUID NimBLEUUID((uint16_t)0x2A4B)
#define HID_CONTROL_POINT_UUID NimBLEUUID((uint16_t)0x2A4C)
-#define HID_REPORT_DATA_UUID NimBLEUUID((uint16_t)0x2A4D)
+#define HID_REPORT_DATA_UUID NimBLEUUID((uint16_t)0x2A4D)
diff --git a/src/BLE_Client.cpp b/src/BLE_Client.cpp
index 9bf82a58..0a306941 100644
--- a/src/BLE_Client.cpp
+++ b/src/BLE_Client.cpp
@@ -467,7 +467,14 @@ void SpinBLEClient::scanProcess(int duration) {
}
if (d.haveServiceUUID()) {
- devices[device]["UUID"] = d.getServiceUUID().toString();
+ // Workaround for IC4 advertising this service first instead of FTMS.
+ // Potentially others may need to be added in the future.
+ // The symptom was the bike name not showing up in the HTML.
+ if (d.getServiceUUID() == DEVICEINFORMATIONSERVICE_UUID) {
+ devices[device]["UUID"] = FITNESSMACHINESERVICE_UUID.toString();
+ } else {
+ devices[device]["UUID"] = d.getServiceUUID().toString();
+ }
}
}
}
@@ -532,6 +539,7 @@ void SpinBLEClient::resetDevices(NimBLEClient *pClient) {
}
}
+// Control a connected FTMS trainer. If no args are passed, treat it like an external stepper motor.
void SpinBLEClient::FTMSControlPointWrite(const uint8_t *pData, int length) {
NimBLEClient *pClient = nullptr;
for (int i = 0; i < NUM_BLE_DEVICES; i++) {