Fix for step notification, debug for time notification, better buzzes
parent
afd4bc697d
commit
d65726d9fc
|
|
@ -48,6 +48,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sampleBuzz(buzzTimes) {
|
||||||
|
buzzTimes.reduce(function (promise, buzzTime) {
|
||||||
|
return promise.then(function () {
|
||||||
|
return Bangle.buzz(buzzTime);
|
||||||
|
});
|
||||||
|
}, Promise.resolve());
|
||||||
|
}
|
||||||
|
|
||||||
var menu = {
|
var menu = {
|
||||||
'': { 'title': 'Run' },
|
'': { 'title': 'Run' },
|
||||||
'< Back': back,
|
'< Back': back,
|
||||||
|
|
@ -63,14 +71,14 @@
|
||||||
};
|
};
|
||||||
ExStats.appendMenuItems(menu, settings, saveSettings);
|
ExStats.appendMenuItems(menu, settings, saveSettings);
|
||||||
var vibPatterns = [/*LANG*/"Off", ".", "-", "--", "-.-", "---"];
|
var vibPatterns = [/*LANG*/"Off", ".", "-", "--", "-.-", "---"];
|
||||||
var vibTimes = [[], [100], [500],[500,500],[500,100,500],[500,500,500]];
|
var vibTimes = [[], [[100, 1]], [[500, 1]],[[500, 1], [50, 0], [500, 1]],[[500, 1],[50, 0], [100, 1], [50, 0], [500, 1]],[[500, 1],[50,0],[500, 1],[50,0],[500, 1]]];
|
||||||
menu[/*LANG*/"Dist Notifctn"] = {
|
menu[/*LANG*/"Dist Notifctn"] = {
|
||||||
value: Math.max(0,vibPatterns.indexOf(settings.notify.dist.notification)),
|
value: Math.max(0,vibPatterns.indexOf(settings.notify.dist.notification)),
|
||||||
min: 0, max: vibPatterns.length,
|
min: 0, max: vibPatterns.length,
|
||||||
format: v => vibPatterns[v]||"Off",
|
format: v => vibPatterns[v]||"Off",
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.notify.dist.notification = vibTimes[v];
|
settings.notify.dist.notification = vibTimes[v];
|
||||||
vibTimes[v].forEach((b) => Bangle.buzz(b));
|
sampleBuzz(vibTimes[v]);
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -80,7 +88,7 @@
|
||||||
format: v => vibPatterns[v]||"Off",
|
format: v => vibPatterns[v]||"Off",
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.notify.steps.notification = vibTimes[v];
|
settings.notify.steps.notification = vibTimes[v];
|
||||||
vibTimes[v].forEach((b) => Bangle.buzz(b));
|
sampleBuzz(vibTimes[v]);
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +98,7 @@
|
||||||
format: v => vibPatterns[v]||"Off",
|
format: v => vibPatterns[v]||"Off",
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.notify.time.notification = vibTimes[v];
|
settings.notify.time.notification = vibTimes[v];
|
||||||
vibTimes[v].forEach((b) => Bangle.buzz(b));
|
sampleBuzz(vibTimes[v]);
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ Bangle.on("step", function(steps) {
|
||||||
state.stepHistory[0] += steps-state.lastStepCount;
|
state.stepHistory[0] += steps-state.lastStepCount;
|
||||||
state.lastStepCount = steps;
|
state.lastStepCount = steps;
|
||||||
if (state.notify.steps.increment > 0 && state.notify.steps.next < steps) {
|
if (state.notify.steps.increment > 0 && state.notify.steps.next < steps) {
|
||||||
stats["steps"].emit("notify",stats["steps"]);
|
stats["step"].emit("notify",stats["step"]);
|
||||||
state.notify.steps.next = steps + state.notify.steps.increment;
|
state.notify.steps.next = steps + state.notify.steps.increment;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -277,9 +277,11 @@ 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 = stats["time"] + state.notify.time.increment;
|
state.notify.time.next = now + state.notify.time.increment;
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
function reset() {
|
function reset() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue