mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
fix: small collection of bugfixed debugger hints and warnings (#801)
* small collection of bugfixed debugger hints / warnings * 'toStdVector' has been explicitly marked deprecated * fixed double zip naming in artifacts * V4L2 WebUI Fix * Some code fixes based on alerts from lgtm.com * only execute dynamic v4l2 enum code, if V4L2_AVAIL * very high critical bugfix ;) * merge fix * some lgtm.com fixes * lgtm fixes * undo localtime_r fix Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
This commit is contained in:
parent
e1288a2649
commit
3ff7fe483f
7
.github/workflows/pull-request.yml
vendored
7
.github/workflows/pull-request.yml
vendored
@ -64,7 +64,7 @@ jobs:
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: ${{ matrix.dockerTag }}.zip
|
||||
name: ${{ matrix.dockerTag }}
|
||||
path: ${{ matrix.dockerTag }}
|
||||
if: matrix.dockerTag != 'aarch64'
|
||||
|
||||
@ -111,7 +111,7 @@ jobs:
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: macOS.zip
|
||||
name: macOS
|
||||
path: macOS
|
||||
|
||||
######################
|
||||
@ -169,11 +169,12 @@ jobs:
|
||||
run: |
|
||||
mkdir -p windows
|
||||
mv build/*.zip windows
|
||||
|
||||
# Upload artifacts
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: windows.zip
|
||||
name: windows
|
||||
path: windows
|
||||
|
||||
######################
|
||||
|
@ -41,7 +41,7 @@ We provide a macOS Build but we can not support this.
|
||||
|
||||
## Documentation
|
||||
Covers these topics (WorkInProgress)
|
||||
- Installtion
|
||||
- Installation
|
||||
- Configuration
|
||||
- Effect development
|
||||
- JSON API
|
||||
|
@ -118,6 +118,7 @@ $(document).ready( function() {
|
||||
buildSchemaPart(item, v4l2_dynamic_enum_schema, val);
|
||||
grabberV4L2.original_schema.properties[item] = window.schema.grabberV4L2.properties[item];
|
||||
grabberV4L2.schema.properties[item] = window.schema.grabberV4L2.properties[item];
|
||||
conf_editor_v4l2.validator.schema.properties.grabberV4L2.properties[item] = window.schema.grabberV4L2.properties[item];
|
||||
|
||||
grabberV4L2.removeObjectProperty(item);
|
||||
delete grabberV4L2.cached_editors[item];
|
||||
|
@ -86,16 +86,9 @@ function createClassicLeds(){
|
||||
var pttlv = parseInt($("#ip_cl_ptlv").val())/100;
|
||||
var pttrh = parseInt($("#ip_cl_ptrh").val())/100;
|
||||
var pttrv = parseInt($("#ip_cl_ptrv").val())/100;
|
||||
|
||||
|
||||
//helper
|
||||
var edgeHGap = edgeVGap/(16/9);
|
||||
//var cornerHGap = cornerVGap/(16/9);
|
||||
var Vmin = 0.0 + edgeVGap;
|
||||
var Vmax = 1.0 - edgeVGap;
|
||||
var Hmin = 0.0 + edgeHGap;
|
||||
var Hmax = 1.0 - edgeHGap;
|
||||
var Hdiff = Hmax-Hmin;
|
||||
var Vdiff = Vmax-Vmin;
|
||||
var ledArray = [];
|
||||
|
||||
function createFinalArray(array){
|
||||
@ -154,7 +147,7 @@ function createClassicLeds(){
|
||||
function createTopLeds(){
|
||||
var steph = (pttrh - pttlh - (2*edgeHGap))/ledstop;
|
||||
var stepv = (pttrv - pttlv)/ledstop;
|
||||
|
||||
|
||||
for (var i = 0; i<ledstop; i++){
|
||||
var hmin = ovl("-",pttlh+(steph*Number([i]))+edgeHGap);
|
||||
var hmax = ovl("+",pttlh+(steph*Number([i+1]))+edgeHGap);
|
||||
@ -167,7 +160,7 @@ function createClassicLeds(){
|
||||
function createRightLeds(){
|
||||
var steph = (ptbrh - pttrh)/ledsright;
|
||||
var stepv = (ptbrv - pttrv - (2*edgeVGap))/ledsright;
|
||||
|
||||
|
||||
for (var i = 0; i<ledsright; i++){
|
||||
var hmax = pttrh+(steph*Number([i+1]));
|
||||
var hmin = hmax-ledsVDepth;
|
||||
@ -180,7 +173,7 @@ function createClassicLeds(){
|
||||
function createBottomLeds(){
|
||||
var steph = (ptbrh - ptblh - (2*edgeHGap))/ledsbottom;
|
||||
var stepv = (ptbrv - ptblv)/ledsbottom;
|
||||
|
||||
|
||||
for (var i = ledsbottom-1; i>-1; i--){
|
||||
var hmin = ovl("-",ptblh+(steph*Number([i]))+edgeHGap);
|
||||
var hmax = ovl("+",ptblh+(steph*Number([i+1]))+edgeHGap);
|
||||
@ -193,7 +186,7 @@ function createClassicLeds(){
|
||||
function createLeftLeds(){
|
||||
var steph = (ptblh - pttlh)/ledsleft;
|
||||
var stepv = (ptblv - pttlv - (2*edgeVGap))/ledsleft;
|
||||
|
||||
|
||||
for (var i = ledsleft-1; i>-1; i--){
|
||||
var hmin = pttlh+(steph*Number([i]));
|
||||
var hmax = hmin+ledsVDepth;
|
||||
@ -378,7 +371,7 @@ $(document).ready(function() {
|
||||
var slConfig = window.serverConfig.ledConfig;
|
||||
|
||||
//Check, if structure is not aligned to expected -> migrate structure
|
||||
var newConfig = {};
|
||||
|
||||
if ( isEmpty(slConfig.classic) )
|
||||
{
|
||||
slConfig = migrateLedConfig( slConfig );
|
||||
@ -530,7 +523,7 @@ $(document).ready(function() {
|
||||
conf_editor.validate().length ? $('#btn_submit_controller').attr('disabled', true) : $('#btn_submit_controller').attr('disabled', false);
|
||||
|
||||
// led controller sepecific wizards
|
||||
$('#btn_wiz_holder').html("")
|
||||
$('#btn_wiz_holder').html("");
|
||||
$('#btn_led_device_wiz').off();
|
||||
|
||||
if(ledType == "philipshue") {
|
||||
|
@ -1,427 +1,426 @@
|
||||
$(document).ready(function() {
|
||||
performTranslation();
|
||||
|
||||
var oldEffects = [];
|
||||
var cpcolor = '#B500FF';
|
||||
var mappingList = window.serverSchema.properties.color.properties.imageToLedMappingType.enum;
|
||||
var duration = 0;
|
||||
var rgb = {r:255,g:0,b:0};
|
||||
var lastImgData = "";
|
||||
var lastFileName= "";
|
||||
var oldEffects = [];
|
||||
var cpcolor = '#B500FF';
|
||||
var mappingList = window.serverSchema.properties.color.properties.imageToLedMappingType.enum;
|
||||
var duration = 0;
|
||||
var rgb = {r:255,g:0,b:0};
|
||||
var lastImgData = "";
|
||||
var lastFileName= "";
|
||||
|
||||
//create html
|
||||
createTable('ssthead', 'sstbody', 'sstcont');
|
||||
$('.ssthead').html(createTableRow([$.i18n('remote_input_origin'), $.i18n('remote_input_owner'), $.i18n('remote_input_priority'), $.i18n('remote_input_status')], true, true));
|
||||
createTable('crthead', 'crtbody', 'adjust_content', true);
|
||||
//create html
|
||||
createTable('ssthead', 'sstbody', 'sstcont');
|
||||
$('.ssthead').html(createTableRow([$.i18n('remote_input_origin'), $.i18n('remote_input_owner'), $.i18n('remote_input_priority'), $.i18n('remote_input_status')], true, true));
|
||||
createTable('crthead', 'crtbody', 'adjust_content', true);
|
||||
|
||||
|
||||
//create introduction
|
||||
if(window.showOptHelp)
|
||||
{
|
||||
createHint("intro", $.i18n('remote_color_intro', $.i18n('remote_losthint')), "color_intro");
|
||||
createHint("intro", $.i18n('remote_input_intro', $.i18n('remote_losthint')), "sstcont");
|
||||
createHint("intro", $.i18n('remote_adjustment_intro', $.i18n('remote_losthint')), "adjust_content");
|
||||
createHint("intro", $.i18n('remote_components_intro', $.i18n('remote_losthint')), "comp_intro");
|
||||
createHint("intro", $.i18n('remote_maptype_intro', $.i18n('remote_losthint')), "maptype_intro");
|
||||
createHint("intro", $.i18n('remote_videoMode_intro', $.i18n('remote_losthint')), "videomode_intro");
|
||||
}
|
||||
//create introduction
|
||||
if(window.showOptHelp)
|
||||
{
|
||||
createHint("intro", $.i18n('remote_color_intro', $.i18n('remote_losthint')), "color_intro");
|
||||
createHint("intro", $.i18n('remote_input_intro', $.i18n('remote_losthint')), "sstcont");
|
||||
createHint("intro", $.i18n('remote_adjustment_intro', $.i18n('remote_losthint')), "adjust_content");
|
||||
createHint("intro", $.i18n('remote_components_intro', $.i18n('remote_losthint')), "comp_intro");
|
||||
createHint("intro", $.i18n('remote_maptype_intro', $.i18n('remote_losthint')), "maptype_intro");
|
||||
createHint("intro", $.i18n('remote_videoMode_intro', $.i18n('remote_losthint')), "videomode_intro");
|
||||
}
|
||||
|
||||
//color adjustment
|
||||
var sColor = sortProperties(window.serverSchema.properties.color.properties.channelAdjustment.items.properties);
|
||||
var values = window.serverInfo.adjustment[0];
|
||||
//color adjustment
|
||||
var sColor = sortProperties(window.serverSchema.properties.color.properties.channelAdjustment.items.properties);
|
||||
var values = window.serverInfo.adjustment[0];
|
||||
|
||||
for(var key in sColor)
|
||||
{
|
||||
if(sColor[key].key != "id" && sColor[key].key != "leds")
|
||||
{
|
||||
var title = '<label for="cr_'+sColor[key].key+'">'+$.i18n(sColor[key].title)+'</label>';
|
||||
var property;
|
||||
var value = values[sColor[key].key];
|
||||
for(var key in sColor)
|
||||
{
|
||||
if(sColor[key].key != "id" && sColor[key].key != "leds")
|
||||
{
|
||||
var title = '<label for="cr_'+sColor[key].key+'">'+$.i18n(sColor[key].title)+'</label>';
|
||||
var property;
|
||||
var value = values[sColor[key].key];
|
||||
|
||||
if(sColor[key].type == "array")
|
||||
{
|
||||
property = '<div id="cr_'+sColor[key].key+'" class="input-group colorpicker-component" ><input type="text" class="form-control" /><span class="input-group-addon"><i></i></span></div>';
|
||||
$('.crtbody').append(createTableRow([title, property], false, true));
|
||||
createCP('cr_'+sColor[key].key, value, function(rgb,hex,e){
|
||||
requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), '['+rgb.r+','+rgb.g+','+rgb.b+']');
|
||||
});
|
||||
}
|
||||
else if(sColor[key].type == "boolean")
|
||||
{
|
||||
property = '<div class="checkbox"><input id="cr_'+sColor[key].key+'" type="checkbox" value="'+value+'"/><label></label></div>';
|
||||
$('.crtbody').append(createTableRow([title, property], false, true));
|
||||
if(sColor[key].type == "array")
|
||||
{
|
||||
property = '<div id="cr_'+sColor[key].key+'" class="input-group colorpicker-component" ><input type="text" class="form-control" /><span class="input-group-addon"><i></i></span></div>';
|
||||
$('.crtbody').append(createTableRow([title, property], false, true));
|
||||
createCP('cr_'+sColor[key].key, value, function(rgb,hex,e){
|
||||
requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), '['+rgb.r+','+rgb.g+','+rgb.b+']');
|
||||
});
|
||||
}
|
||||
else if(sColor[key].type == "boolean")
|
||||
{
|
||||
property = '<div class="checkbox"><input id="cr_'+sColor[key].key+'" type="checkbox" value="'+value+'"/><label></label></div>';
|
||||
$('.crtbody').append(createTableRow([title, property], false, true));
|
||||
|
||||
$('#cr_'+sColor[key].key).off().on('change', function(e){
|
||||
requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), e.currentTarget.checked);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sColor[key].key == "brightness" || sColor[key].key == "brightnessCompensation" || sColor[key].key == "backlightThreshold")
|
||||
property = '<div class="input-group"><input id="cr_'+sColor[key].key+'" type="number" class="form-control" min="0" max="100" step="10" value="'+value+'"/><span class="input-group-addon">'+$.i18n("edt_append_percent")+'</span></div>';
|
||||
else
|
||||
property = '<input id="cr_'+sColor[key].key+'" type="number" class="form-control" min="0.1" max="4.0" step="0.1" value="'+value+'"/>';
|
||||
$('#cr_'+sColor[key].key).off().on('change', function(e){
|
||||
requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), e.currentTarget.checked);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sColor[key].key == "brightness" || sColor[key].key == "brightnessCompensation" || sColor[key].key == "backlightThreshold")
|
||||
property = '<div class="input-group"><input id="cr_'+sColor[key].key+'" type="number" class="form-control" min="0" max="100" step="10" value="'+value+'"/><span class="input-group-addon">'+$.i18n("edt_append_percent")+'</span></div>';
|
||||
else
|
||||
property = '<input id="cr_'+sColor[key].key+'" type="number" class="form-control" min="0.1" max="4.0" step="0.1" value="'+value+'"/>';
|
||||
|
||||
$('.crtbody').append(createTableRow([title, property], false, true));
|
||||
$('#cr_'+sColor[key].key).off().on('change', function(e){
|
||||
valValue(this.id,this.value,this.min,this.max);
|
||||
requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), e.currentTarget.value);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
$('.crtbody').append(createTableRow([title, property], false, true));
|
||||
$('#cr_'+sColor[key].key).off().on('change', function(e){
|
||||
valValue(this.id,this.value,this.min,this.max);
|
||||
requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), e.currentTarget.value);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function sendEffect()
|
||||
{
|
||||
var efx = $("#effect_select").val();
|
||||
if(efx != "__none__")
|
||||
{
|
||||
requestPriorityClear();
|
||||
$(window.hyperion).one("cmd-clear", function(event) {
|
||||
setTimeout(function() {requestPlayEffect(efx,duration)}, 100);
|
||||
});
|
||||
}
|
||||
}
|
||||
function sendEffect()
|
||||
{
|
||||
var efx = $("#effect_select").val();
|
||||
if(efx != "__none__")
|
||||
{
|
||||
requestPriorityClear();
|
||||
$(window.hyperion).one("cmd-clear", function(event) {
|
||||
setTimeout(function() {requestPlayEffect(efx,duration)}, 100);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function sendColor()
|
||||
{
|
||||
requestSetColor(rgb.r, rgb.g, rgb.b,duration);
|
||||
}
|
||||
function sendColor()
|
||||
{
|
||||
requestSetColor(rgb.r, rgb.g, rgb.b,duration);
|
||||
}
|
||||
|
||||
function updateInputSelect()
|
||||
{
|
||||
$('.sstbody').html("");
|
||||
var prios = window.serverInfo.priorities;
|
||||
var clearAll = false;
|
||||
function updateInputSelect()
|
||||
{
|
||||
$('.sstbody').html("");
|
||||
var prios = window.serverInfo.priorities;
|
||||
var clearAll = false;
|
||||
|
||||
for(var i = 0; i < prios.length; i++)
|
||||
{
|
||||
var origin = prios[i].origin ? prios[i].origin : "System";
|
||||
origin = origin.split("@");
|
||||
var ip = origin[1];
|
||||
origin = origin[0];
|
||||
for(var i = 0; i < prios.length; i++)
|
||||
{
|
||||
var origin = prios[i].origin ? prios[i].origin : "System";
|
||||
origin = origin.split("@");
|
||||
var ip = origin[1];
|
||||
origin = origin[0];
|
||||
|
||||
var owner = prios[i].owner;
|
||||
var active = prios[i].active;
|
||||
var visible = prios[i].visible;
|
||||
var priority = prios[i].priority;
|
||||
var compId = prios[i].componentId;
|
||||
var duration = prios[i].duration_ms/1000;
|
||||
var value = "0,0,0";
|
||||
var btn_type = "default";
|
||||
var btn_text = $.i18n('remote_input_setsource_btn');
|
||||
var btn_state = "enabled";
|
||||
var owner = prios[i].owner;
|
||||
var active = prios[i].active;
|
||||
var visible = prios[i].visible;
|
||||
var priority = prios[i].priority;
|
||||
var compId = prios[i].componentId;
|
||||
var duration = prios[i].duration_ms/1000;
|
||||
var value = "0,0,0";
|
||||
var btn_type = "default";
|
||||
var btn_text = $.i18n('remote_input_setsource_btn');
|
||||
var btn_state = "enabled";
|
||||
|
||||
if (active)
|
||||
btn_type = "primary";
|
||||
if (active)
|
||||
btn_type = "primary";
|
||||
|
||||
if(priority > 254)
|
||||
continue;
|
||||
if(priority < 254 && (compId == "EFFECT" || compId == "COLOR" || compId == "IMAGE") )
|
||||
clearAll = true;
|
||||
if(priority > 254)
|
||||
continue;
|
||||
if(priority < 254 && (compId == "EFFECT" || compId == "COLOR" || compId == "IMAGE") )
|
||||
clearAll = true;
|
||||
|
||||
if (visible)
|
||||
{
|
||||
btn_state = "disabled";
|
||||
btn_type = "success";
|
||||
btn_text = $.i18n('remote_input_sourceactiv_btn');
|
||||
}
|
||||
if (visible)
|
||||
{
|
||||
btn_state = "disabled";
|
||||
btn_type = "success";
|
||||
btn_text = $.i18n('remote_input_sourceactiv_btn');
|
||||
}
|
||||
|
||||
if(ip)
|
||||
origin += '<br/><span style="font-size:80%; color:grey;">'+$.i18n('remote_input_ip')+' '+ip+'</span>';
|
||||
if(ip)
|
||||
origin += '<br/><span style="font-size:80%; color:grey;">'+$.i18n('remote_input_ip')+' '+ip+'</span>';
|
||||
|
||||
if("value" in prios[i])
|
||||
value = prios[i].value.RGB;
|
||||
if("value" in prios[i])
|
||||
value = prios[i].value.RGB;
|
||||
|
||||
switch (compId)
|
||||
{
|
||||
case "EFFECT":
|
||||
owner = $.i18n('remote_effects_label_effects')+' '+owner;
|
||||
break;
|
||||
case "COLOR":
|
||||
owner = $.i18n('remote_color_label_color')+' '+'<div style="width:18px; height:18px; border-radius:20px; margin-bottom:-4px; border:1px grey solid; background-color: rgb('+value+'); display:inline-block" title="RGB: ('+value+')"></div>';
|
||||
break;
|
||||
case "IMAGE":
|
||||
owner = $.i18n('remote_effects_label_picture')+' '+owner;
|
||||
break;
|
||||
case "GRABBER":
|
||||
owner = $.i18n('general_comp_GRABBER')+': ('+owner+')';
|
||||
break;
|
||||
case "V4L":
|
||||
owner = $.i18n('general_comp_V4L')+': ('+owner+')';
|
||||
break;
|
||||
case "BOBLIGHTSERVER":
|
||||
owner = $.i18n('general_comp_BOBLIGHTSERVER');
|
||||
break;
|
||||
case "FLATBUFSERVER":
|
||||
owner = $.i18n('general_comp_FLATBUFSERVER');
|
||||
break;
|
||||
case "PROTOSERVER":
|
||||
owner = $.i18n('general_comp_PROTOSERVER');
|
||||
break;
|
||||
}
|
||||
switch (compId)
|
||||
{
|
||||
case "EFFECT":
|
||||
owner = $.i18n('remote_effects_label_effects')+' '+owner;
|
||||
break;
|
||||
case "COLOR":
|
||||
owner = $.i18n('remote_color_label_color')+' '+'<div style="width:18px; height:18px; border-radius:20px; margin-bottom:-4px; border:1px grey solid; background-color: rgb('+value+'); display:inline-block" title="RGB: ('+value+')"></div>';
|
||||
break;
|
||||
case "IMAGE":
|
||||
owner = $.i18n('remote_effects_label_picture')+' '+owner;
|
||||
break;
|
||||
case "GRABBER":
|
||||
owner = $.i18n('general_comp_GRABBER')+': ('+owner+')';
|
||||
break;
|
||||
case "V4L":
|
||||
owner = $.i18n('general_comp_V4L')+': ('+owner+')';
|
||||
break;
|
||||
case "BOBLIGHTSERVER":
|
||||
owner = $.i18n('general_comp_BOBLIGHTSERVER');
|
||||
break;
|
||||
case "FLATBUFSERVER":
|
||||
owner = $.i18n('general_comp_FLATBUFSERVER');
|
||||
break;
|
||||
case "PROTOSERVER":
|
||||
owner = $.i18n('general_comp_PROTOSERVER');
|
||||
break;
|
||||
}
|
||||
|
||||
if(duration && compId != "GRABBER" && compId != "FLATBUFSERVER" && compId != "PROTOSERVER")
|
||||
owner += '<br/><span style="font-size:80%; color:grey;">'+$.i18n('remote_input_duration')+' '+duration.toFixed(0)+$.i18n('edt_append_s')+'</span>';
|
||||
if(duration && compId != "GRABBER" && compId != "FLATBUFSERVER" && compId != "PROTOSERVER")
|
||||
owner += '<br/><span style="font-size:80%; color:grey;">'+$.i18n('remote_input_duration')+' '+duration.toFixed(0)+$.i18n('edt_append_s')+'</span>';
|
||||
|
||||
var btn = '<button id="srcBtn'+i+'" type="button" '+btn_state+' class="btn btn-'+btn_type+' btn_input_selection" onclick="requestSetSource('+priority+');">'+btn_text+'</button>';
|
||||
var btn = '<button id="srcBtn'+i+'" type="button" '+btn_state+' class="btn btn-'+btn_type+' btn_input_selection" onclick="requestSetSource('+priority+');">'+btn_text+'</button>';
|
||||
|
||||
if((compId == "EFFECT" || compId == "COLOR" || compId == "IMAGE") && priority < 254)
|
||||
btn += '<button type="button" class="btn btn-sm btn-danger" style="margin-left:10px;" onclick="requestPriorityClear('+priority+');"><i class="fa fa-close"></button>';
|
||||
if((compId == "EFFECT" || compId == "COLOR" || compId == "IMAGE") && priority < 254)
|
||||
btn += '<button type="button" class="btn btn-sm btn-danger" style="margin-left:10px;" onclick="requestPriorityClear('+priority+');"><i class="fa fa-close"></button>';
|
||||
|
||||
if(btn_type != 'default')
|
||||
$('.sstbody').append(createTableRow([origin, owner, priority, btn], false, true));
|
||||
}
|
||||
var btn_auto_color = (window.serverInfo.priorities_autoselect? "btn-success" : "btn-danger");
|
||||
var btn_auto_state = (window.serverInfo.priorities_autoselect? "disabled" : "enabled");
|
||||
var btn_auto_text = (window.serverInfo.priorities_autoselect? $.i18n('general_btn_on') : $.i18n('general_btn_off'));
|
||||
var btn_call_state = (clearAll? "enabled" : "disabled");
|
||||
$('#auto_btn').html('<button id="srcBtn'+i+'" type="button" '+btn_auto_state+' class="btn '+btn_auto_color+'" style="margin-right:5px;display:inline-block;" onclick="requestSetSource(\'auto\');">'+$.i18n('remote_input_label_autoselect')+' ('+btn_auto_text+')</button>');
|
||||
$('#auto_btn').append('<button type="button" '+btn_call_state+' class="btn btn-danger" style="display:inline-block;" onclick="requestClearAll();">'+$.i18n('remote_input_clearall')+'</button>');
|
||||
if(btn_type != 'default')
|
||||
$('.sstbody').append(createTableRow([origin, owner, priority, btn], false, true));
|
||||
}
|
||||
var btn_auto_color = (window.serverInfo.priorities_autoselect? "btn-success" : "btn-danger");
|
||||
var btn_auto_state = (window.serverInfo.priorities_autoselect? "disabled" : "enabled");
|
||||
var btn_auto_text = (window.serverInfo.priorities_autoselect? $.i18n('general_btn_on') : $.i18n('general_btn_off'));
|
||||
var btn_call_state = (clearAll? "enabled" : "disabled");
|
||||
$('#auto_btn').html('<button id="srcBtn'+i+'" type="button" '+btn_auto_state+' class="btn '+btn_auto_color+'" style="margin-right:5px;display:inline-block;" onclick="requestSetSource(\'auto\');">'+$.i18n('remote_input_label_autoselect')+' ('+btn_auto_text+')</button>');
|
||||
$('#auto_btn').append('<button type="button" '+btn_call_state+' class="btn btn-danger" style="display:inline-block;" onclick="requestClearAll();">'+$.i18n('remote_input_clearall')+'</button>');
|
||||
|
||||
var max_width=100;
|
||||
$('.btn_input_selection').each(function() {
|
||||
if ($(this).innerWidth() > max_width)
|
||||
max_width = $(this).innerWidth();
|
||||
});
|
||||
$('.btn_input_selection').css("min-width",max_width+"px");
|
||||
}
|
||||
var max_width=100;
|
||||
$('.btn_input_selection').each(function() {
|
||||
if ($(this).innerWidth() > max_width)
|
||||
max_width = $(this).innerWidth();
|
||||
});
|
||||
$('.btn_input_selection').css("min-width",max_width+"px");
|
||||
}
|
||||
|
||||
function updateLedMapping()
|
||||
{
|
||||
var mapping = window.serverInfo.imageToLedMappingType;
|
||||
function updateLedMapping()
|
||||
{
|
||||
var mapping = window.serverInfo.imageToLedMappingType;
|
||||
|
||||
$('#mappingsbutton').html("");
|
||||
for(var ix = 0; ix < mappingList.length; ix++)
|
||||
{
|
||||
if(mapping == mappingList[ix])
|
||||
var btn_style = 'btn-success';
|
||||
else
|
||||
var btn_style = 'btn-primary';
|
||||
$('#mappingsbutton').html("");
|
||||
for(var ix = 0; ix < mappingList.length; ix++)
|
||||
{
|
||||
if(mapping == mappingList[ix])
|
||||
var btn_style = 'btn-success';
|
||||
else
|
||||
var btn_style = 'btn-primary';
|
||||
|
||||
$('#mappingsbutton').append('<button type="button" id="lmBtn_'+mappingList[ix]+'" class="btn '+btn_style+'" style="margin:3px;min-width:200px" onclick="requestMappingType(\''+mappingList[ix]+'\');">'+$.i18n('remote_maptype_label_'+mappingList[ix])+'</button><br/>');
|
||||
}
|
||||
}
|
||||
$('#mappingsbutton').append('<button type="button" id="lmBtn_'+mappingList[ix]+'" class="btn '+btn_style+'" style="margin:3px;min-width:200px" onclick="requestMappingType(\''+mappingList[ix]+'\');">'+$.i18n('remote_maptype_label_'+mappingList[ix])+'</button><br/>');
|
||||
}
|
||||
}
|
||||
|
||||
function initComponents()
|
||||
{
|
||||
var components = window.comps;
|
||||
var hyperionEnabled = true;
|
||||
components.forEach( function(obj) {
|
||||
if (obj.name == "ALL")
|
||||
{
|
||||
hyperionEnabled = obj.enabled
|
||||
}
|
||||
});
|
||||
function initComponents()
|
||||
{
|
||||
var components = window.comps;
|
||||
var hyperionEnabled = true;
|
||||
components.forEach( function(obj) {
|
||||
if (obj.name == "ALL")
|
||||
{
|
||||
hyperionEnabled = obj.enabled;
|
||||
}
|
||||
});
|
||||
|
||||
for (const comp of components)
|
||||
{
|
||||
if(comp.name === "ALL")
|
||||
continue;
|
||||
for (const comp of components)
|
||||
{
|
||||
if(comp.name === "ALL")
|
||||
continue;
|
||||
|
||||
const enable_style = (comp.enabled? "checked" : "");
|
||||
const comp_btn_id = "comp_btn_"+comp.name;
|
||||
const enable_style = (comp.enabled? "checked" : "");
|
||||
const comp_btn_id = "comp_btn_"+comp.name;
|
||||
|
||||
if ($("#"+comp_btn_id).length === 0)
|
||||
{
|
||||
var d='<span style="display:block;margin:3px">'
|
||||
+'<input id="'+comp_btn_id+'"'+enable_style+' type="checkbox"'
|
||||
+'data-toggle="toggle" data-onstyle="success" data-on="'+$.i18n('general_btn_on')+'" data-off="'+$.i18n('general_btn_off')+'">'
|
||||
+' <label>'+$.i18n('general_comp_'+comp.name)+'</label>'
|
||||
+'</span>';
|
||||
if ($("#"+comp_btn_id).length === 0)
|
||||
{
|
||||
var d='<span style="display:block;margin:3px">'
|
||||
+'<input id="'+comp_btn_id+'"'+enable_style+' type="checkbox"'
|
||||
+'data-toggle="toggle" data-onstyle="success" data-on="'+$.i18n('general_btn_on')+'" data-off="'+$.i18n('general_btn_off')+'">'
|
||||
+' <label>'+$.i18n('general_comp_'+comp.name)+'</label>'
|
||||
+'</span>';
|
||||
|
||||
$('#componentsbutton').append(d);
|
||||
$(`#${comp_btn_id}`).bootstrapToggle();
|
||||
$(`#${comp_btn_id}`).bootstrapToggle(hyperionEnabled ? "enable" : "disable")
|
||||
$(`#${comp_btn_id}`).change(e => {
|
||||
requestSetComponentState(e.currentTarget.id.split('_').pop(), e.currentTarget.checked)
|
||||
//console.log(e.currentTarget.checked)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
$('#componentsbutton').append(d);
|
||||
$(`#${comp_btn_id}`).bootstrapToggle();
|
||||
$(`#${comp_btn_id}`).bootstrapToggle((hyperionEnabled ? "enable" : "disable"));
|
||||
$(`#${comp_btn_id}`).change(e => {
|
||||
requestSetComponentState(e.currentTarget.id.split('_').pop(), e.currentTarget.checked);
|
||||
//console.log(e.currentTarget.checked)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateComponent( component )
|
||||
{
|
||||
if (component.name == "ALL")
|
||||
{
|
||||
var components = window.comps;
|
||||
function updateComponent( component )
|
||||
{
|
||||
if (component.name == "ALL")
|
||||
{
|
||||
var components = window.comps;
|
||||
var hyperionEnabled = component.enabled;
|
||||
for (const comp of components)
|
||||
{
|
||||
|
||||
hyperionEnabled = component.enabled
|
||||
for (const comp of components)
|
||||
{
|
||||
if(comp.name === "ALL")
|
||||
continue;
|
||||
|
||||
if(comp.name === "ALL")
|
||||
continue;
|
||||
const comp_btn_id = "comp_btn_"+comp.name;
|
||||
|
||||
const comp_btn_id = "comp_btn_"+comp.name;
|
||||
if ( !hyperionEnabled )
|
||||
{
|
||||
$(`#${comp_btn_id}`).bootstrapToggle('off');
|
||||
$(`#${comp_btn_id}`).bootstrapToggle("disable");
|
||||
}
|
||||
else
|
||||
{
|
||||
$(`#${comp_btn_id}`).bootstrapToggle("enable");
|
||||
if ( comp.enabled !== $(`#${comp_btn_id}`).prop("checked") )
|
||||
{
|
||||
$(`#${comp_btn_id}`).bootstrapToggle().prop('checked', comp.enabled).change();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const comp_btn_id = "comp_btn_"+component.name;
|
||||
|
||||
if ( !hyperionEnabled )
|
||||
{
|
||||
$(`#${comp_btn_id}`).bootstrapToggle('off');
|
||||
$(`#${comp_btn_id}`).bootstrapToggle("disable");
|
||||
}
|
||||
else
|
||||
{
|
||||
$(`#${comp_btn_id}`).bootstrapToggle("enable");
|
||||
if ( comp.enabled !== $(`#${comp_btn_id}`).prop("checked") )
|
||||
{
|
||||
$(`#${comp_btn_id}`).bootstrapToggle().prop('checked', comp.enabled).change();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const comp_btn_id = "comp_btn_"+component.name;
|
||||
//console.log ("updateComponent: ", component.name, "Current Checked: ", $(`#${comp_btn_id}`).prop("checked"), "New Checked: ", component.enabled, );
|
||||
|
||||
//console.log ("updateComponent: ", component.name, "Current Checked: ", $(`#${comp_btn_id}`).prop("checked"), "New Checked: ", component.enabled, );
|
||||
|
||||
// In case Buttons were disabled before, status may be different to component status
|
||||
if ( component.enabled != $(`#${comp_btn_id}`).prop("checked") )
|
||||
{
|
||||
// console.log ("Update status to Checked = ", component.enabled);
|
||||
if ( component.enabled )
|
||||
$(`#${comp_btn_id}`).bootstrapToggle("on");
|
||||
else
|
||||
$(`#${comp_btn_id}`).bootstrapToggle("off");
|
||||
}
|
||||
}
|
||||
}
|
||||
// In case Buttons were disabled before, status may be different to component status
|
||||
if ( component.enabled != $(`#${comp_btn_id}`).prop("checked") )
|
||||
{
|
||||
// console.log ("Update status to Checked = ", component.enabled);
|
||||
if ( component.enabled )
|
||||
$(`#${comp_btn_id}`).bootstrapToggle("on");
|
||||
else
|
||||
$(`#${comp_btn_id}`).bootstrapToggle("off");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateEffectlist()
|
||||
{
|
||||
var newEffects = window.serverInfo.effects;
|
||||
if (newEffects.length != oldEffects.length)
|
||||
{
|
||||
$('#effect_select').html('<option value="__none__"></option>');
|
||||
var usrEffArr = [];
|
||||
var sysEffArr = [];
|
||||
function updateEffectlist()
|
||||
{
|
||||
var newEffects = window.serverInfo.effects;
|
||||
if (newEffects.length != oldEffects.length)
|
||||
{
|
||||
$('#effect_select').html('<option value="__none__"></option>');
|
||||
var usrEffArr = [];
|
||||
var sysEffArr = [];
|
||||
|
||||
for(var i = 0; i < newEffects.length; i++) {
|
||||
var effectName = newEffects[i].name;
|
||||
if(!/^\:/.test(newEffects[i].file)){
|
||||
usrEffArr.push(effectName);
|
||||
}
|
||||
else{
|
||||
sysEffArr.push(effectName);
|
||||
}
|
||||
}
|
||||
$('#effect_select').append(createSel(usrEffArr, $.i18n('remote_optgroup_usreffets')));
|
||||
$('#effect_select').append(createSel(sysEffArr, $.i18n('remote_optgroup_syseffets')));
|
||||
oldEffects = newEffects;
|
||||
}
|
||||
}
|
||||
for(var i = 0; i < newEffects.length; i++) {
|
||||
var effectName = newEffects[i].name;
|
||||
if(!/^\:/.test(newEffects[i].file)){
|
||||
usrEffArr.push(effectName);
|
||||
}
|
||||
else{
|
||||
sysEffArr.push(effectName);
|
||||
}
|
||||
}
|
||||
$('#effect_select').append(createSel(usrEffArr, $.i18n('remote_optgroup_usreffets')));
|
||||
$('#effect_select').append(createSel(sysEffArr, $.i18n('remote_optgroup_syseffets')));
|
||||
oldEffects = newEffects;
|
||||
}
|
||||
}
|
||||
|
||||
function updateVideoMode()
|
||||
{
|
||||
var videoModes = ["2D","3DSBS","3DTAB"];
|
||||
var currVideoMode = window.serverInfo.videomode;
|
||||
function updateVideoMode()
|
||||
{
|
||||
var videoModes = ["2D","3DSBS","3DTAB"];
|
||||
var currVideoMode = window.serverInfo.videomode;
|
||||
|
||||
$('#videomodebtns').html("");
|
||||
for(var ix = 0; ix < videoModes.length; ix++)
|
||||
{
|
||||
if(currVideoMode == videoModes[ix])
|
||||
var btn_style = 'btn-success';
|
||||
else
|
||||
var btn_style = 'btn-primary';
|
||||
$('#videomodebtns').append('<button type="button" id="vModeBtn_'+videoModes[ix]+'" class="btn '+btn_style+'" style="margin:3px;min-width:200px" onclick="requestVideoMode(\''+videoModes[ix]+'\');">'+$.i18n('remote_videoMode_'+videoModes[ix])+'</button><br/>');
|
||||
}
|
||||
}
|
||||
$('#videomodebtns').html("");
|
||||
for(var ix = 0; ix < videoModes.length; ix++)
|
||||
{
|
||||
if(currVideoMode == videoModes[ix])
|
||||
var btn_style = 'btn-success';
|
||||
else
|
||||
var btn_style = 'btn-primary';
|
||||
$('#videomodebtns').append('<button type="button" id="vModeBtn_'+videoModes[ix]+'" class="btn '+btn_style+'" style="margin:3px;min-width:200px" onclick="requestVideoMode(\''+videoModes[ix]+'\');">'+$.i18n('remote_videoMode_'+videoModes[ix])+'</button><br/>');
|
||||
}
|
||||
}
|
||||
|
||||
// colorpicker and effect
|
||||
if (getStorage('rmcpcolor') != null)
|
||||
{
|
||||
cpcolor = getStorage('rmcpcolor');
|
||||
rgb = hexToRgb(cpcolor);
|
||||
}
|
||||
// colorpicker and effect
|
||||
if (getStorage('rmcpcolor') != null)
|
||||
{
|
||||
cpcolor = getStorage('rmcpcolor');
|
||||
rgb = hexToRgb(cpcolor);
|
||||
}
|
||||
|
||||
if (getStorage('rmduration') != null)
|
||||
{
|
||||
$("#remote_duration").val(getStorage('rmduration'));
|
||||
duration = getStorage('rmduration');
|
||||
}
|
||||
if (getStorage('rmduration') != null)
|
||||
{
|
||||
$("#remote_duration").val(getStorage('rmduration'));
|
||||
duration = getStorage('rmduration');
|
||||
}
|
||||
|
||||
createCP('cp2', cpcolor, function(rgbT,hex){
|
||||
rgb = rgbT;
|
||||
sendColor();
|
||||
setStorage('rmcpcolor', hex);
|
||||
updateInputSelect();
|
||||
});
|
||||
createCP('cp2', cpcolor, function(rgbT,hex){
|
||||
rgb = rgbT;
|
||||
sendColor();
|
||||
setStorage('rmcpcolor', hex);
|
||||
updateInputSelect();
|
||||
});
|
||||
|
||||
$("#reset_color").off().on("click", function(){
|
||||
requestPriorityClear();
|
||||
lastImgData = "";
|
||||
$("#effect_select").val("__none__");
|
||||
$("#remote_input_img").val("");
|
||||
});
|
||||
$("#reset_color").off().on("click", function(){
|
||||
requestPriorityClear();
|
||||
lastImgData = "";
|
||||
$("#effect_select").val("__none__");
|
||||
$("#remote_input_img").val("");
|
||||
});
|
||||
|
||||
$("#remote_duration").off().on("change", function(){
|
||||
duration = valValue(this.id,this.value,this.min,this.max);
|
||||
setStorage('rmduration', duration);
|
||||
});
|
||||
$("#remote_duration").off().on("change", function(){
|
||||
duration = valValue(this.id,this.value,this.min,this.max);
|
||||
setStorage('rmduration', duration);
|
||||
});
|
||||
|
||||
$("#effect_select").off().on("change", function(event) {
|
||||
sendEffect();
|
||||
});
|
||||
$("#effect_select").off().on("change", function(event) {
|
||||
sendEffect();
|
||||
});
|
||||
|
||||
$("#remote_input_reseff, #remote_input_rescol").off().on("click", function(){
|
||||
if(this.id == "remote_input_rescol")
|
||||
sendColor();
|
||||
else
|
||||
sendEffect();
|
||||
});
|
||||
$("#remote_input_reseff, #remote_input_rescol").off().on("click", function(){
|
||||
if(this.id == "remote_input_rescol")
|
||||
sendColor();
|
||||
else
|
||||
sendEffect();
|
||||
});
|
||||
|
||||
$("#remote_input_repimg").off().on("click", function(){
|
||||
if(lastImgData != "")
|
||||
requestSetImage(lastImgData, duration, lastFileName);
|
||||
});
|
||||
$("#remote_input_repimg").off().on("click", function(){
|
||||
if(lastImgData != "")
|
||||
requestSetImage(lastImgData, duration, lastFileName);
|
||||
});
|
||||
|
||||
$("#remote_input_img").change(function(){
|
||||
readImg(this, function(src,fileName){
|
||||
lastFileName = fileName;
|
||||
if(src.includes(","))
|
||||
lastImgData = src.split(",")[1];
|
||||
else
|
||||
lastImgData = src;
|
||||
$("#remote_input_img").change(function(){
|
||||
readImg(this, function(src,fileName){
|
||||
lastFileName = fileName;
|
||||
if(src.includes(","))
|
||||
lastImgData = src.split(",")[1];
|
||||
else
|
||||
lastImgData = src;
|
||||
|
||||
requestSetImage(lastImgData, duration, lastFileName);
|
||||
});
|
||||
});
|
||||
requestSetImage(lastImgData, duration, lastFileName);
|
||||
});
|
||||
});
|
||||
|
||||
//force first update
|
||||
initComponents();
|
||||
updateInputSelect();
|
||||
updateLedMapping();
|
||||
updateVideoMode();
|
||||
updateEffectlist();
|
||||
//force first update
|
||||
initComponents();
|
||||
updateInputSelect();
|
||||
updateLedMapping();
|
||||
updateVideoMode();
|
||||
updateEffectlist();
|
||||
|
||||
// interval updates
|
||||
// interval updates
|
||||
|
||||
$(window.hyperion).on('components-updated', function(e, comp){
|
||||
//console.log ("components-updated", e, comp);
|
||||
updateComponent (comp);
|
||||
});
|
||||
$(window.hyperion).on('components-updated', function(e, comp){
|
||||
//console.log ("components-updated", e, comp);
|
||||
updateComponent (comp);
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-priorities-update", function(event){
|
||||
window.serverInfo.priorities = event.response.data.priorities;
|
||||
window.serverInfo.priorities_autoselect = event.response.data.priorities_autoselect;
|
||||
updateInputSelect();
|
||||
});
|
||||
$(window.hyperion).on("cmd-imageToLedMapping-update", function(event){
|
||||
window.serverInfo.imageToLedMappingType = event.response.data.imageToLedMappingType;
|
||||
updateLedMapping();
|
||||
});
|
||||
$(window.hyperion).on("cmd-priorities-update", function(event){
|
||||
window.serverInfo.priorities = event.response.data.priorities;
|
||||
window.serverInfo.priorities_autoselect = event.response.data.priorities_autoselect;
|
||||
updateInputSelect();
|
||||
});
|
||||
$(window.hyperion).on("cmd-imageToLedMapping-update", function(event){
|
||||
window.serverInfo.imageToLedMappingType = event.response.data.imageToLedMappingType;
|
||||
updateLedMapping();
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-videomode-update", function(event){
|
||||
window.serverInfo.videomode = event.response.data.videomode;
|
||||
updateVideoMode();
|
||||
});
|
||||
$(window.hyperion).on("cmd-videomode-update", function(event){
|
||||
window.serverInfo.videomode = event.response.data.videomode;
|
||||
updateVideoMode();
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-effects-update", function(event){
|
||||
window.serverInfo.effects = event.response.data.effects;
|
||||
updateEffectlist();
|
||||
});
|
||||
$(window.hyperion).on("cmd-effects-update", function(event){
|
||||
window.serverInfo.effects = event.response.data.effects;
|
||||
updateEffectlist();
|
||||
});
|
||||
|
||||
removeOverlay();
|
||||
removeOverlay();
|
||||
});
|
||||
|
@ -45,7 +45,7 @@ function connectionLostDetection(type)
|
||||
{
|
||||
if ( window.watchdog > 2 )
|
||||
{
|
||||
var interval_id = window.setInterval("", 9999); // Get a reference to the last
|
||||
var interval_id = window.setInterval(function(){clearInterval(interval_id);}, 9999); // Get a reference to the last
|
||||
for (var i = 1; i < interval_id; i++)
|
||||
window.clearInterval(i);
|
||||
if(type == 'restart')
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Two projectiles are sent from random positions and collide with each other
|
||||
# Template from https://github.com/nickpesce/lit/blob/master/lit/effects/collision.py
|
||||
import hyperion, time, colorsys, random, math
|
||||
import hyperion, time, colorsys, random
|
||||
|
||||
# Get parameters
|
||||
sleepTime = max(0.02, float(hyperion.args.get('speed', 100))/1000.0)
|
||||
|
@ -24,7 +24,7 @@ public slots:
|
||||
void stop();
|
||||
|
||||
void setSignalThreshold(double redSignalThreshold, double greenSignalThreshold, double blueSignalThreshold);
|
||||
void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom);
|
||||
void setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom);
|
||||
void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax);
|
||||
void setSignalDetectionEnable(bool enable);
|
||||
void setDeviceVideoStandard(QString device, VideoStandard videoStandard);
|
||||
|
@ -52,7 +52,7 @@ private slots:
|
||||
///
|
||||
/// @brief Handle COMP_ALL changes from Hyperion->compStateChangeRequest
|
||||
///
|
||||
void handleCompStateChangeRequest(const hyperion::Components comp, const bool activated);
|
||||
void handleCompStateChangeRequest(const hyperion::Components comps, const bool activated);
|
||||
|
||||
private:
|
||||
/// Hyperion instance
|
||||
|
@ -86,4 +86,4 @@ inline Components stringToComponent(QString component)
|
||||
return COMP_INVALID;
|
||||
}
|
||||
|
||||
}; // end of namespace
|
||||
} // end of namespace
|
||||
|
@ -61,4 +61,4 @@ QString getDirName( QString sourceFile);
|
||||
/// @param[in] log The logger of the caller
|
||||
///
|
||||
void resolveFileError(const QFile& file, Logger* log);
|
||||
};
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public:
|
||||
assert(other._width == _width);
|
||||
assert(other._height == _height);
|
||||
|
||||
memcpy(_pixels, other._pixels, _width*_height*sizeof(Pixel_T));
|
||||
memcpy(_pixels, other._pixels, _width * _height * sizeof(Pixel_T));
|
||||
}
|
||||
|
||||
///
|
||||
@ -258,7 +258,7 @@ public:
|
||||
_height = 1;
|
||||
_pixels = new Pixel_T[2];
|
||||
_endOfPixels = _pixels + 1;
|
||||
memset(_pixels, 0, _width * _height * sizeof(Pixel_T));
|
||||
memset(_pixels, 0, (unsigned long) _width * _height * sizeof(Pixel_T));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -92,4 +92,4 @@ namespace JsonUtils{
|
||||
/// @return true on success else false
|
||||
///
|
||||
bool resolveRefs(const QJsonObject& schema, QJsonObject& obj, Logger* log);
|
||||
};
|
||||
}
|
||||
|
@ -103,4 +103,4 @@ protected:
|
||||
const int _loggerMaxMsgBufferSize;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(Logger::T_LOG_MESSAGE);
|
||||
Q_DECLARE_METATYPE(Logger::T_LOG_MESSAGE)
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include <QString>
|
||||
|
||||
namespace Process {
|
||||
|
||||
void restartHyperion(bool asNewProcess=false);
|
||||
|
||||
void restartHyperion(bool asNewProcess=false);
|
||||
QByteArray command_exec(QString cmd, QByteArray data="");
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ namespace RGBW {
|
||||
SUB_MIN_COOL_ADJUST,
|
||||
WHITE_OFF
|
||||
};
|
||||
|
||||
|
||||
WhiteAlgorithm stringToWhiteAlgorithm(QString str);
|
||||
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algorithm);
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -6,94 +6,94 @@
|
||||
/// @brief Provide util methods to work with SettingsManager class
|
||||
///
|
||||
namespace settings {
|
||||
// all available settings sections
|
||||
enum type {
|
||||
BGEFFECT,
|
||||
FGEFFECT,
|
||||
BLACKBORDER,
|
||||
BOBLSERVER,
|
||||
COLOR,
|
||||
DEVICE,
|
||||
EFFECTS,
|
||||
NETFORWARD,
|
||||
SYSTEMCAPTURE,
|
||||
GENERAL,
|
||||
V4L2,
|
||||
JSONSERVER,
|
||||
LEDCONFIG,
|
||||
LEDS,
|
||||
LOGGER,
|
||||
SMOOTHING,
|
||||
WEBSERVER,
|
||||
INSTCAPTURE,
|
||||
NETWORK,
|
||||
FLATBUFSERVER,
|
||||
PROTOSERVER,
|
||||
INVALID
|
||||
};
|
||||
// all available settings sections
|
||||
enum type {
|
||||
BGEFFECT,
|
||||
FGEFFECT,
|
||||
BLACKBORDER,
|
||||
BOBLSERVER,
|
||||
COLOR,
|
||||
DEVICE,
|
||||
EFFECTS,
|
||||
NETFORWARD,
|
||||
SYSTEMCAPTURE,
|
||||
GENERAL,
|
||||
V4L2,
|
||||
JSONSERVER,
|
||||
LEDCONFIG,
|
||||
LEDS,
|
||||
LOGGER,
|
||||
SMOOTHING,
|
||||
WEBSERVER,
|
||||
INSTCAPTURE,
|
||||
NETWORK,
|
||||
FLATBUFSERVER,
|
||||
PROTOSERVER,
|
||||
INVALID
|
||||
};
|
||||
|
||||
///
|
||||
/// @brief Convert settings::type to string representation
|
||||
/// @param type The settings::type from enum
|
||||
/// @return The settings type as string
|
||||
///
|
||||
inline QString typeToString(const type& type)
|
||||
{
|
||||
switch (type)
|
||||
///
|
||||
/// @brief Convert settings::type to string representation
|
||||
/// @param type The settings::type from enum
|
||||
/// @return The settings type as string
|
||||
///
|
||||
inline QString typeToString(const type& type)
|
||||
{
|
||||
case BGEFFECT: return "backgroundEffect";
|
||||
case FGEFFECT: return "foregroundEffect";
|
||||
case BLACKBORDER: return "blackborderdetector";
|
||||
case BOBLSERVER: return "boblightServer";
|
||||
case COLOR: return "color";
|
||||
case DEVICE: return "device";
|
||||
case EFFECTS: return "effects";
|
||||
case NETFORWARD: return "forwarder";
|
||||
case SYSTEMCAPTURE: return "framegrabber";
|
||||
case GENERAL: return "general";
|
||||
case V4L2: return "grabberV4L2";
|
||||
case JSONSERVER: return "jsonServer";
|
||||
case LEDCONFIG: return "ledConfig";
|
||||
case LEDS: return "leds";
|
||||
case LOGGER: return "logger";
|
||||
case SMOOTHING: return "smoothing";
|
||||
case WEBSERVER: return "webConfig";
|
||||
case INSTCAPTURE: return "instCapture";
|
||||
case NETWORK: return "network";
|
||||
case FLATBUFSERVER: return "flatbufServer";
|
||||
case PROTOSERVER: return "protoServer";
|
||||
default: return "invalid";
|
||||
switch (type)
|
||||
{
|
||||
case BGEFFECT: return "backgroundEffect";
|
||||
case FGEFFECT: return "foregroundEffect";
|
||||
case BLACKBORDER: return "blackborderdetector";
|
||||
case BOBLSERVER: return "boblightServer";
|
||||
case COLOR: return "color";
|
||||
case DEVICE: return "device";
|
||||
case EFFECTS: return "effects";
|
||||
case NETFORWARD: return "forwarder";
|
||||
case SYSTEMCAPTURE: return "framegrabber";
|
||||
case GENERAL: return "general";
|
||||
case V4L2: return "grabberV4L2";
|
||||
case JSONSERVER: return "jsonServer";
|
||||
case LEDCONFIG: return "ledConfig";
|
||||
case LEDS: return "leds";
|
||||
case LOGGER: return "logger";
|
||||
case SMOOTHING: return "smoothing";
|
||||
case WEBSERVER: return "webConfig";
|
||||
case INSTCAPTURE: return "instCapture";
|
||||
case NETWORK: return "network";
|
||||
case FLATBUFSERVER: return "flatbufServer";
|
||||
case PROTOSERVER: return "protoServer";
|
||||
default: return "invalid";
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// @brief Convert string to settings::type representation
|
||||
/// @param type The string to convert
|
||||
/// @return The settings type from enum
|
||||
///
|
||||
inline type stringToType(const QString& type)
|
||||
{
|
||||
if (type == "backgroundEffect") return BGEFFECT;
|
||||
else if (type == "foregroundEffect") return FGEFFECT;
|
||||
else if (type == "blackborderdetector") return BLACKBORDER;
|
||||
else if (type == "boblightServer") return BOBLSERVER;
|
||||
else if (type == "color") return COLOR;
|
||||
else if (type == "device") return DEVICE;
|
||||
else if (type == "effects") return EFFECTS;
|
||||
else if (type == "forwarder") return NETFORWARD;
|
||||
else if (type == "framegrabber") return SYSTEMCAPTURE;
|
||||
else if (type == "general") return GENERAL;
|
||||
else if (type == "grabberV4L2") return V4L2;
|
||||
else if (type == "jsonServer") return JSONSERVER;
|
||||
else if (type == "ledConfig") return LEDCONFIG;
|
||||
else if (type == "leds") return LEDS;
|
||||
else if (type == "logger") return LOGGER;
|
||||
else if (type == "smoothing") return SMOOTHING;
|
||||
else if (type == "webConfig") return WEBSERVER;
|
||||
else if (type == "instCapture") return INSTCAPTURE;
|
||||
else if (type == "network") return NETWORK;
|
||||
else if (type == "flatbufServer") return FLATBUFSERVER;
|
||||
else if (type == "protoServer") return PROTOSERVER;
|
||||
else return INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// @brief Convert string to settings::type representation
|
||||
/// @param type The string to convert
|
||||
/// @return The settings type from enum
|
||||
///
|
||||
inline type stringToType(const QString& type)
|
||||
{
|
||||
if (type == "backgroundEffect") return BGEFFECT;
|
||||
else if (type == "foregroundEffect") return FGEFFECT;
|
||||
else if (type == "blackborderdetector") return BLACKBORDER;
|
||||
else if (type == "boblightServer") return BOBLSERVER;
|
||||
else if (type == "color") return COLOR;
|
||||
else if (type == "device") return DEVICE;
|
||||
else if (type == "effects") return EFFECTS;
|
||||
else if (type == "forwarder") return NETFORWARD;
|
||||
else if (type == "framegrabber") return SYSTEMCAPTURE;
|
||||
else if (type == "general") return GENERAL;
|
||||
else if (type == "grabberV4L2") return V4L2;
|
||||
else if (type == "jsonServer") return JSONSERVER;
|
||||
else if (type == "ledConfig") return LEDCONFIG;
|
||||
else if (type == "leds") return LEDS;
|
||||
else if (type == "logger") return LOGGER;
|
||||
else if (type == "smoothing") return SMOOTHING;
|
||||
else if (type == "webConfig") return WEBSERVER;
|
||||
else if (type == "instCapture") return INSTCAPTURE;
|
||||
else if (type == "network") return NETWORK;
|
||||
else if (type == "flatbufServer") return FLATBUFSERVER;
|
||||
else if (type == "protoServer") return PROTOSERVER;
|
||||
else return INVALID;
|
||||
}
|
||||
};
|
||||
|
@ -143,7 +143,8 @@ PyObject* EffectModule::wrapSetColor(PyObject *self, PyObject *args)
|
||||
if (PyArg_ParseTuple(args, "bbb", &color.red, &color.green, &color.blue))
|
||||
{
|
||||
getEffect()->_colors.fill(color);
|
||||
getEffect()->setInput(getEffect()->_priority, getEffect()->_colors.toStdVector(), timeout, false);
|
||||
QVector<ColorRgb> _cQV = getEffect()->_colors;
|
||||
getEffect()->setInput(getEffect()->_priority, std::vector<ColorRgb>( _cQV.begin(), _cQV.end() ), timeout, false);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
return nullptr;
|
||||
@ -161,7 +162,8 @@ PyObject* EffectModule::wrapSetColor(PyObject *self, PyObject *args)
|
||||
{
|
||||
char * data = PyByteArray_AS_STRING(bytearray);
|
||||
memcpy(getEffect()->_colors.data(), data, length);
|
||||
getEffect()->setInput(getEffect()->_priority, getEffect()->_colors.toStdVector(), timeout, false);
|
||||
QVector<ColorRgb> _cQV = getEffect()->_colors;
|
||||
getEffect()->setInput(getEffect()->_priority, std::vector<ColorRgb>( _cQV.begin(), _cQV.end() ), timeout, false);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
else
|
||||
@ -602,7 +604,7 @@ PyObject* EffectModule::wrapImageDrawPolygon(PyObject *self, PyObject *args)
|
||||
{
|
||||
// check if we have aborted already
|
||||
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
|
||||
|
||||
|
||||
PyObject * bytearray = nullptr;
|
||||
|
||||
int argCount = PyTuple_Size(args);
|
||||
@ -663,7 +665,7 @@ PyObject* EffectModule::wrapImageDrawPie(PyObject *self, PyObject *args)
|
||||
{
|
||||
// check if we have aborted already
|
||||
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
|
||||
|
||||
|
||||
PyObject * bytearray = nullptr;
|
||||
|
||||
QString brush;
|
||||
|
@ -47,7 +47,7 @@ void V4L2Wrapper::setSignalThreshold(double redSignalThreshold, double greenSign
|
||||
_grabber.setSignalThreshold( redSignalThreshold, greenSignalThreshold, blueSignalThreshold, 50);
|
||||
}
|
||||
|
||||
void V4L2Wrapper::setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom)
|
||||
void V4L2Wrapper::setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom)
|
||||
{
|
||||
_grabber.setCropping(cropLeft, cropRight, cropTop, cropBottom);
|
||||
}
|
||||
|
@ -40,9 +40,9 @@ void ComponentRegister::setNewComponentState(const hyperion::Components comp, co
|
||||
}
|
||||
}
|
||||
|
||||
void ComponentRegister::handleCompStateChangeRequest(const hyperion::Components comp, const bool activated)
|
||||
void ComponentRegister::handleCompStateChangeRequest(const hyperion::Components comps, const bool activated)
|
||||
{
|
||||
if(comp == COMP_ALL && !_inProgress)
|
||||
if(comps == COMP_ALL && !_inProgress)
|
||||
{
|
||||
_inProgress = true;
|
||||
if(!activated && _prevComponentStates.empty())
|
||||
|
@ -87,7 +87,7 @@ private:
|
||||
///
|
||||
/// @return Zero on success else negative
|
||||
///
|
||||
virtual int write(const std::vector<ColorRgb>& ledValues);
|
||||
virtual int write(const std::vector<ColorRgb>& ledValues) override;
|
||||
|
||||
///
|
||||
/// Test if the device is a (or the) lightpack we are looking for
|
||||
@ -131,7 +131,7 @@ private:
|
||||
|
||||
/// the number of bits per channel
|
||||
int _bitsPerChannel;
|
||||
|
||||
|
||||
/// count of real hardware leds
|
||||
int _hwLedCount;
|
||||
};
|
||||
|
@ -87,8 +87,7 @@ int LedDeviceFile::write(const std::vector<ColorRgb> & ledValues)
|
||||
// get a precise timestamp as a string
|
||||
const auto now = std::chrono::system_clock::now();
|
||||
const auto nowAsTimeT = std::chrono::system_clock::to_time_t(now);
|
||||
const auto nowMs = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
now.time_since_epoch()) % 1000;
|
||||
const auto nowMs = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;
|
||||
|
||||
const auto elapsedTimeMs = std::chrono::duration_cast<std::chrono::milliseconds>(now - lastWriteTime);
|
||||
|
||||
|
@ -32,10 +32,13 @@ LedDevicePiBlaster::LedDevicePiBlaster(const QJsonObject &deviceConfig)
|
||||
|
||||
LedDevicePiBlaster::~LedDevicePiBlaster()
|
||||
{
|
||||
|
||||
if (_fid != nullptr)
|
||||
{
|
||||
fclose(_fid);
|
||||
_fid = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool LedDevicePiBlaster::init(const QJsonObject &deviceConfig)
|
||||
{
|
||||
bool isInitOK = LedDevice::init(deviceConfig);
|
||||
@ -95,7 +98,6 @@ int LedDevicePiBlaster::open()
|
||||
if (!QFile::exists(_deviceName))
|
||||
{
|
||||
errortext = QString ("The device (%1) does not yet exist.").arg(_deviceName);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -116,7 +118,6 @@ int LedDevicePiBlaster::open()
|
||||
if ( retval < 0 )
|
||||
{
|
||||
this->setInError( errortext );
|
||||
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
@ -132,8 +133,8 @@ void LedDevicePiBlaster::close()
|
||||
{
|
||||
fclose(_fid);
|
||||
_fid = nullptr;
|
||||
}}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int LedDevicePiBlaster::write(const std::vector<ColorRgb> & ledValues)
|
||||
{
|
||||
@ -149,31 +150,31 @@ int LedDevicePiBlaster::write(const std::vector<ColorRgb> & ledValues)
|
||||
if ( (valueIdx >= 0) && (valueIdx < static_cast<int>( _ledCount)) )
|
||||
{
|
||||
double pwmDutyCycle = 0.0;
|
||||
switch (_gpio_to_color[ i ])
|
||||
switch (_gpio_to_color[ i ])
|
||||
{
|
||||
case 'r':
|
||||
pwmDutyCycle = ledValues[valueIdx].red / 255.0;
|
||||
break;
|
||||
case 'g':
|
||||
pwmDutyCycle = ledValues[valueIdx].green / 255.0;
|
||||
break;
|
||||
case 'b':
|
||||
pwmDutyCycle = ledValues[valueIdx].blue / 255.0;
|
||||
break;
|
||||
case 'w':
|
||||
pwmDutyCycle = ledValues[valueIdx].red;
|
||||
pwmDutyCycle += ledValues[valueIdx].green;
|
||||
pwmDutyCycle += ledValues[valueIdx].blue;
|
||||
pwmDutyCycle /= (3.0*255.0);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
case 'r':
|
||||
pwmDutyCycle = ledValues[valueIdx].red / 255.0;
|
||||
break;
|
||||
case 'g':
|
||||
pwmDutyCycle = ledValues[valueIdx].green / 255.0;
|
||||
break;
|
||||
case 'b':
|
||||
pwmDutyCycle = ledValues[valueIdx].blue / 255.0;
|
||||
break;
|
||||
case 'w':
|
||||
pwmDutyCycle = ledValues[valueIdx].red;
|
||||
pwmDutyCycle += ledValues[valueIdx].green;
|
||||
pwmDutyCycle += ledValues[valueIdx].blue;
|
||||
pwmDutyCycle /= (3.0*255.0);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
// fprintf(_fid, "%i=%f\n", iPins[iPin], pwmDutyCycle);
|
||||
|
||||
if ( (fprintf(_fid, "%i=%f\n", i, pwmDutyCycle) < 0)
|
||||
|| (fflush(_fid) < 0)) {
|
||||
if ( (fprintf(_fid, "%i=%f\n", i, pwmDutyCycle) < 0) || (fflush(_fid) < 0))
|
||||
{
|
||||
if (_fid != nullptr)
|
||||
{
|
||||
fclose(_fid);
|
||||
|
@ -208,7 +208,8 @@ int main(int argc, char * argv[])
|
||||
if (parser.isSet(argColor))
|
||||
{
|
||||
// TODO: make sure setColor accepts a QList<QColor>
|
||||
connection.setColor(argColor.getColors(parser).toVector().toStdVector(), argPriority.getInt(parser), argDuration.getInt(parser));
|
||||
QVector<QColor> _cQV = argColor.getColors(parser).toVector();
|
||||
connection.setColor(std::vector<QColor>( _cQV.begin(), _cQV.end() ), argPriority.getInt(parser), argDuration.getInt(parser));
|
||||
}
|
||||
else if (parser.isSet(argImage))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user