Manually reconnect with button 3 push
parent
9ace46b776
commit
e908552a0e
|
|
@ -9,8 +9,10 @@ Currently the app displays the following data:
|
||||||
- maximum speed
|
- maximum speed
|
||||||
- trip distance traveled
|
- trip distance traveled
|
||||||
- total distance traveled
|
- total distance traveled
|
||||||
|
- an icon with the battery status of the remote sensor
|
||||||
|
|
||||||
Button 1 resets all measurements except total distance traveled. The latter gets preserved by being written to storage every 0.1 miles and upon exiting the app.
|
Button 1 resets all measurements except total distance traveled. The latter gets preserved by being written to storage every 0.1 miles and upon exiting the app.
|
||||||
|
If the watch app has not received an update from the sensor for at least 10 seconds, pushing button 3 will attempt to reconnect to the sensor.
|
||||||
|
|
||||||
I do not have access to a cadence sensor at the moment, so only the speed part is currently implemented. Values displayed are imperial or metric (depending on locale),
|
I do not have access to a cadence sensor at the moment, so only the speed part is currently implemented. Values displayed are imperial or metric (depending on locale),
|
||||||
the wheel circumference can be adjusted in the global settings app.
|
the wheel circumference can be adjusted in the global settings app.
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ class CSCSensor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.lastSpeed = this.speed;
|
this.lastSpeed = this.speed;
|
||||||
if (this.speed>this.maxSpeed && (this.movingTime>3 || this.speed<20)) this.maxSpeed = this.speed;
|
if (this.speed>this.maxSpeed && (this.movingTime>3 || this.speed<20) && this.speed<50) this.maxSpeed = this.speed;
|
||||||
}
|
}
|
||||||
if (qChanged && this.qUpdateScreen) this.updateScreen();
|
if (qChanged && this.qUpdateScreen) this.updateScreen();
|
||||||
}
|
}
|
||||||
|
|
@ -189,14 +189,16 @@ function parseDevice(d) {
|
||||||
|
|
||||||
function connection_setup() {
|
function connection_setup() {
|
||||||
NRF.setScan();
|
NRF.setScan();
|
||||||
|
mySensor.screenInit = true;
|
||||||
NRF.setScan(parseDevice, { filters: [{services:["1816"]}], timeout: 2000});
|
NRF.setScan(parseDevice, { filters: [{services:["1816"]}], timeout: 2000});
|
||||||
g.clearRect(0, 60, 239, 239).setFontVector(18).setFontAlign(0, 0, 0).setColor(0, 1, 0);
|
g.clearRect(0, 48, 239, 239).setFontVector(18).setFontAlign(0, 0, 0).setColor(0, 1, 0);
|
||||||
g.drawString("Scanning for CSC sensor...", 120, 120);
|
g.drawString("Scanning for CSC sensor...", 120, 120);
|
||||||
}
|
}
|
||||||
|
|
||||||
connection_setup();
|
connection_setup();
|
||||||
setWatch(function() { mySensor.reset(); g.clearRect(0, 48, 239, 239); mySensor.updateScreen(); }, BTN1, {repeat:true, debounce:20});
|
setWatch(function() { mySensor.reset(); g.clearRect(0, 48, 239, 239); mySensor.updateScreen(); }, BTN1, {repeat:true, debounce:20});
|
||||||
E.on('kill',()=>{ if (gatt!=undefined) gatt.disconnect(); mySensor.settings.totaldist = mySensor.totaldist; storage.writeJSON(SETTINGS_FILE, mySensor.settings); });
|
E.on('kill',()=>{ if (gatt!=undefined) gatt.disconnect(); mySensor.settings.totaldist = mySensor.totaldist; storage.writeJSON(SETTINGS_FILE, mySensor.settings); });
|
||||||
|
setWatch(function() { if (Date.now()-mySensor.lastBangleTime>10000) connection_setup(); }, BTN3, {repeat:true, debounce:20});
|
||||||
NRF.on('disconnect', connection_setup);
|
NRF.on('disconnect', connection_setup);
|
||||||
|
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue