Refactor LED-Device handling in UI and make element naming consistent

This commit is contained in:
Lord-Grey
2021-05-19 10:51:45 +02:00
parent 80d60c2406
commit 8d8ee8b3cd
10 changed files with 173 additions and 115 deletions

View File

@@ -391,12 +391,30 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
Warning(_log, "Instance [%u]: HwLedCount/Layout mismatch! Setting Hardware LED count to number of LEDs configured via layout", _instance);
hwLedcount = layoutLedCount;
newDeviceConfig["hardwareLedCount"] = hwLedcount;
config["device"] = newDeviceConfig;
migrated = true;
}
}
}
if (newDeviceConfig.contains("type"))
{
QString type = newDeviceConfig["type"].toString();
if (type == "atmoorb" || type == "fadecandy" || type == "philipshue" )
{
if (newDeviceConfig.contains("output"))
{
newDeviceConfig["host"] = newDeviceConfig["output"].toString();
newDeviceConfig.remove("output");
migrated = true;
}
}
}
if (migrated)
{
config["device"] = newDeviceConfig;
Debug(_log, "LED-Device records migrated");
}
}
if (config.contains("grabberV4L2"))

View File

@@ -147,7 +147,6 @@
"ledBlacklist": {
"type": "array",
"title": "conf_leds_layout_blacklist_rules_title",
"minimum": 1,
"uniqueItems": true,
"items": {
"type": "object",

View File

@@ -50,7 +50,7 @@ bool LedDeviceAtmoOrb::init(const QJsonObject &deviceConfig)
if ( LedDevice::init(deviceConfig) )
{
_multicastGroup = deviceConfig["output"].toString(MULTICAST_GROUP_DEFAULT_ADDRESS);
_multicastGroup = deviceConfig["host"].toString(MULTICAST_GROUP_DEFAULT_ADDRESS);
_multiCastGroupPort = static_cast<quint16>(deviceConfig["port"].toInt(MULTICAST_GROUP_DEFAULT_PORT));
_useOrbSmoothing = deviceConfig["useOrbSmoothing"].toBool(false);
_skipSmoothingDiff = deviceConfig["skipSmoothingDiff"].toInt(0);

View File

@@ -55,7 +55,7 @@ bool LedDeviceFadeCandy::init(const QJsonObject& deviceConfig)
}
else
{
_host = deviceConfig["output"].toString("127.0.0.1");
_host = deviceConfig["host"].toString("127.0.0.1");
_port = deviceConfig["port"].toInt(STREAM_DEFAULT_PORT);
//If host not configured the init fails

View File

@@ -12,7 +12,7 @@ namespace {
bool verbose = false;
// Configuration settings
const char CONFIG_ADDRESS[] = "output";
const char CONFIG_ADDRESS[] = "host";
//const char CONFIG_PORT[] = "port";
const char CONFIG_USERNAME[] = "username";
const char CONFIG_CLIENTKEY[] = "clientkey";

View File

@@ -16,11 +16,10 @@
"access": "advanced",
"propertyOrder": 2
},
"output": {
"host": {
"type": "string",
"title": "edt_dev_spec_multicastGroup_title",
"default": "239.255.255.250",
"access": "expert",
"propertyOrder": 3
},
"port": {

View File

@@ -1,110 +1,110 @@
{
"type":"object",
"required":true,
"properties":{
"output" : {
"properties": {
"host": {
"type": "string",
"title":"edt_dev_spec_targetIp_title",
"default" : "127.0.0.1",
"propertyOrder" : 1
"title": "edt_dev_spec_targetIp_title",
"default": "127.0.0.1",
"propertyOrder": 1
},
"port" : {
"port": {
"type": "number",
"title":"edt_dev_spec_port_title",
"title": "edt_dev_spec_port_title",
"default": 7890,
"propertyOrder" : 2
"propertyOrder": 2
},
"latchTime": {
"type": "integer",
"title":"edt_dev_spec_latchtime_title",
"title": "edt_dev_spec_latchtime_title",
"default": 0,
"append" : "edt_append_ms",
"append": "edt_append_ms",
"minimum": 0,
"maximum": 1000,
"access" : "expert",
"propertyOrder" : 3
"access": "expert",
"propertyOrder": 3
},
"setFcConfig": {
"type": "boolean",
"title":"edt_dev_spec_FCsetConfig_title",
"title": "edt_dev_spec_FCsetConfig_title",
"default": false,
"propertyOrder" : 4
"propertyOrder": 4
},
"manualLed": {
"type": "boolean",
"title":"edt_dev_spec_FCmanualControl_title",
"title": "edt_dev_spec_FCmanualControl_title",
"default": false,
"options": {
"dependencies": {
"setFcConfig": true
}
},
"propertyOrder" : 5
"propertyOrder": 5
},
"ledOn": {
"type": "boolean",
"title":"edt_dev_spec_FCledToOn_title",
"title": "edt_dev_spec_FCledToOn_title",
"default": false,
"options": {
"dependencies": {
"setFcConfig": true
}
},
"propertyOrder" : 6
"propertyOrder": 6
},
"interpolation": {
"type": "boolean",
"title":"edt_dev_spec_interpolation_title",
"title": "edt_dev_spec_interpolation_title",
"default": false,
"options": {
"dependencies": {
"setFcConfig": true
}
},
"propertyOrder" : 7
"propertyOrder": 7
},
"dither": {
"type": "boolean",
"title":"edt_dev_spec_dithering_title",
"title": "edt_dev_spec_dithering_title",
"default": false,
"options": {
"dependencies": {
"setFcConfig": true
}
},
"propertyOrder" : 8
"propertyOrder": 8
},
"gamma" : {
"type" : "number",
"title" : "edt_dev_spec_gamma_title",
"gamma": {
"type": "number",
"title": "edt_dev_spec_gamma_title",
"default": 1.0,
"minimum" : 0.1,
"minimum": 0.1,
"maximum": 5.0,
"options": {
"dependencies": {
"setFcConfig": true
}
},
"propertyOrder" : 9
"propertyOrder": 9
},
"whitepoint" : {
"type" : "array",
"title" : "edt_dev_spec_whitepoint_title",
"whitepoint": {
"type": "array",
"title": "edt_dev_spec_whitepoint_title",
"options": {
"dependencies": {
"setFcConfig": true
}
},
"propertyOrder" : 10,
"default" : [255,255,255],
"maxItems" : 3,
"minItems" : 3,
"format" : "colorpicker",
"items" : {
"type" : "integer",
"minimum" : 0,
"propertyOrder": 10,
"default": [ 255, 255, 255 ],
"maxItems": 3,
"minItems": 3,
"format": "colorpicker",
"items": {
"type": "integer",
"minimum": 0,
"maximum": 255,
"default" : 255
"default": 255
}
}
},

View File

@@ -2,7 +2,7 @@
"type": "object",
"required": true,
"properties": {
"output": {
"host": {
"type": "string",
"title": "edt_dev_spec_targetIp_title",
"default": "",