mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Breaking Change: ledLayout, ledColorsStream (#614)
* Remove clone & index in ledConfig * Additional index correction * Rename ledsConfig maximum and minimum in max and min * Rename ledsConfig hscan and vscan with h and v * Optimize ledColorsStream * tiny correction
This commit is contained in:
@@ -24,12 +24,12 @@ function createLedPreview(leds, origin){
|
||||
$('#previewcreator').html($.i18n('conf_leds_layout_preview_originMA'));
|
||||
$('#leds_preview').css("padding-top", "100%");
|
||||
}
|
||||
|
||||
|
||||
$('#previewledcount').html($.i18n('conf_leds_layout_preview_totalleds', leds.length));
|
||||
$('#previewledpower').html($.i18n('conf_leds_layout_preview_ledpower', ((leds.length * 0.06)*1.1).toFixed(1)));
|
||||
|
||||
|
||||
$('.st_helper').css("border", "8px solid grey");
|
||||
|
||||
|
||||
var canvas_height = $('#leds_preview').innerHeight();
|
||||
var canvas_width = $('#leds_preview').innerWidth();
|
||||
|
||||
@@ -39,17 +39,17 @@ function createLedPreview(leds, origin){
|
||||
var led = leds[idx];
|
||||
var led_id='ledc_'+[idx];
|
||||
var bgcolor = "background-color:hsl("+(idx*360/leds.length)+",100%,50%);";
|
||||
var pos = "left:"+(led.hscan.minimum * canvas_width)+"px;"+
|
||||
"top:"+(led.vscan.minimum * canvas_height)+"px;"+
|
||||
"width:"+((led.hscan.maximum-led.hscan.minimum) * (canvas_width-1))+"px;"+
|
||||
"height:"+((led.vscan.maximum-led.vscan.minimum) * (canvas_height-1))+"px;";
|
||||
leds_html += '<div id="'+led_id+'" class="led" style="'+bgcolor+pos+'" title="'+led.index+'"><span id="'+led_id+'_num" class="led_prev_num">'+led.index+'</span></div>';
|
||||
var pos = "left:"+(led.h.min * canvas_width)+"px;"+
|
||||
"top:"+(led.v.min * canvas_height)+"px;"+
|
||||
"width:"+((led.h.max-led.h.min) * (canvas_width-1))+"px;"+
|
||||
"height:"+((led.v.max-led.v.min) * (canvas_height-1))+"px;";
|
||||
leds_html += '<div id="'+led_id+'" class="led" style="'+bgcolor+pos+'" title="'+idx+'"><span id="'+led_id+'_num" class="led_prev_num">'+idx+'</span></div>';
|
||||
}
|
||||
$('#leds_preview').html(leds_html);
|
||||
$('#ledc_0').css({"background-color":"black","z-index":"12"});
|
||||
$('#ledc_1').css({"background-color":"grey","z-index":"11"});
|
||||
$('#ledc_2').css({"background-color":"#A9A9A9","z-index":"10"});
|
||||
|
||||
|
||||
if($('#leds_prev_toggle_num').hasClass('btn-success'))
|
||||
$('.led_prev_num').css("display", "inline");
|
||||
|
||||
@@ -65,14 +65,14 @@ function createClassicLeds(){
|
||||
var ledsgpos = parseInt($("#ip_cl_gpos").val());
|
||||
var position = parseInt($("#ip_cl_position").val());
|
||||
var reverse = $("#ip_cl_reverse").is(":checked");
|
||||
|
||||
|
||||
//advanced values
|
||||
var ledsVDepth = parseInt($("#ip_cl_vdepth").val())/100;
|
||||
var ledsHDepth = parseInt($("#ip_cl_hdepth").val())/100;
|
||||
var edgeVGap = parseInt($("#ip_cl_edgegap").val())/100/2;
|
||||
//var cornerVGap = parseInt($("#ip_cl_cornergap").val())/100/2;
|
||||
var overlap = $("#ip_cl_overlap").val()/4000;
|
||||
|
||||
|
||||
//helper
|
||||
var edgeHGap = edgeVGap/(16/9);
|
||||
//var cornerHGap = cornerVGap/(16/9);
|
||||
@@ -83,15 +83,15 @@ function createClassicLeds(){
|
||||
var Hdiff = Hmax-Hmin;
|
||||
var Vdiff = Vmax-Vmin;
|
||||
var ledArray = [];
|
||||
|
||||
|
||||
function createFinalArray(array){
|
||||
finalLedArray = [];
|
||||
for(var i = 0; i<array.length; i++){
|
||||
var hmin = array[i].hscan.minimum;
|
||||
var hmax = array[i].hscan.maximum;
|
||||
var vmin = array[i].vscan.minimum;
|
||||
var vmax = array[i].vscan.maximum;
|
||||
finalLedArray[i] = { "index" : i, "hscan": { "maximum" : hmax, "minimum" : hmin }, "vscan": { "maximum": vmax, "minimum": vmin}}
|
||||
var hmin = array[i].h.min;
|
||||
var hmax = array[i].h.max;
|
||||
var vmin = array[i].v.min;
|
||||
var vmax = array[i].v.max;
|
||||
finalLedArray[i] = { "h": { "max" : hmax, "min" : hmin }, "v": { "max": vmax, "min": vmin}}
|
||||
}
|
||||
createLedPreview(finalLedArray, 'classic');
|
||||
}
|
||||
@@ -111,7 +111,7 @@ function createClassicLeds(){
|
||||
return array;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function valScan(val)
|
||||
{
|
||||
if(val > 1)
|
||||
@@ -120,7 +120,7 @@ function createClassicLeds(){
|
||||
return 0;
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
function ovl(scan,val)
|
||||
{
|
||||
if(scan == "+")
|
||||
@@ -128,15 +128,15 @@ function createClassicLeds(){
|
||||
else
|
||||
return valScan(val -= overlap);
|
||||
}
|
||||
|
||||
|
||||
function createLedArray(hmin, hmax, vmin, vmax){
|
||||
hmin = round(hmin);
|
||||
hmax = round(hmax);
|
||||
vmin = round(vmin);
|
||||
vmax = round(vmax);
|
||||
ledArray.push( { "hscan" : { "minimum" : hmin, "maximum" : hmax }, "vscan": { "minimum": vmin, "maximum": vmax }} );
|
||||
ledArray.push( { "h" : { "min" : hmin, "max" : hmax }, "v": { "min": vmin, "max": vmax }} );
|
||||
}
|
||||
|
||||
|
||||
function createTopLeds(){
|
||||
var step=(Hmax-Hmin)/ledstop;
|
||||
//if(cornerVGap != '0')
|
||||
@@ -148,9 +148,9 @@ function createClassicLeds(){
|
||||
var hmin = ovl("-",(Hdiff/ledstop*Number([i]))+edgeHGap);
|
||||
var hmax = ovl("+",(Hdiff/ledstop*Number([i]))+step+edgeHGap);
|
||||
createLedArray(hmin, hmax, vmin, vmax);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function createLeftLeds(){
|
||||
var step=(Vmax-Vmin)/ledsleft;
|
||||
//if(cornerVGap != '0')
|
||||
@@ -164,7 +164,7 @@ function createClassicLeds(){
|
||||
createLedArray(hmin, hmax, vmin, vmax);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function createRightLeds(){
|
||||
var step=(Vmax-Vmin)/ledsright;
|
||||
//if(cornerVGap != '0')
|
||||
@@ -175,15 +175,15 @@ function createClassicLeds(){
|
||||
for (var i = 0; i<ledsright; i++){
|
||||
var vmin = ovl("-",(Vdiff/ledsright*Number([i]))+edgeVGap);
|
||||
var vmax = ovl("+",(Vdiff/ledsright*Number([i]))+step+edgeVGap);
|
||||
createLedArray(hmin, hmax, vmin, vmax);
|
||||
createLedArray(hmin, hmax, vmin, vmax);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function createBottomLeds(){
|
||||
var step=(Hmax-Hmin)/ledsbottom;
|
||||
//if(cornerVGap != '0')
|
||||
// step=(Hmax-Hmin-(cornerHGap*2))/ledsbottom;
|
||||
|
||||
|
||||
var vmax=Vmax;
|
||||
var vmin=vmax-ledsHDepth;
|
||||
for (var i = ledsbottom-1; i>-1; i--){
|
||||
@@ -192,7 +192,7 @@ function createClassicLeds(){
|
||||
createLedArray(hmin, hmax, vmin, vmax);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
createTopLeds();
|
||||
createRightLeds();
|
||||
createBottomLeds();
|
||||
@@ -205,25 +205,25 @@ function createClassicLeds(){
|
||||
$('#ip_cl_ledsgpos').val(mpos);
|
||||
ledsgpos = mpos;
|
||||
}
|
||||
|
||||
|
||||
//check led gap length
|
||||
if(ledsglength >= ledArray.length)
|
||||
{
|
||||
$('#ip_cl_ledsglength').val(ledArray.length-1);
|
||||
ledsglength = ledArray.length-ledsglength-1;
|
||||
}
|
||||
|
||||
|
||||
if(ledsglength != 0){
|
||||
ledArray.splice(ledsgpos, ledsglength);
|
||||
}
|
||||
|
||||
|
||||
if (position != 0){
|
||||
rotateArray(ledArray, position);
|
||||
}
|
||||
|
||||
if (reverse)
|
||||
ledArray.reverse();
|
||||
|
||||
|
||||
createFinalArray(ledArray);
|
||||
}
|
||||
|
||||
@@ -239,7 +239,6 @@ function createMatrixLeds(){
|
||||
var start = $("#ip_ma_start").val();
|
||||
|
||||
var parallel = false
|
||||
var index = 0
|
||||
var leds = []
|
||||
var hblock = 1.0 / ledshoriz
|
||||
var vblock = 1.0 / ledsvert
|
||||
@@ -250,11 +249,10 @@ function createMatrixLeds(){
|
||||
|
||||
/**
|
||||
* Adds led to the hyperion config led array
|
||||
* @param {Number} index Index of the led
|
||||
* @param {Number} x Horizontal position in matrix
|
||||
* @param {Number} y Vertical position in matrix
|
||||
*/
|
||||
function addLed (index, x, y) {
|
||||
function addLed (x, y) {
|
||||
var hscanMin = x * hblock
|
||||
var hscanMax = (x + 1) * hblock
|
||||
var vscanMin = y * vblock
|
||||
@@ -264,16 +262,15 @@ function createMatrixLeds(){
|
||||
hscanMax = round(hscanMax);
|
||||
vscanMin = round(vscanMin);
|
||||
vscanMax = round(vscanMax);
|
||||
|
||||
|
||||
leds.push({
|
||||
index: index,
|
||||
hscan: {
|
||||
minimum: hscanMin,
|
||||
maximum: hscanMax
|
||||
h: {
|
||||
min: hscanMin,
|
||||
max: hscanMax
|
||||
},
|
||||
vscan: {
|
||||
minimum: vscanMin,
|
||||
maximum: vscanMax
|
||||
v: {
|
||||
min: vscanMin,
|
||||
max: vscanMax
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -291,8 +288,7 @@ function createMatrixLeds(){
|
||||
|
||||
for (y = startY; downward && y <= endY || !downward && y >= endY; y += downward ? 1 : -1) {
|
||||
for (x = startX; forward && x <= endX || !forward && x >= endX; x += forward ? 1 : -1) {
|
||||
addLed(index, x, y)
|
||||
index++
|
||||
addLed(x, y)
|
||||
}
|
||||
if (!parallel) {
|
||||
forward = !forward
|
||||
@@ -309,7 +305,7 @@ function createMatrixLeds(){
|
||||
$(document).ready(function() {
|
||||
// translate
|
||||
performTranslation();
|
||||
|
||||
|
||||
//add intros
|
||||
if(window.showOptHelp)
|
||||
{
|
||||
@@ -317,9 +313,9 @@ $(document).ready(function() {
|
||||
createHintH("intro", $.i18n('conf_leds_layout_intro'), "layout_intro");
|
||||
$('#led_vis_help').html('<div><div class="led_ex" style="background-color:black;margin-right:5px;margin-top:3px"></div><div style="display:inline-block;vertical-align:top">'+$.i18n('conf_leds_layout_preview_l1')+'</div></div><div class="led_ex" style="background-color:grey;margin-top:3px;margin-right:2px"></div><div class="led_ex" style="background-color: rgb(169, 169, 169);margin-right:5px;margin-top:3px;"></div><div style="display:inline-block;vertical-align:top">'+$.i18n('conf_leds_layout_preview_l2')+'</div>');
|
||||
}
|
||||
|
||||
|
||||
var slConfig = window.serverConfig.ledConfig;
|
||||
|
||||
|
||||
//restore ledConfig
|
||||
for(var key in slConfig)
|
||||
{
|
||||
@@ -343,7 +339,7 @@ $(document).ready(function() {
|
||||
}
|
||||
setTimeout(requestWriteConfig, 100, {ledConfig});
|
||||
}
|
||||
|
||||
|
||||
// check access level and adjust ui
|
||||
if(storedAccess == "default")
|
||||
{
|
||||
@@ -357,10 +353,10 @@ $(document).ready(function() {
|
||||
$('#btn_ma_save').toggle(false);
|
||||
$('#btn_cl_save').toggle(false);
|
||||
}
|
||||
|
||||
|
||||
//Wiki link
|
||||
$('#leds_wl').append('<p style="font-weight:bold">'+$.i18n('general_wiki_moreto',$.i18n('conf_leds_nav_label_ledlayout'))+buildWL("user/moretopics/ledarea","Wiki")+'</p>');
|
||||
|
||||
|
||||
// bind change event to all inputs
|
||||
$('.ledCLconstr').bind("change", function() {
|
||||
valValue(this.id,this.value,this.min,this.max);
|
||||
@@ -373,7 +369,7 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
// v4 of json schema with diff required assignment - remove when hyperion schema moved to v4
|
||||
var ledschema = {"items":{"additionalProperties":false,"required":["hscan","vscan","index"],"properties":{"clone":{"type":"integer"},"colorOrder":{"enum":["rgb","bgr","rbg","brg","gbr","grb"],"type":"string"},"hscan":{"additionalProperties":false,"properties":{"maximum":{"maximum":1,"minimum":0,"type":"number"},"minimum":{"maximum":1,"minimum":0,"type":"number"}},"type":"object"},"index":{"type":"integer"},"vscan":{"additionalProperties":false,"properties":{"maximum":{"maximum":1,"minimum":0,"type":"number"},"minimum":{"maximum":1,"minimum":0,"type":"number"}},"type":"object"}},"type":"object"},"type":"array"};
|
||||
var ledschema = {"items":{"additionalProperties":false,"required":["h","v"],"properties":{"colorOrder":{"enum":["rgb","bgr","rbg","brg","gbr","grb"],"type":"string"},"h":{"additionalProperties":false,"properties":{"max":{"maximum":1,"minimum":0,"type":"number"},"min":{"maximum":1,"minimum":0,"type":"number"}},"type":"object"},"v":{"additionalProperties":false,"properties":{"max":{"maximum":1,"minimum":0,"type":"number"},"min":{"maximum":1,"minimum":0,"type":"number"}},"type":"object"}},"type":"object"},"type":"array"};
|
||||
//create jsonace editor
|
||||
var aceEdt = new JSONACEEditor(document.getElementById("aceedit"),{
|
||||
mode: 'code',
|
||||
@@ -387,7 +383,7 @@ $(document).ready(function() {
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
|
||||
|
||||
if(success)
|
||||
{
|
||||
$('#leds_custom_updsim').attr("disabled", false);
|
||||
@@ -400,7 +396,7 @@ $(document).ready(function() {
|
||||
}
|
||||
}
|
||||
}, window.serverConfig.leds);
|
||||
|
||||
|
||||
//TODO: HACK! No callback for schema validation - Add it!
|
||||
setInterval(function(){
|
||||
if($('#aceedit table').hasClass('jsoneditor-text-errors'))
|
||||
@@ -409,23 +405,23 @@ $(document).ready(function() {
|
||||
$('#leds_custom_save').attr("disabled", true);
|
||||
}
|
||||
},1000);
|
||||
|
||||
|
||||
$('.jsoneditor-menu').toggle();
|
||||
|
||||
|
||||
// leds to finalLedArray
|
||||
finalLedArray = window.serverConfig.leds;
|
||||
|
||||
|
||||
// cl/ma leds push to textfield
|
||||
$('#btn_cl_generate, #btn_ma_generate').off().on("click", function(e) {
|
||||
if(e.currentTarget.id == "btn_cl_generate")
|
||||
$('#collapse1').collapse('hide');
|
||||
else
|
||||
$('#collapse2').collapse('hide');
|
||||
|
||||
|
||||
aceEdt.set(finalLedArray);
|
||||
$('#collapse4').collapse('show');
|
||||
});
|
||||
|
||||
|
||||
// create and update editor
|
||||
$("#leddevices").off().on("change", function() {
|
||||
var generalOptions = window.serverSchema.properties.device;
|
||||
@@ -437,7 +433,7 @@ $(document).ready(function() {
|
||||
generalOptions : generalOptions,
|
||||
specificOptions : specificOptions,
|
||||
});
|
||||
|
||||
|
||||
var values_general = {};
|
||||
var values_specific = {};
|
||||
var isCurrentDevice = (window.serverInfo.ledDevices.active == $(this).val());
|
||||
@@ -457,10 +453,10 @@ $(document).ready(function() {
|
||||
|
||||
conf_editor.getEditor("root.specificOptions").setValue( values_specific );
|
||||
};
|
||||
|
||||
|
||||
// change save button state based on validation result
|
||||
conf_editor.validate().length ? $('#btn_submit_controller').attr('disabled', true) : $('#btn_submit_controller').attr('disabled', false);
|
||||
|
||||
|
||||
// led controller sepecific wizards
|
||||
if($(this).val() == "philipshue")
|
||||
{
|
||||
@@ -473,7 +469,7 @@ $(document).ready(function() {
|
||||
$('#btn_led_device_wiz').off();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// create led device selection
|
||||
var ledDevices = window.serverInfo.ledDevices.available;
|
||||
var devRPiSPI = ['apa102', 'apa104', 'ws2801', 'lpd6803', 'lpd8806', 'p9813', 'sk6812spi', 'sk6822spi', 'ws2812spi'];
|
||||
@@ -481,14 +477,14 @@ $(document).ready(function() {
|
||||
var devRPiGPIO = ['piblaster'];
|
||||
var devNET = ['atmoorb', 'fadecandy', 'philipshue', 'nanoleaf', 'tinkerforge', 'tpm2net', 'udpe131', 'udpartnet', 'udph801', 'udpraw'];
|
||||
var devUSB = ['adalight', 'dmx', 'atmo', 'hyperionusbasp', 'lightpack', 'multilightpack', 'paintpack', 'rawhid', 'sedu', 'tpm2', 'karate'];
|
||||
|
||||
|
||||
var optArr = [[]];
|
||||
optArr[1]=[];
|
||||
optArr[2]=[];
|
||||
optArr[3]=[];
|
||||
optArr[4]=[];
|
||||
optArr[5]=[];
|
||||
|
||||
|
||||
for (var idx=0; idx<ledDevices.length; idx++)
|
||||
{
|
||||
if($.inArray(ledDevices[idx], devRPiSPI) != -1)
|
||||
@@ -504,7 +500,7 @@ $(document).ready(function() {
|
||||
else
|
||||
optArr[5].push(ledDevices[idx]);
|
||||
}
|
||||
|
||||
|
||||
$("#leddevices").append(createSel(optArr[0], $.i18n('conf_leds_optgroup_RPiSPI')));
|
||||
$("#leddevices").append(createSel(optArr[1], $.i18n('conf_leds_optgroup_RPiPWM')));
|
||||
$("#leddevices").append(createSel(optArr[2], $.i18n('conf_leds_optgroup_RPiGPIO')));
|
||||
@@ -518,13 +514,13 @@ $(document).ready(function() {
|
||||
$("#leds_custom_updsim").off().on("click", function() {
|
||||
createLedPreview(aceEdt.get(), 'text');
|
||||
});
|
||||
|
||||
|
||||
// save led config and saveValues - passing textfield
|
||||
$("#btn_ma_save, #btn_cl_save").off().on("click", function() {
|
||||
requestWriteConfig({"leds" :finalLedArray});
|
||||
saveValues();
|
||||
});
|
||||
|
||||
|
||||
// save led config from textfield
|
||||
$("#leds_custom_save").off().on("click", function() {
|
||||
requestWriteConfig(JSON.parse('{"leds" :'+aceEdt.getText()+'}'));
|
||||
@@ -536,13 +532,13 @@ $(document).ready(function() {
|
||||
$('.led_prev_num').toggle();
|
||||
toggleClass('#leds_prev_toggle_num', "btn-danger", "btn-success");
|
||||
});
|
||||
|
||||
|
||||
// open checklist
|
||||
$('#leds_prev_checklist').off().on("click", function() {
|
||||
var liList = [$.i18n('conf_leds_layout_checkp1'),$.i18n('conf_leds_layout_checkp3'),$.i18n('conf_leds_layout_checkp2'),$.i18n('conf_leds_layout_checkp4')];
|
||||
var ul = document.createElement("ul");
|
||||
ul.className = "checklist"
|
||||
|
||||
|
||||
for(var i = 0; i<liList.length; i++)
|
||||
{
|
||||
var li = document.createElement("li");
|
||||
@@ -551,7 +547,7 @@ $(document).ready(function() {
|
||||
}
|
||||
showInfoDialog('checklist', "", ul);
|
||||
});
|
||||
|
||||
|
||||
// nav
|
||||
$('#leds_cfg_nav a[data-toggle="tab"]').off().on('shown.bs.tab', function (e) {
|
||||
var target = $(e.target).attr("href") // activated tab
|
||||
@@ -561,13 +557,13 @@ $(document).ready(function() {
|
||||
ledsCustomCfgInitialized = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// save led device config
|
||||
$("#btn_submit_controller").off().on("click", function(event) {
|
||||
|
||||
var ledDevice = $("#leddevices").val();
|
||||
var result = {device:{}};
|
||||
|
||||
|
||||
var general = conf_editor.getEditor("root.generalOptions").getValue();
|
||||
var specific = conf_editor.getEditor("root.specificOptions").getValue();
|
||||
for(var key in general){
|
||||
|
@@ -22,7 +22,7 @@ $(document).ready(function() {
|
||||
for(var idx=0; idx<leds.length; idx++)
|
||||
{
|
||||
var led = leds[idx];
|
||||
twoDPaths.push( build2DPath(led.hscan.minimum * canvas_width, led.vscan.minimum * canvas_height, (led.hscan.maximum-led.hscan.minimum) * canvas_width, (led.vscan.maximum-led.vscan.minimum) * canvas_height, 5) );
|
||||
twoDPaths.push( build2DPath(led.h.min * canvas_width, led.v.min * canvas_height, (led.h.max-led.h.min) * canvas_width, (led.v.max-led.v.min) * canvas_height, 5) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,18 +131,23 @@ $(document).ready(function() {
|
||||
return;
|
||||
|
||||
var useColor = false;
|
||||
var cPos = 0;
|
||||
ledsCanvasNodeCtx.clear();
|
||||
if(typeof colors != "undefined")
|
||||
useColor = true;
|
||||
|
||||
// check size of ledcolors with leds length
|
||||
if(colors && colors.length/3 < leds.length)
|
||||
return;
|
||||
|
||||
for(var idx=0; idx<leds.length; idx++)
|
||||
{
|
||||
var led = leds[idx];
|
||||
// can be used as fallback when Path2D is not available
|
||||
//roundRect(ledsCanvasNodeCtx, led.hscan.minimum * canvas_width, led.vscan.minimum * canvas_height, (led.hscan.maximum-led.hscan.minimum) * canvas_width, (led.vscan.maximum-led.vscan.minimum) * canvas_height, 4, true, colors[idx])
|
||||
//ledsCanvasNodeCtx.fillRect(led.hscan.minimum * canvas_width, led.vscan.minimum * canvas_height, (led.hscan.maximum-led.hscan.minimum) * canvas_width, (led.vscan.maximum-led.vscan.minimum) * canvas_height);
|
||||
|
||||
ledsCanvasNodeCtx.fillStyle = (useColor) ? "rgba("+colors[idx].red+","+colors[idx].green+","+colors[idx].blue+",0.9)" : "hsl("+(idx*360/leds.length)+",100%,50%)";
|
||||
//roundRect(ledsCanvasNodeCtx, led.h.min * canvas_width, led.v.min * canvas_height, (led.h.max-led.h.min) * canvas_width, (led.v.max-led.v.min) * canvas_height, 4, true, colors[idx])
|
||||
//ledsCanvasNodeCtx.fillRect(led.h.min * canvas_width, led.v.min * canvas_height, (led.h.max-led.h.min) * canvas_width, (led.v.max-led.v.min) * canvas_height);
|
||||
|
||||
ledsCanvasNodeCtx.fillStyle = (useColor) ? "rgba("+colors[cPos]+","+colors[cPos+1]+","+colors[cPos+2]+",0.9)" : "hsl("+(idx*360/leds.length)+",100%,50%)";
|
||||
ledsCanvasNodeCtx.fill(twoDPaths[idx]);
|
||||
ledsCanvasNodeCtx.stroke(twoDPaths[idx]);
|
||||
|
||||
@@ -150,8 +155,11 @@ $(document).ready(function() {
|
||||
{
|
||||
ledsCanvasNodeCtx.fillStyle = "blue";
|
||||
ledsCanvasNodeCtx.textAlign = "center";
|
||||
ledsCanvasNodeCtx.fillText(idx, (led.hscan.minimum * canvas_width) + ( ((led.hscan.maximum-led.hscan.minimum) * canvas_width) / 2), (led.vscan.minimum * canvas_height) + ( ((led.vscan.maximum-led.vscan.minimum) * canvas_height) / 2));
|
||||
ledsCanvasNodeCtx.fillText(idx, (led.h.min * canvas_width) + ( ((led.h.max-led.h.min) * canvas_width) / 2), (led.v.min * canvas_height) + ( ((led.v.max-led.v.min) * canvas_height) / 2));
|
||||
}
|
||||
|
||||
// increment colorsPosition
|
||||
cPos += 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -518,11 +518,11 @@ $('#btn_wizard_colorcalibration').off().on('click', startWizardCC);
|
||||
var hueIPs = [];
|
||||
var hueIPsinc = 0;
|
||||
var lightIDs = null;
|
||||
var huePosTop = {hscan: {maximum: 0.85,minimum: 0.15},index: 0,vscan: {maximum: 0.2,minimum: 0}};
|
||||
var huePosBottom = {hscan: {maximum: 0.85,minimum: 0.15},index: 2,vscan: {maximum: 1,minimum: 0.8}};
|
||||
var huePosLeft = {hscan: {maximum: 0.15,minimum: 0},index: 1,vscan: {maximum: 0.85,minimum: 0.15}};
|
||||
var huePosRight = {hscan: {maximum: 1,minimum: 0.85},index: 3,vscan: {maximum: 0.85,minimum: 0.15}};
|
||||
var huePosEntire = {hscan: {maximum: 1.0,minimum: 0.0},index: 0,vscan: {maximum: 1.0,minimum: 0.0}};
|
||||
var huePosTop = {h: {max: 0.85, min: 0.15}, v: {max: 0.2, min: 0}};
|
||||
var huePosBottom = {h: {max: 0.85, min: 0.15}, v: {max: 1, min: 0.8}};
|
||||
var huePosLeft = {h: {max: 0.15, min: 0}, v: {max: 0.85, min: 0.15}};
|
||||
var huePosRight = {h: {max: 1, min: 0.85}, v: {max: 0.85, min: 0.15}};
|
||||
var huePosEntire = {h: {max: 1.0, min: 0.0}, v: {max: 1.0, min: 0.0}};
|
||||
|
||||
function startWizardPhilipsHue()
|
||||
{
|
||||
@@ -620,9 +620,9 @@ function checkBridgeResult(reply){
|
||||
}
|
||||
};
|
||||
|
||||
function assignHuePos(id, pos, inc)
|
||||
{
|
||||
var i = null;
|
||||
function assignHuePos(id, pos)
|
||||
{
|
||||
var i = null;
|
||||
|
||||
if(pos == "top")
|
||||
i = huePosTop;
|
||||
@@ -635,9 +635,8 @@ function assignHuePos(id, pos, inc)
|
||||
else
|
||||
i = huePosEntire;
|
||||
|
||||
i.index = inc;
|
||||
return i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
function identHueId(id, off)
|
||||
{
|
||||
@@ -706,23 +705,14 @@ function beginWizardHue()
|
||||
checkHueBridge(checkUserResult,$('#user').val() ? $('#user').val() : "newdeveloper");
|
||||
});
|
||||
|
||||
$('#wiz_hue_create_user').off().on('click',function() {
|
||||
createHueUser();
|
||||
});
|
||||
|
||||
$('#btn_wiz_save').off().on("click", function(){
|
||||
var hueLedConfig = [];
|
||||
var finalLightIds = [];
|
||||
|
||||
//create hue led config
|
||||
var incC = 0;
|
||||
for(var key in lightIDs)
|
||||
{
|
||||
if($('#hue_'+key).val() != "disabled")
|
||||
//create hue led config
|
||||
for(var key in lightIDs)
|
||||
{
|
||||
hueLedConfig.push(assignHuePos(key, $('#hue_'+key).val(), incC));
|
||||
finalLightIds.push(parseInt(key));
|
||||
incC++;
|
||||
if($('#hue_'+key).val() != "disabled")
|
||||
{
|
||||
hueLedConfig.push(assignHuePos(key, $('#hue_'+key).val()));
|
||||
finalLightIds.push(parseInt(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -774,17 +764,17 @@ function createHueUser()
|
||||
|
||||
connectionRetries--;
|
||||
$("#connectionTime").html(connectionRetries);
|
||||
if(connectionRetries == 0)
|
||||
if(connectionRetries == 0)
|
||||
{
|
||||
abortConnection(UserInterval);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (typeof r[0].error != 'undefined')
|
||||
if (typeof r[0].error != 'undefined')
|
||||
{
|
||||
console.log(connectionRetries+": link not pressed");
|
||||
}
|
||||
if (typeof r[0].success != 'undefined')
|
||||
if (typeof r[0].success != 'undefined')
|
||||
{
|
||||
$('#wizp1').toggle(false);
|
||||
$('#wizp2').toggle(true);
|
||||
|
Reference in New Issue
Block a user