Menu and typo fixes
parent
525980d7f7
commit
2edad3887f
|
|
@ -44,6 +44,7 @@ var exs = ExStats.getStats(statIDs, settings);
|
||||||
// Called to start/stop running
|
// Called to start/stop running
|
||||||
function onStartStop() {
|
function onStartStop() {
|
||||||
var running = !exs.state.active;
|
var running = !exs.state.active;
|
||||||
|
var prepPromises = [];
|
||||||
|
|
||||||
// start/stop recording
|
// start/stop recording
|
||||||
// Do this first in case recorder needs to prompt for
|
// Do this first in case recorder needs to prompt for
|
||||||
|
|
@ -51,27 +52,34 @@ function onStartStop() {
|
||||||
if (settings.record && WIDGETS["recorder"]) {
|
if (settings.record && WIDGETS["recorder"]) {
|
||||||
if (running) {
|
if (running) {
|
||||||
isMenuDisplayed = true;
|
isMenuDisplayed = true;
|
||||||
WIDGETS["recorder"].setRecording(true).then(() => {
|
prepPromises.push(
|
||||||
isMenuDisplayed = false;
|
WIDGETS["recorder"].setRecording(true).then(() => {
|
||||||
layout.forgetLazyState();
|
isMenuDisplayed = false;
|
||||||
layout.render();
|
layout.forgetLazyState();
|
||||||
});
|
layout.render();
|
||||||
|
})
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
WIDGETS["recorder"].setRecording(false);
|
prepPromises.push(
|
||||||
|
WIDGETS["recorder"].setRecording(false)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (running) {
|
Promise.all(prepPromises)
|
||||||
exs.start();
|
.then(() => {
|
||||||
} else {
|
if (running) {
|
||||||
exs.stop();
|
exs.start();
|
||||||
}
|
} else {
|
||||||
layout.button.label = running ? "STOP" : "START";
|
exs.stop();
|
||||||
layout.status.label = running ? "RUN" : "STOP";
|
}
|
||||||
layout.status.bgCol = running ? "#0f0" : "#f00";
|
layout.button.label = running ? "STOP" : "START";
|
||||||
// if stopping running, don't clear state
|
layout.status.label = running ? "RUN" : "STOP";
|
||||||
// so we can at least refer to what we've done
|
layout.status.bgCol = running ? "#0f0" : "#f00";
|
||||||
layout.render();
|
// if stopping running, don't clear state
|
||||||
|
// so we can at least refer to what we've done
|
||||||
|
layout.render();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var lc = [];
|
var lc = [];
|
||||||
|
|
@ -104,7 +112,8 @@ layout.render();
|
||||||
|
|
||||||
function configureNotification(stat) {
|
function configureNotification(stat) {
|
||||||
stat.on('notify', (e)=>{
|
stat.on('notify', (e)=>{
|
||||||
console.log(`Got notify from ${e}`);
|
console.log(`Got notify from ${JSON.stringify(e)}`);
|
||||||
|
console.log(JSON.stringify(settings.notify[e.id]));
|
||||||
settings.notify[e.id].notifications.reduce(function (promise, buzzPattern) {
|
settings.notify[e.id].notifications.reduce(function (promise, buzzPattern) {
|
||||||
console.log(buzzPattern);
|
console.log(buzzPattern);
|
||||||
return promise.then(function () {
|
return promise.then(function () {
|
||||||
|
|
|
||||||
|
|
@ -81,31 +81,31 @@
|
||||||
[[300, 1],[200, 0],[300, 1],[200, 0],[300, 1]],
|
[[300, 1],[200, 0],[300, 1],[200, 0],[300, 1]],
|
||||||
];
|
];
|
||||||
menu[/*LANG*/"Dist Ntfy Ptrn"] = {
|
menu[/*LANG*/"Dist Ntfy Ptrn"] = {
|
||||||
value: Math.max(0,vibPatterns.indexOf(settings.notify.dist.notification)),
|
value: Math.max(0,vibPatterns.indexOf(settings.notify.dist.notifications)),
|
||||||
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.notifications = vibTimes[v];
|
||||||
sampleBuzz(vibTimes[v]);
|
sampleBuzz(vibTimes[v]);
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menu[/*LANG*/"Step Ntfy Ptrn"] = {
|
menu[/*LANG*/"Step Ntfy Ptrn"] = {
|
||||||
value: Math.max(0,vibPatterns.indexOf(settings.notify.step.notification)),
|
value: Math.max(0,vibPatterns.indexOf(settings.notify.step.notifications)),
|
||||||
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.step.notification = vibTimes[v];
|
settings.notify.step.notifications = vibTimes[v];
|
||||||
sampleBuzz(vibTimes[v]);
|
sampleBuzz(vibTimes[v]);
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menu[/*LANG*/"Time Ntfy Ptrn"] = {
|
menu[/*LANG*/"Time Ntfy Ptrn"] = {
|
||||||
value: Math.max(0,vibPatterns.indexOf(settings.notify.time.notification)),
|
value: Math.max(0,vibPatterns.indexOf(settings.notify.time.notifications)),
|
||||||
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.time.notification = vibTimes[v];
|
settings.notify.time.notifications = vibTimes[v];
|
||||||
sampleBuzz(vibTimes[v]);
|
sampleBuzz(vibTimes[v]);
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue