diff --git a/app/lib/ui/light.js b/app/lib/ui/light.js index d425c25..017a3b9 100644 --- a/app/lib/ui/light.js +++ b/app/lib/ui/light.js @@ -88,6 +88,12 @@ light.init = function () { } }); }; +light.disable = function () { + light.disabled = true; +} +light.enable = function () { + light.disabled = false; +}; light.colorPickers = function () { 'use strict'; $('#colors-tabs').w2tabs({ @@ -116,6 +122,14 @@ light.set = function (rgb, callback) { //rgb = [0,0,0] 'use strict'; var obj; + if (light.disabled){ + if (callback) { + return callback(); + } else { + return false; + } + } + if (light.lock) { //potential for logging overlapping commands return false; @@ -130,7 +144,7 @@ light.set = function (rgb, callback) { //rgb = [0,0,0] if (typeof callback !== 'undefined') { obj.callback = callback; } - light.queue[obj.id] = obj; + light.queue[obj.id] = obj;// light.current = rgb; light.lock = true; }; @@ -154,6 +168,11 @@ light.listen = function () { light.preview = function (rgb, name) { 'use strict'; var rgbStr; + + if (light.disabled) { + return false; + } + rgb = light.rgb.floor(rgb); rgbStr = 'rgb(' + rgb.join(',') + ')'; light.color = rgb; @@ -173,6 +192,11 @@ light.display = function (rgb) { //display light active state 'use strict'; var str, i; + + if (light.disabled) { + return false; + } + rgb = light.rgb.floor(rgb); for (i = 0; i < 3; i++) { $('#light-status form input').eq(i).val(rgb[i]); diff --git a/app/package-lock.json b/app/package-lock.json index 4f4d765..c711b8d 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -1,6 +1,6 @@ { "name": "mcopy-app", - "version": "1.2.2", + "version": "1.2.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/app/package.json b/app/package.json index 572094c..a3783f3 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "mcopy-app", - "version": "1.2.2", + "version": "1.2.3", "description": "GUI for the mcopy small gauge film optical printer platform", "main": "main.js", "scripts": {