mirror of https://github.com/espruino/BangleApps
cscsensor: Automatically reconnect on error
parent
cb2a321963
commit
708c295853
|
@ -7,3 +7,4 @@
|
||||||
Improve connection code
|
Improve connection code
|
||||||
0.07: Make Bangle.js 2 compatible
|
0.07: Make Bangle.js 2 compatible
|
||||||
0.08: Convert Yes/No On/Off in settings to checkboxes
|
0.08: Convert Yes/No On/Off in settings to checkboxes
|
||||||
|
0.09: Automatically reconnect on error
|
||||||
|
|
|
@ -226,7 +226,7 @@ function getSensorBatteryLevel(gatt) {
|
||||||
function connection_setup() {
|
function connection_setup() {
|
||||||
mySensor.screenInit = true;
|
mySensor.screenInit = true;
|
||||||
E.showMessage("Scanning for CSC sensor...");
|
E.showMessage("Scanning for CSC sensor...");
|
||||||
NRF.requestDevice({ filters: [{services:["1816"]}]}).then(function(d) {
|
NRF.requestDevice({ filters: [{services:["1816"]}], maxInterval: 100}).then(function(d) {
|
||||||
device = d;
|
device = d;
|
||||||
E.showMessage("Found device");
|
E.showMessage("Found device");
|
||||||
return device.gatt.connect();
|
return device.gatt.connect();
|
||||||
|
@ -249,6 +249,7 @@ function connection_setup() {
|
||||||
}).catch(function(e) {
|
}).catch(function(e) {
|
||||||
E.showMessage(e.toString(), "ERROR");
|
E.showMessage(e.toString(), "ERROR");
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
setTimeout(connection_setup, 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "cscsensor",
|
"id": "cscsensor",
|
||||||
"name": "Cycling speed sensor",
|
"name": "Cycling speed sensor",
|
||||||
"shortName": "CSCSensor",
|
"shortName": "CSCSensor",
|
||||||
"version": "0.08",
|
"version": "0.09",
|
||||||
"description": "Read BLE enabled cycling speed and cadence sensor and display readings on watch",
|
"description": "Read BLE enabled cycling speed and cadence sensor and display readings on watch",
|
||||||
"icon": "icons8-cycling-48.png",
|
"icon": "icons8-cycling-48.png",
|
||||||
"tags": "outdoors,exercise,ble,bluetooth,bike,cycle,bicycle",
|
"tags": "outdoors,exercise,ble,bluetooth,bike,cycle,bicycle",
|
||||||
|
|
Loading…
Reference in New Issue