Cleanup
parent
e823ae8496
commit
8a7b30cf6c
|
|
@ -25,15 +25,15 @@ let settings = Object.assign({
|
||||||
notify: {
|
notify: {
|
||||||
dist: {
|
dist: {
|
||||||
value: 0,
|
value: 0,
|
||||||
notification: [],
|
notifications: [],
|
||||||
},
|
},
|
||||||
step: {
|
step: {
|
||||||
value: 0,
|
value: 0,
|
||||||
notification: [],
|
notifications: [],
|
||||||
},
|
},
|
||||||
time: {
|
time: {
|
||||||
value: 0,
|
value: 0,
|
||||||
notification: [],
|
notifications: [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, require("Storage").readJSON("run.json", 1) || {});
|
}, require("Storage").readJSON("run.json", 1) || {});
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,15 @@
|
||||||
notify: {
|
notify: {
|
||||||
dist: {
|
dist: {
|
||||||
increment: 0,
|
increment: 0,
|
||||||
notification: [],
|
notifications: [],
|
||||||
},
|
},
|
||||||
step: {
|
step: {
|
||||||
increment: 0,
|
increment: 0,
|
||||||
notification: [],
|
notifications: [],
|
||||||
},
|
},
|
||||||
time: {
|
time: {
|
||||||
increment: 0,
|
increment: 0,
|
||||||
notification: [],
|
notifications: [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, storage.readJSON(SETTINGS_FILE, 1) || {});
|
}, storage.readJSON(SETTINGS_FILE, 1) || {});
|
||||||
|
|
@ -48,10 +48,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sampleBuzz(buzzTimes) {
|
function sampleBuzz(buzzPatterns) {
|
||||||
buzzTimes.reduce(function (promise, buzzTime) {
|
buzzPatterns.reduce(function (promise, buzzPattern) {
|
||||||
return promise.then(function () {
|
return promise.then(function () {
|
||||||
return Bangle.buzz(buzzTime);
|
return Bangle.buzz(buzzPattern[0], buzzPattern[1]);
|
||||||
});
|
});
|
||||||
}, Promise.resolve());
|
}, Promise.resolve());
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +74,8 @@
|
||||||
var vibTimes = [
|
var vibTimes = [
|
||||||
[],
|
[],
|
||||||
[[100, 1]],
|
[[100, 1]],
|
||||||
[[500, 1]],[[500, 1], [100, 0], [500, 1]],
|
[[500, 1]],
|
||||||
|
[[500, 1], [100, 0], [500, 1]],
|
||||||
[[500, 1],[100, 0], [100, 1], [100, 0], [500, 1]],
|
[[500, 1],[100, 0], [100, 1], [100, 0], [500, 1]],
|
||||||
[[500, 1],[100, 0],[500, 1],[100, 0],[500, 1]],
|
[[500, 1],[100, 0],[500, 1],[100, 0],[500, 1]],
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -67,17 +67,14 @@ var state = {
|
||||||
notify: {
|
notify: {
|
||||||
dist: {
|
dist: {
|
||||||
increment: 0,
|
increment: 0,
|
||||||
notification: [],
|
|
||||||
next: 0,
|
next: 0,
|
||||||
},
|
},
|
||||||
steps: {
|
steps: {
|
||||||
increment: 0,
|
increment: 0,
|
||||||
notification: [],
|
|
||||||
next: 0,
|
next: 0,
|
||||||
},
|
},
|
||||||
time: {
|
time: {
|
||||||
increment: 0,
|
increment: 0,
|
||||||
notification: [],
|
|
||||||
next: 0,
|
next: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -277,8 +274,6 @@ exports.getStats = function(statIDs, options) {
|
||||||
state.BPM = 0;
|
state.BPM = 0;
|
||||||
if (stats["bpm"]) stats["bpm"].emit("changed",stats["bpm"]);
|
if (stats["bpm"]) stats["bpm"].emit("changed",stats["bpm"]);
|
||||||
}
|
}
|
||||||
console.log(now);
|
|
||||||
console.log(state.notify.time.next);
|
|
||||||
if (state.notify.time.increment > 0 && state.notify.time.next < now) {
|
if (state.notify.time.increment > 0 && state.notify.time.next < now) {
|
||||||
stats["time"].emit("notify",stats["time"]);
|
stats["time"].emit("notify",stats["time"]);
|
||||||
state.notify.time.next = now + state.notify.time.increment;
|
state.notify.time.next = now + state.notify.time.increment;
|
||||||
|
|
@ -296,8 +291,6 @@ exports.getStats = function(statIDs, options) {
|
||||||
state.BPM = 0;
|
state.BPM = 0;
|
||||||
state.BPMage = 0;
|
state.BPMage = 0;
|
||||||
state.notify = options.notify;
|
state.notify = options.notify;
|
||||||
console.log("options:");
|
|
||||||
console.log(JSON.stringify(options));
|
|
||||||
if (options.notify.dist.increment > 0) {
|
if (options.notify.dist.increment > 0) {
|
||||||
state.notify.dist.next = state.distance + options.notify.dist.increment;
|
state.notify.dist.next = state.distance + options.notify.dist.increment;
|
||||||
}
|
}
|
||||||
|
|
@ -307,8 +300,6 @@ exports.getStats = function(statIDs, options) {
|
||||||
if (options.notify.time.increment > 0) {
|
if (options.notify.time.increment > 0) {
|
||||||
state.notify.time.next = state.startTime + options.notify.time.increment;
|
state.notify.time.next = state.startTime + options.notify.time.increment;
|
||||||
}
|
}
|
||||||
console.log("state:");
|
|
||||||
console.log(JSON.stringify(state));
|
|
||||||
}
|
}
|
||||||
reset();
|
reset();
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue