forked from FOSS/BangleApps
Merge branch 'espruino:master' into master
commit
1803eced36
|
@ -1,3 +1,4 @@
|
||||||
0.01: Initial version
|
0.01: Initial version
|
||||||
0.02: Minor code improvements
|
0.02: Minor code improvements
|
||||||
0.03: Moved from cycling app, fixed connection issues and cadence
|
0.03: Moved from cycling app, fixed connection issues and cadence
|
||||||
|
0.04: Added support for <1 wheel/crank event/second (using idle counters) (ref #3434)
|
|
@ -47,6 +47,8 @@ class BLECSC {
|
||||||
this.kph = undefined;
|
this.kph = undefined;
|
||||||
this.wrps = 0; // wheel revs per second
|
this.wrps = 0; // wheel revs per second
|
||||||
this.crps = 0; // crank revs per second
|
this.crps = 0; // crank revs per second
|
||||||
|
this.widle = 0; // wheel idle counter
|
||||||
|
this.cidle = 0; // crank idle counter
|
||||||
//this.batteryLevel = undefined;
|
//this.batteryLevel = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +119,12 @@ class BLECSC {
|
||||||
if (this.lastLwet === undefined) this.lastLwet = this.lwet;
|
if (this.lastLwet === undefined) this.lastLwet = this.lwet;
|
||||||
if (this.lwet < this.lastLwet) this.lastLwet -= 65536;
|
if (this.lwet < this.lastLwet) this.lastLwet -= 65536;
|
||||||
let secs = (this.lwet - this.lastLwet) / 1024;
|
let secs = (this.lwet - this.lastLwet) / 1024;
|
||||||
this.wrps = (this.cwr - this.lastCwr) / (secs?secs:1);
|
if (secs)
|
||||||
|
this.wrps = (this.cwr - this.lastCwr) / secs;
|
||||||
|
else {
|
||||||
|
if (this.widle<5) this.widle++;
|
||||||
|
else this.wrps = 0;
|
||||||
|
}
|
||||||
this.kph = this.wrps * this.settings.circum / 3600;
|
this.kph = this.wrps * this.settings.circum / 3600;
|
||||||
Object.assign(data, { // Notify the 'wheelEvent' handler
|
Object.assign(data, { // Notify the 'wheelEvent' handler
|
||||||
cwr: this.cwr, // cumulative wheel revolutions
|
cwr: this.cwr, // cumulative wheel revolutions
|
||||||
|
@ -138,7 +145,12 @@ class BLECSC {
|
||||||
if (this.lastLcet === undefined) this.lastLcet = this.lcet;
|
if (this.lastLcet === undefined) this.lastLcet = this.lcet;
|
||||||
if (this.lcet < this.lastLcet) this.lastLcet -= 65536;
|
if (this.lcet < this.lastLcet) this.lastLcet -= 65536;
|
||||||
let secs = (this.lcet - this.lastLcet) / 1024;
|
let secs = (this.lcet - this.lastLcet) / 1024;
|
||||||
this.crps = (this.ccr - this.lastCcr) / (secs?secs:1);
|
if (secs)
|
||||||
|
this.crps = (this.ccr - this.lastCcr) / secs;
|
||||||
|
else {
|
||||||
|
if (this.cidle<5) this.cidle++;
|
||||||
|
else this.crps = 0;
|
||||||
|
}
|
||||||
Object.assign(data, { // Notify the 'crankEvent' handler
|
Object.assign(data, { // Notify the 'crankEvent' handler
|
||||||
ccr: this.ccr, // cumulative crank revolutions
|
ccr: this.ccr, // cumulative crank revolutions
|
||||||
lcet: this.lcet, // last crank event time
|
lcet: this.lcet, // last crank event time
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "blecsc",
|
"id": "blecsc",
|
||||||
"name": "BLE Cycling Speed Sensor Library",
|
"name": "BLE Cycling Speed Sensor Library",
|
||||||
"shortName": "BLE CSC",
|
"shortName": "BLE CSC",
|
||||||
"version": "0.03",
|
"version": "0.04",
|
||||||
"description": "Module to get live values from a BLE Cycle Speed (CSC) sensor. Includes recorder and clockinfo plugins",
|
"description": "Module to get live values from a BLE Cycle Speed (CSC) sensor. Includes recorder and clockinfo plugins",
|
||||||
"icon": "icons8-cycling-48.png",
|
"icon": "icons8-cycling-48.png",
|
||||||
"tags": "outdoors,exercise,ble,bluetooth,clkinfo",
|
"tags": "outdoors,exercise,ble,bluetooth,clkinfo",
|
||||||
|
|
|
@ -10,3 +10,4 @@
|
||||||
0.09: Automatically reconnect on error
|
0.09: Automatically reconnect on error
|
||||||
0.10: Fix cscsensor when using coospoo sensor that supports crank *and* wheel
|
0.10: Fix cscsensor when using coospoo sensor that supports crank *and* wheel
|
||||||
0.11: Update to use blecsc library
|
0.11: Update to use blecsc library
|
||||||
|
0.12: Fix regression reporting cadence (reported per second when should be per minute) (fix #3434)
|
|
@ -157,7 +157,7 @@ csc.on("data", e => {
|
||||||
mySensor.movingTime += e.wdt;
|
mySensor.movingTime += e.wdt;
|
||||||
if (mySensor.speed>mySensor.maxSpeed && (mySensor.movingTime>3 || mySensor.speed<20) && mySensor.speed<50)
|
if (mySensor.speed>mySensor.maxSpeed && (mySensor.movingTime>3 || mySensor.speed<20) && mySensor.speed<50)
|
||||||
mySensor.maxSpeed = mySensor.speed;
|
mySensor.maxSpeed = mySensor.speed;
|
||||||
mySensor.cadence = e.crps;
|
mySensor.cadence = e.crps*60;
|
||||||
mySensor.updateScreen();
|
mySensor.updateScreen();
|
||||||
mySensor.updateScreen();
|
mySensor.updateScreen();
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "cscsensor",
|
"id": "cscsensor",
|
||||||
"name": "Cycling speed sensor",
|
"name": "Cycling speed sensor",
|
||||||
"shortName": "CSCSensor",
|
"shortName": "CSCSensor",
|
||||||
"version": "0.11",
|
"version": "0.12",
|
||||||
"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",
|
||||||
|
|
|
@ -27,3 +27,4 @@ Write to correct settings file, fixing settings not working.
|
||||||
0.24: Add indicators for lock,gps and pulse to karvonen screen
|
0.24: Add indicators for lock,gps and pulse to karvonen screen
|
||||||
0.25: Fix step count bug when runs are resumed after a long time
|
0.25: Fix step count bug when runs are resumed after a long time
|
||||||
0.26: Add ability to zoom in on a single stat by tapping it
|
0.26: Add ability to zoom in on a single stat by tapping it
|
||||||
|
0.27: Allow setting to alway resume an activity
|
||||||
|
|
|
@ -26,6 +26,7 @@ let settings = Object.assign({
|
||||||
B5: "step",
|
B5: "step",
|
||||||
B6: "caden",
|
B6: "caden",
|
||||||
paceLength: 1000,
|
paceLength: 1000,
|
||||||
|
alwaysResume: false,
|
||||||
notify: {
|
notify: {
|
||||||
dist: {
|
dist: {
|
||||||
value: 0,
|
value: 0,
|
||||||
|
@ -64,10 +65,10 @@ function onStartStop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var running = !exs.state.active;
|
var running = !exs.state.active;
|
||||||
var shouldResume = false;
|
var shouldResume = settings.alwaysResume;
|
||||||
var promise = Promise.resolve();
|
var promise = Promise.resolve();
|
||||||
|
|
||||||
if (running && exs.state.duration > 10000) { // if more than 10 seconds of duration, ask if we should resume?
|
if (!shouldResume && running && exs.state.duration > 10000) { // if more than 10 seconds of duration, ask if we should resume?
|
||||||
promise = promise.
|
promise = promise.
|
||||||
then(() => {
|
then(() => {
|
||||||
screen = "menu";
|
screen = "menu";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "runplus",
|
"id": "runplus",
|
||||||
"name": "Run+",
|
"name": "Run+",
|
||||||
"version": "0.26",
|
"version": "0.27",
|
||||||
"description": "Displays distance, time, steps, cadence, pace and more for runners. Based on the Run app, but extended with additional screens for heart rate interval training and individual stat focus.",
|
"description": "Displays distance, time, steps, cadence, pace and more for runners. Based on the Run app, but extended with additional screens for heart rate interval training and individual stat focus.",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "run,running,fitness,outdoors,gps,karvonen,karvonnen",
|
"tags": "run,running,fitness,outdoors,gps,karvonen,karvonnen",
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
B5: "step",
|
B5: "step",
|
||||||
B6: "caden",
|
B6: "caden",
|
||||||
paceLength: 1000, // TODO: Default to either 1km or 1mi based on locale
|
paceLength: 1000, // TODO: Default to either 1km or 1mi based on locale
|
||||||
|
alwaysResume: false,
|
||||||
notify: {
|
notify: {
|
||||||
dist: {
|
dist: {
|
||||||
increment: 0,
|
increment: 0,
|
||||||
|
@ -72,6 +73,13 @@
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
menu[/*LANG*/"Always resume run"] = {
|
||||||
|
value : settings.alwaysResume,
|
||||||
|
onchange : v => {
|
||||||
|
settings.alwaysResume = v;
|
||||||
|
saveSettings();
|
||||||
|
},
|
||||||
|
};
|
||||||
var notificationsMenu = {
|
var notificationsMenu = {
|
||||||
'< Back': function() { E.showMenu(menu) },
|
'< Back': function() { E.showMenu(menu) },
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue