Work on progress bar.

This commit is contained in:
mmcwilliams 2019-04-02 10:21:01 -04:00
parent d1480181b3
commit 96754fcf49
4 changed files with 9 additions and 76 deletions

View File

@ -2501,40 +2501,7 @@ let log;
State shared by ALL interfaces State shared by ALL interfaces
*******/ *******/
mcopy.state = { mcopy.state = {
version : PACKAGE.version, //use for file compatibility check version : PACKAGE.version //use for file compatibility check
sequence : {
pads: {
//gaaaaaaaaah
cam_forward: 'CF',
proj_forward : 'PF',
black_forward : 'BF',
cam_backward: 'CB',
proj_backward : 'PB',
black_backward : 'BB',
light_set : 'L',
cam2_forward : 'C2F',
cam2_backward : 'C2B',
cams_forward : 'CCF',
cams_forward : 'CCB',
cam_forward_cam2_backward : 'CFCB',
cam_backward_cam2_forward : 'CBCF',
proj2_forward : 'P2F',
proj2_backward : 'P2B',
projs_forward : 'PPF',
projs_backward : 'PPB',
proj_forward_proj2_backward : 'PFPB',
proj_backward_proj2_forward : 'PBPF'
}
}
}; };
// //

View File

@ -69,10 +69,10 @@ grid.refresh = function () {
$('#' + cmds[i]).append($(elem).text(x)); $('#' + cmds[i]).append($(elem).text(x));
} else if (i === cmds.length - 2) { } else if (i === cmds.length - 2) {
elem = div.replace('xxxx', x); elem = div.replace('xxxx', x);
$('#' + cmds[i]).append($(elem).addClass(mcopy.state.sequence.pads[cmds[i]])); $('#' + cmds[i]).append($(elem).addClass(cfg.cmd[cmds[i]]));
} else { } else {
elem = check.replace('xxxx', x); elem = check.replace('xxxx', x);
$('#' + cmds[i]).append($(elem).addClass(mcopy.state.sequence.pads[cmds[i]])); $('#' + cmds[i]).append($(elem).addClass(cfg.cmd[cmds[i]]));
} }
grid.state(x); grid.state(x);
} }

View File

@ -25,7 +25,8 @@ seq.listener = function (event, arg) {
if (arg.start) { if (arg.start) {
if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') { if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') {
seq.activeStep(arg.step); seq.activeStep(arg.step);
log.info(`Step ${arg.step} running of ${arg.loop}`, 'SERIAL', true); log.info(`Step ${arg.step + 1} running of ${seq.arr.length}`, 'SERIAL', true);
log.info(`Loop ${arg.loop + 1} of ${seq.loops}`, 'SERIAL', true);
} else if (typeof arg.loop !== 'undefined') { } else if (typeof arg.loop !== 'undefined') {
$('#loop_current').text(gui.fmtZero(arg.loop + 1, 6)); $('#loop_current').text(gui.fmtZero(arg.loop + 1, 6));
} else { } else {
@ -41,7 +42,7 @@ seq.listener = function (event, arg) {
} else { } else {
gui.overlay(false); gui.overlay(false);
gui.spinner(false); gui.spinner(false);
seq.progress(0, 0); //seq.progress(0, 0);
log.info('Sequence stopped', 'SERIAL', true); log.info('Sequence stopped', 'SERIAL', true);
} }
} }
@ -49,15 +50,12 @@ seq.listener = function (event, arg) {
} }
seq.progress = function (step, loop) { seq.progress = function (step, loop) {
const elem = $('.progress-bar');
const len = seq.arr.length; const len = seq.arr.length;
const total = len * seq.loops; const total = len * seq.loops;
const pos = (loop * len) + step; let pos = (loop * len) + step;
const elem = $('.progress-bar');
let progress; let progress;
console.dir(`${len} * ${seq.loops} = ${total}`)
console.dir(`(${len} * ${loop}) + ${step} = ${pos}`)
console.dir(`${pos} / ${total} = ${(pos / total) * 100}`)
if (pos === 0) { if (pos === 0) {
progress = 0; progress = 0;
} else { } else {

View File

@ -27,39 +27,7 @@ let log;
State shared by ALL interfaces State shared by ALL interfaces
*******/ *******/
mcopy.state = { mcopy.state = {
version : PACKAGE.version, //use for file compatibility check version : PACKAGE.version //use for file compatibility check
sequence : {
pads: {
cam_forward: 'CF',
proj_forward : 'PF',
black_forward : 'BF',
cam_backward: 'CB',
proj_backward : 'PB',
black_backward : 'BB',
light_set : 'L',
cam2_forward : 'C2F',
cam2_backward : 'C2B',
cams_forward : 'CCF',
cams_forward : 'CCB',
cam_forward_cam2_backward : 'CFCB',
cam_backward_cam2_forward : 'CBCF',
proj2_forward : 'P2F',
proj2_backward : 'P2B',
projs_forward : 'PPF',
projs_backward : 'PPB',
proj_forward_proj2_backward : 'PFPB',
proj_backward_proj2_forward : 'PBPF'
}
}
}; };
// //