mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02: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:
parent
24495bbc65
commit
b1fa085d64
@ -39,11 +39,11 @@ 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"});
|
||||
@ -87,11 +87,11 @@ function createClassicLeds(){
|
||||
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');
|
||||
}
|
||||
@ -134,7 +134,7 @@ function createClassicLeds(){
|
||||
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(){
|
||||
@ -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
|
||||
@ -266,14 +264,13 @@ function createMatrixLeds(){
|
||||
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
|
||||
@ -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',
|
||||
|
@ -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);
|
||||
//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[idx].red+","+colors[idx].green+","+colors[idx].blue+",0.9)" : "hsl("+(idx*360/leds.length)+",100%,50%)";
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,299 +335,271 @@
|
||||
/// The configuration for each individual led. This contains the specification of the area
|
||||
/// averaged of an input image for each led to determine its color. Each item in the list
|
||||
/// contains the following fields:
|
||||
/// * index: The index of the led. This determines its location in the string of leds; zero
|
||||
/// being the first led.
|
||||
/// * hscan: The fractional part of the image along the horizontal used for the averaging
|
||||
/// (minimum and maximum inclusive)
|
||||
/// * vscan: The fractional part of the image along the vertical used for the averaging
|
||||
/// (minimum and maximum inclusive)
|
||||
/// * h: The fractional part of the image along the horizontal used for the averaging
|
||||
/// (min and max inclusive)
|
||||
/// * v: The fractional part of the image along the vertical used for the averaging
|
||||
/// (min and max inclusive)
|
||||
|
||||
"leds":
|
||||
"leds":
|
||||
[
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.125,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.125,
|
||||
"min": 0
|
||||
},
|
||||
"index": 0,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.25,
|
||||
"minimum": 0.125
|
||||
"h": {
|
||||
"max": 0.25,
|
||||
"min": 0.125
|
||||
},
|
||||
"index": 1,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.375,
|
||||
"minimum": 0.25
|
||||
"h": {
|
||||
"max": 0.375,
|
||||
"min": 0.25
|
||||
},
|
||||
"index": 2,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.5,
|
||||
"minimum": 0.375
|
||||
"h": {
|
||||
"max": 0.5,
|
||||
"min": 0.375
|
||||
},
|
||||
"index": 3,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.625,
|
||||
"minimum": 0.5
|
||||
"h": {
|
||||
"max": 0.625,
|
||||
"min": 0.5
|
||||
},
|
||||
"index": 4,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.75,
|
||||
"minimum": 0.625
|
||||
"h": {
|
||||
"max": 0.75,
|
||||
"min": 0.625
|
||||
},
|
||||
"index": 5,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.875,
|
||||
"minimum": 0.75
|
||||
"h": {
|
||||
"max": 0.875,
|
||||
"min": 0.75
|
||||
},
|
||||
"index": 6,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.875
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.875
|
||||
},
|
||||
"index": 7,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.95
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.95
|
||||
},
|
||||
"index": 8,
|
||||
"vscan": {
|
||||
"maximum": 0.2,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.2,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.95
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.95
|
||||
},
|
||||
"index": 9,
|
||||
"vscan": {
|
||||
"maximum": 0.4,
|
||||
"minimum": 0.2
|
||||
"v": {
|
||||
"max": 0.4,
|
||||
"min": 0.2
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.95
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.95
|
||||
},
|
||||
"index": 10,
|
||||
"vscan": {
|
||||
"maximum": 0.6,
|
||||
"minimum": 0.4
|
||||
"v": {
|
||||
"max": 0.6,
|
||||
"min": 0.4
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.95
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.95
|
||||
},
|
||||
"index": 11,
|
||||
"vscan": {
|
||||
"maximum": 0.8,
|
||||
"minimum": 0.6
|
||||
"v": {
|
||||
"max": 0.8,
|
||||
"min": 0.6
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.95
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.95
|
||||
},
|
||||
"index": 12,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.8
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.8
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.875
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.875
|
||||
},
|
||||
"index": 13,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.875,
|
||||
"minimum": 0.75
|
||||
"h": {
|
||||
"max": 0.875,
|
||||
"min": 0.75
|
||||
},
|
||||
"index": 14,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.75,
|
||||
"minimum": 0.625
|
||||
"h": {
|
||||
"max": 0.75,
|
||||
"min": 0.625
|
||||
},
|
||||
"index": 15,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.625,
|
||||
"minimum": 0.5
|
||||
"h": {
|
||||
"max": 0.625,
|
||||
"min": 0.5
|
||||
},
|
||||
"index": 16,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.5,
|
||||
"minimum": 0.375
|
||||
"h": {
|
||||
"max": 0.5,
|
||||
"min": 0.375
|
||||
},
|
||||
"index": 17,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.375,
|
||||
"minimum": 0.25
|
||||
"h": {
|
||||
"max": 0.375,
|
||||
"min": 0.25
|
||||
},
|
||||
"index": 18,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.25,
|
||||
"minimum": 0.125
|
||||
"h": {
|
||||
"max": 0.25,
|
||||
"min": 0.125
|
||||
},
|
||||
"index": 19,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.125,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.125,
|
||||
"min": 0
|
||||
},
|
||||
"index": 20,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.05,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.05,
|
||||
"min": 0
|
||||
},
|
||||
"index": 21,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.8
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.8
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.05,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.05,
|
||||
"min": 0
|
||||
},
|
||||
"index": 22,
|
||||
"vscan": {
|
||||
"maximum": 0.8,
|
||||
"minimum": 0.6
|
||||
"v": {
|
||||
"max": 0.8,
|
||||
"min": 0.6
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.05,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.05,
|
||||
"min": 0
|
||||
},
|
||||
"index": 23,
|
||||
"vscan": {
|
||||
"maximum": 0.6,
|
||||
"minimum": 0.4
|
||||
"v": {
|
||||
"max": 0.6,
|
||||
"min": 0.4
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.05,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.05,
|
||||
"min": 0
|
||||
},
|
||||
"index": 24,
|
||||
"vscan": {
|
||||
"maximum": 0.4,
|
||||
"minimum": 0.2
|
||||
"v": {
|
||||
"max": 0.4,
|
||||
"min": 0.2
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.05,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.05,
|
||||
"min": 0
|
||||
},
|
||||
"index": 25,
|
||||
"vscan": {
|
||||
"maximum": 0.2,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.2,
|
||||
"min": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -203,289 +203,263 @@
|
||||
"leds":
|
||||
[
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.125,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.125,
|
||||
"min": 0
|
||||
},
|
||||
"index": 0,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.25,
|
||||
"minimum": 0.125
|
||||
"h": {
|
||||
"max": 0.25,
|
||||
"min": 0.125
|
||||
},
|
||||
"index": 1,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.375,
|
||||
"minimum": 0.25
|
||||
"h": {
|
||||
"max": 0.375,
|
||||
"min": 0.25
|
||||
},
|
||||
"index": 2,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.5,
|
||||
"minimum": 0.375
|
||||
"h": {
|
||||
"max": 0.5,
|
||||
"min": 0.375
|
||||
},
|
||||
"index": 3,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.625,
|
||||
"minimum": 0.5
|
||||
"h": {
|
||||
"max": 0.625,
|
||||
"min": 0.5
|
||||
},
|
||||
"index": 4,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.75,
|
||||
"minimum": 0.625
|
||||
"h": {
|
||||
"max": 0.75,
|
||||
"min": 0.625
|
||||
},
|
||||
"index": 5,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.875,
|
||||
"minimum": 0.75
|
||||
"h": {
|
||||
"max": 0.875,
|
||||
"min": 0.75
|
||||
},
|
||||
"index": 6,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.875
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.875
|
||||
},
|
||||
"index": 7,
|
||||
"vscan": {
|
||||
"maximum": 0.08,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.08,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.95
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.95
|
||||
},
|
||||
"index": 8,
|
||||
"vscan": {
|
||||
"maximum": 0.2,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.2,
|
||||
"min": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.95
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.95
|
||||
},
|
||||
"index": 9,
|
||||
"vscan": {
|
||||
"maximum": 0.4,
|
||||
"minimum": 0.2
|
||||
"v": {
|
||||
"max": 0.4,
|
||||
"min": 0.2
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.95
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.95
|
||||
},
|
||||
"index": 10,
|
||||
"vscan": {
|
||||
"maximum": 0.6,
|
||||
"minimum": 0.4
|
||||
"v": {
|
||||
"max": 0.6,
|
||||
"min": 0.4
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.95
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.95
|
||||
},
|
||||
"index": 11,
|
||||
"vscan": {
|
||||
"maximum": 0.8,
|
||||
"minimum": 0.6
|
||||
"v": {
|
||||
"max": 0.8,
|
||||
"min": 0.6
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.95
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.95
|
||||
},
|
||||
"index": 12,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.8
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.8
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.875
|
||||
"h": {
|
||||
"max": 1,
|
||||
"min": 0.875
|
||||
},
|
||||
"index": 13,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.875,
|
||||
"minimum": 0.75
|
||||
"h": {
|
||||
"max": 0.875,
|
||||
"min": 0.75
|
||||
},
|
||||
"index": 14,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.75,
|
||||
"minimum": 0.625
|
||||
"h": {
|
||||
"max": 0.75,
|
||||
"min": 0.625
|
||||
},
|
||||
"index": 15,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.625,
|
||||
"minimum": 0.5
|
||||
"h": {
|
||||
"max": 0.625,
|
||||
"min": 0.5
|
||||
},
|
||||
"index": 16,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.5,
|
||||
"minimum": 0.375
|
||||
"h": {
|
||||
"max": 0.5,
|
||||
"min": 0.375
|
||||
},
|
||||
"index": 17,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.375,
|
||||
"minimum": 0.25
|
||||
"h": {
|
||||
"max": 0.375,
|
||||
"min": 0.25
|
||||
},
|
||||
"index": 18,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.25,
|
||||
"minimum": 0.125
|
||||
"h": {
|
||||
"max": 0.25,
|
||||
"min": 0.125
|
||||
},
|
||||
"index": 19,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.125,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.125,
|
||||
"min": 0
|
||||
},
|
||||
"index": 20,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.92
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.92
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.05,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.05,
|
||||
"min": 0
|
||||
},
|
||||
"index": 21,
|
||||
"vscan": {
|
||||
"maximum": 1,
|
||||
"minimum": 0.8
|
||||
"v": {
|
||||
"max": 1,
|
||||
"min": 0.8
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.05,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.05,
|
||||
"min": 0
|
||||
},
|
||||
"index": 22,
|
||||
"vscan": {
|
||||
"maximum": 0.8,
|
||||
"minimum": 0.6
|
||||
"v": {
|
||||
"max": 0.8,
|
||||
"min": 0.6
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.05,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.05,
|
||||
"min": 0
|
||||
},
|
||||
"index": 23,
|
||||
"vscan": {
|
||||
"maximum": 0.6,
|
||||
"minimum": 0.4
|
||||
"v": {
|
||||
"max": 0.6,
|
||||
"min": 0.4
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.05,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.05,
|
||||
"min": 0
|
||||
},
|
||||
"index": 24,
|
||||
"vscan": {
|
||||
"maximum": 0.4,
|
||||
"minimum": 0.2
|
||||
"v": {
|
||||
"max": 0.4,
|
||||
"min": 0.2
|
||||
}
|
||||
},
|
||||
{
|
||||
"hscan": {
|
||||
"maximum": 0.05,
|
||||
"minimum": 0
|
||||
"h": {
|
||||
"max": 0.05,
|
||||
"min": 0
|
||||
},
|
||||
"index": 25,
|
||||
"vscan": {
|
||||
"maximum": 0.2,
|
||||
"minimum": 0
|
||||
"v": {
|
||||
"max": 0.2,
|
||||
"min": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -489,9 +489,6 @@ private:
|
||||
/// The specifiation of the led frame construction and picture integration
|
||||
LedString _ledString;
|
||||
|
||||
/// specifiation of cloned leds
|
||||
LedString _ledStringClone;
|
||||
|
||||
/// Image Processor
|
||||
ImageProcessor* _imageProcessor;
|
||||
|
||||
|
@ -88,9 +88,6 @@ inline ColorOrder stringToColorOrder(const QString & order)
|
||||
///
|
||||
struct Led
|
||||
{
|
||||
/// The index of the led
|
||||
unsigned index;
|
||||
|
||||
/// The minimum vertical scan line included for this leds color
|
||||
double minX_frac;
|
||||
/// The maximum vertical scan line included for this leds color
|
||||
@ -99,8 +96,6 @@ struct Led
|
||||
double minY_frac;
|
||||
/// The maximum horizontal scan line included for this leds color
|
||||
double maxY_frac;
|
||||
/// id to clone
|
||||
int clone;
|
||||
/// the color order
|
||||
ColorOrder colorOrder;
|
||||
};
|
||||
|
@ -192,86 +192,32 @@ namespace hyperion {
|
||||
{
|
||||
LedString ledString;
|
||||
const QString deviceOrderStr = colorOrderToString(deviceOrder);
|
||||
int maxLedId = ledConfigArray.size();
|
||||
|
||||
for (signed i = 0; i < ledConfigArray.size(); ++i)
|
||||
{
|
||||
const QJsonObject& index = ledConfigArray[i].toObject();
|
||||
|
||||
Led led;
|
||||
led.index = index["index"].toInt();
|
||||
led.clone = index["clone"].toInt(-1);
|
||||
if ( led.clone < -1 || led.clone >= maxLedId )
|
||||
|
||||
const QJsonObject& hscanConfig = ledConfigArray[i].toObject()["h"].toObject();
|
||||
const QJsonObject& vscanConfig = ledConfigArray[i].toObject()["v"].toObject();
|
||||
led.minX_frac = qMax(0.0, qMin(1.0, hscanConfig["min"].toDouble()));
|
||||
led.maxX_frac = qMax(0.0, qMin(1.0, hscanConfig["max"].toDouble()));
|
||||
led.minY_frac = qMax(0.0, qMin(1.0, vscanConfig["min"].toDouble()));
|
||||
led.maxY_frac = qMax(0.0, qMin(1.0, vscanConfig["max"].toDouble()));
|
||||
// Fix if the user swapped min and max
|
||||
if (led.minX_frac > led.maxX_frac)
|
||||
{
|
||||
//Warning(_log, "LED %d: clone index of %d is out of range, clone ignored", led.index, led.clone);
|
||||
led.clone = -1;
|
||||
std::swap(led.minX_frac, led.maxX_frac);
|
||||
}
|
||||
if (led.minY_frac > led.maxY_frac)
|
||||
{
|
||||
std::swap(led.minY_frac, led.maxY_frac);
|
||||
}
|
||||
|
||||
if ( led.clone < 0 )
|
||||
{
|
||||
const QJsonObject& hscanConfig = ledConfigArray[i].toObject()["hscan"].toObject();
|
||||
const QJsonObject& vscanConfig = ledConfigArray[i].toObject()["vscan"].toObject();
|
||||
led.minX_frac = qMax(0.0, qMin(1.0, hscanConfig["minimum"].toDouble()));
|
||||
led.maxX_frac = qMax(0.0, qMin(1.0, hscanConfig["maximum"].toDouble()));
|
||||
led.minY_frac = qMax(0.0, qMin(1.0, vscanConfig["minimum"].toDouble()));
|
||||
led.maxY_frac = qMax(0.0, qMin(1.0, vscanConfig["maximum"].toDouble()));
|
||||
// Fix if the user swapped min and max
|
||||
if (led.minX_frac > led.maxX_frac)
|
||||
{
|
||||
std::swap(led.minX_frac, led.maxX_frac);
|
||||
}
|
||||
if (led.minY_frac > led.maxY_frac)
|
||||
{
|
||||
std::swap(led.minY_frac, led.maxY_frac);
|
||||
}
|
||||
|
||||
// Get the order of the rgb channels for this led (default is device order)
|
||||
led.colorOrder = stringToColorOrder(index["colorOrder"].toString(deviceOrderStr));
|
||||
ledString.leds().push_back(led);
|
||||
}
|
||||
// Get the order of the rgb channels for this led (default is device order)
|
||||
led.colorOrder = stringToColorOrder(index["colorOrder"].toString(deviceOrderStr));
|
||||
ledString.leds().push_back(led);
|
||||
}
|
||||
|
||||
// Make sure the leds are sorted (on their indices)
|
||||
std::sort(ledString.leds().begin(), ledString.leds().end(), [](const Led& lhs, const Led& rhs){ return lhs.index < rhs.index; });
|
||||
return ledString;
|
||||
}
|
||||
|
||||
LedString createLedStringClone(const QJsonArray& ledConfigArray, const ColorOrder deviceOrder)
|
||||
{
|
||||
LedString ledString;
|
||||
const QString deviceOrderStr = colorOrderToString(deviceOrder);
|
||||
int maxLedId = ledConfigArray.size();
|
||||
|
||||
for (signed i = 0; i < ledConfigArray.size(); ++i)
|
||||
{
|
||||
const QJsonObject& index = ledConfigArray[i].toObject();
|
||||
|
||||
Led led;
|
||||
led.index = index["index"].toInt();
|
||||
led.clone = index["clone"].toInt(-1);
|
||||
if ( led.clone < -1 || led.clone >= maxLedId )
|
||||
{
|
||||
//Warning(_log, "LED %d: clone index of %d is out of range, clone ignored", led.index, led.clone);
|
||||
led.clone = -1;
|
||||
}
|
||||
|
||||
if ( led.clone >= 0 )
|
||||
{
|
||||
//Debug(_log, "LED %d: clone from led %d", led.index, led.clone);
|
||||
led.minX_frac = 0;
|
||||
led.maxX_frac = 0;
|
||||
led.minY_frac = 0;
|
||||
led.maxY_frac = 0;
|
||||
// Get the order of the rgb channels for this led (default is device order)
|
||||
led.colorOrder = stringToColorOrder(index["colorOrder"].toString(deviceOrderStr));
|
||||
|
||||
ledString.leds().push_back(led);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Make sure the leds are sorted (on their indices)
|
||||
std::sort(ledString.leds().begin(), ledString.leds().end(), [](const Led& lhs, const Led& rhs){ return lhs.index < rhs.index; });
|
||||
return ledString;
|
||||
}
|
||||
|
||||
@ -282,30 +228,26 @@ namespace hyperion {
|
||||
|
||||
for (signed i = 0; i < ledConfigArray.size(); ++i)
|
||||
{
|
||||
const QJsonObject& index = ledConfigArray[i].toObject();
|
||||
|
||||
if (index["clone"].toInt(-1) < 0 )
|
||||
const QJsonObject& hscanConfig = ledConfigArray[i].toObject()["h"].toObject();
|
||||
const QJsonObject& vscanConfig = ledConfigArray[i].toObject()["v"].toObject();
|
||||
double minX_frac = qMax(0.0, qMin(1.0, hscanConfig["min"].toDouble()));
|
||||
double maxX_frac = qMax(0.0, qMin(1.0, hscanConfig["max"].toDouble()));
|
||||
double minY_frac = qMax(0.0, qMin(1.0, vscanConfig["min"].toDouble()));
|
||||
double maxY_frac = qMax(0.0, qMin(1.0, vscanConfig["max"].toDouble()));
|
||||
// Fix if the user swapped min and max
|
||||
if (minX_frac > maxX_frac)
|
||||
{
|
||||
const QJsonObject& hscanConfig = ledConfigArray[i].toObject()["hscan"].toObject();
|
||||
const QJsonObject& vscanConfig = ledConfigArray[i].toObject()["vscan"].toObject();
|
||||
double minX_frac = qMax(0.0, qMin(1.0, hscanConfig["minimum"].toDouble()));
|
||||
double maxX_frac = qMax(0.0, qMin(1.0, hscanConfig["maximum"].toDouble()));
|
||||
double minY_frac = qMax(0.0, qMin(1.0, vscanConfig["minimum"].toDouble()));
|
||||
double maxY_frac = qMax(0.0, qMin(1.0, vscanConfig["maximum"].toDouble()));
|
||||
// Fix if the user swapped min and max
|
||||
if (minX_frac > maxX_frac)
|
||||
{
|
||||
std::swap(minX_frac, maxX_frac);
|
||||
}
|
||||
if (minY_frac > maxY_frac)
|
||||
{
|
||||
std::swap(minY_frac, maxY_frac);
|
||||
}
|
||||
|
||||
// calculate mid point and make grid calculation
|
||||
midPointsX.push_back( int(1000.0*(minX_frac + maxX_frac) / 2.0) );
|
||||
midPointsY.push_back( int(1000.0*(minY_frac + maxY_frac) / 2.0) );
|
||||
std::swap(minX_frac, maxX_frac);
|
||||
}
|
||||
if (minY_frac > maxY_frac)
|
||||
{
|
||||
std::swap(minY_frac, maxY_frac);
|
||||
}
|
||||
|
||||
// calculate mid point and make grid calculation
|
||||
midPointsX.push_back( int(1000.0*(minX_frac + maxX_frac) / 2.0) );
|
||||
midPointsY.push_back( int(1000.0*(minY_frac + maxY_frac) / 2.0) );
|
||||
|
||||
}
|
||||
|
||||
// remove duplicates
|
||||
@ -315,7 +257,7 @@ namespace hyperion {
|
||||
midPointsY.erase(std::unique(midPointsY.begin(), midPointsY.end()), midPointsY.end());
|
||||
|
||||
QSize gridSize( midPointsX.size(), midPointsY.size() );
|
||||
//Debug(_log, "led layout grid: %dx%d", gridSize.width(), gridSize.height());
|
||||
//Debug(_log, "LED layout grid size: %dx%d", gridSize.width(), gridSize.height());
|
||||
|
||||
return gridSize;
|
||||
}
|
||||
|
@ -1464,14 +1464,9 @@ void JsonAPI::streamLedcolorsUpdate(const std::vector<ColorRgb>& ledColors)
|
||||
QJsonObject result;
|
||||
QJsonArray leds;
|
||||
|
||||
for(auto color = ledColors.begin(); color != ledColors.end(); ++color)
|
||||
for(const auto & color : ledColors)
|
||||
{
|
||||
QJsonObject item;
|
||||
item["index"] = int(color - ledColors.begin());
|
||||
item["red"] = color->red;
|
||||
item["green"] = color->green;
|
||||
item["blue"] = color->blue;
|
||||
leds.append(item);
|
||||
leds << QJsonValue(color.red) << QJsonValue(color.green) << QJsonValue(color.blue);
|
||||
}
|
||||
|
||||
result["leds"] = leds;
|
||||
|
@ -46,7 +46,6 @@ Hyperion::Hyperion(const quint8& instance)
|
||||
, _settingsManager(new SettingsManager(instance, this))
|
||||
, _componentRegister(this)
|
||||
, _ledString(hyperion::createLedString(getSetting(settings::LEDS).array(), hyperion::createColorOrder(getSetting(settings::DEVICE).object())))
|
||||
, _ledStringClone(hyperion::createLedStringClone(getSetting(settings::LEDS).array(), hyperion::createColorOrder(getSetting(settings::DEVICE).object())))
|
||||
, _imageProcessor(new ImageProcessor(_ledString, this))
|
||||
, _muxer(_ledString.leds().size())
|
||||
, _raw2ledAdjustment(hyperion::createLedColorsAdjustment(_ledString.leds().size(), getSetting(settings::COLOR).object()))
|
||||
@ -87,10 +86,6 @@ void Hyperion::start()
|
||||
{
|
||||
_ledStringColorOrder.push_back(led.colorOrder);
|
||||
}
|
||||
for (Led& led : _ledStringClone.leds())
|
||||
{
|
||||
_ledStringColorOrder.insert(_ledStringColorOrder.begin() + led.index, led.colorOrder);
|
||||
}
|
||||
|
||||
// connect Hyperion::update with Muxer visible priority changes as muxer updates independent
|
||||
connect(&_muxer, &PriorityMuxer::visiblePriorityChanged, this, &Hyperion::update);
|
||||
@ -202,9 +197,8 @@ void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocum
|
||||
// stop and cache all running effects, as effects depend heavily on ledlayout
|
||||
_effectEngine->cacheRunningEffects();
|
||||
|
||||
// ledstring, clone, img processor, muxer, ledGridSize (eff engine image based effects), _ledBuffer and ByteOrder of ledstring
|
||||
// ledstring, img processor, muxer, ledGridSize (eff engine image based effects), _ledBuffer and ByteOrder of ledstring
|
||||
_ledString = hyperion::createLedString(leds, hyperion::createColorOrder(getSetting(settings::DEVICE).object()));
|
||||
_ledStringClone = hyperion::createLedStringClone(leds, hyperion::createColorOrder(getSetting(settings::DEVICE).object()));
|
||||
_imageProcessor->setLedString(_ledString);
|
||||
_muxer.updateLedColorsLength(_ledString.leds().size());
|
||||
_ledGridSize = hyperion::getLedLayoutGridSize(leds);
|
||||
@ -217,10 +211,6 @@ void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocum
|
||||
{
|
||||
_ledStringColorOrder.push_back(led.colorOrder);
|
||||
}
|
||||
for (Led& led : _ledStringClone.leds())
|
||||
{
|
||||
_ledStringColorOrder.insert(_ledStringColorOrder.begin() + led.index, led.colorOrder);
|
||||
}
|
||||
|
||||
// handle hwLedCount update
|
||||
_hwLedCount = qMax(unsigned(getSetting(settings::DEVICE).object()["hardwareLedCount"].toInt(getLedCount())), getLedCount());
|
||||
@ -244,7 +234,6 @@ void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocum
|
||||
if(_ledDeviceWrapper->getColorOrder() != dev["colorOrder"].toString("rgb"))
|
||||
{
|
||||
_ledString = hyperion::createLedString(getSetting(settings::LEDS).array(), hyperion::createColorOrder(dev));
|
||||
_ledStringClone = hyperion::createLedStringClone(getSetting(settings::LEDS).array(), hyperion::createColorOrder(dev));
|
||||
_imageProcessor->setLedString(_ledString);
|
||||
}
|
||||
|
||||
@ -542,12 +531,6 @@ void Hyperion::update()
|
||||
|
||||
_raw2ledAdjustment->applyAdjustment(_ledBuffer);
|
||||
|
||||
// insert cloned leds into buffer
|
||||
for (Led& led : _ledStringClone.leds())
|
||||
{
|
||||
_ledBuffer.insert(_ledBuffer.begin() + led.index, _ledBuffer.at(led.clone));
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (ColorRgb& color : _ledBuffer)
|
||||
{
|
||||
|
@ -8,23 +8,13 @@
|
||||
"required" : true,
|
||||
"properties":
|
||||
{
|
||||
"index":
|
||||
{
|
||||
"type":"integer",
|
||||
"required":true,
|
||||
"default" : 0
|
||||
},
|
||||
"clone":
|
||||
{
|
||||
"type":"integer"
|
||||
},
|
||||
"hscan":
|
||||
"h":
|
||||
{
|
||||
"type":"object",
|
||||
"required" : true,
|
||||
"properties":
|
||||
{
|
||||
"minimum":
|
||||
"min":
|
||||
{
|
||||
"type":"number",
|
||||
"minimum" : 0,
|
||||
@ -32,7 +22,7 @@
|
||||
"required":true,
|
||||
"default" : 0
|
||||
},
|
||||
"maximum":
|
||||
"max":
|
||||
{
|
||||
"type":"number",
|
||||
"minimum" : 0,
|
||||
@ -43,13 +33,13 @@
|
||||
},
|
||||
"additionalProperties" : false
|
||||
},
|
||||
"vscan":
|
||||
"v":
|
||||
{
|
||||
"type":"object",
|
||||
"required" : true,
|
||||
"properties":
|
||||
{
|
||||
"minimum":
|
||||
"min":
|
||||
{
|
||||
"type":"number",
|
||||
"minimum" : 0,
|
||||
@ -57,7 +47,7 @@
|
||||
"required":true,
|
||||
"default" : 0
|
||||
},
|
||||
"maximum":
|
||||
"max":
|
||||
{
|
||||
"type":"number",
|
||||
"minimum" : 0,
|
||||
|
Loading…
Reference in New Issue
Block a user