Hyperion Switcher + cleanup (#423)

* upd

* update

* update

* update schemachecker

* ...

* fix lowest priority

* zeroconf updates (#421) (#3)

* zeroconf:
add ip
make names more uniq

* tune dns name for webconfig

* update

* update

* update

* update ui

* ...

* min val for gamma

* lost somewhere this

* add status to hyperion object

* update ui
This commit is contained in:
brindosch
2017-03-24 10:17:36 +01:00
committed by GitHub
parent c6fa40fa87
commit 8e12d189b0
25 changed files with 253 additions and 109 deletions

View File

@@ -15,7 +15,7 @@ BlackBorderProcessor::BlackBorderProcessor(const QJsonObject &blackborderConfig)
, _maxInconsistentCnt(blackborderConfig["maxInconsistentCnt"].toInt(10))
, _blurRemoveCnt(blackborderConfig["blurRemoveCnt"].toInt(1))
, _detectionMode(blackborderConfig["mode"].toString("default"))
, _detector(blackborderConfig["threshold"].toDouble(0.01))
, _detector(blackborderConfig["threshold"].toDouble(5.0)/100)
, _currentBorder({true, -1, -1})
, _previousDetectedBorder({true, -1, -1})
, _consistentCnt(0)

View File

@@ -401,7 +401,6 @@ Hyperion::Hyperion(const QJsonObject &qjsonConfig, const QString configFile)
, _bonjourBrowser(this)
, _bonjourResolver(this)
{
registerPriority("Off", PriorityMuxer::LOWEST_PRIORITY);
if (!_raw2ledAdjustment->verifyAdjustments())
{
@@ -779,16 +778,13 @@ void Hyperion::update()
_ledBuffer.reserve(_hwLedCount);
_ledBuffer = priorityInfo.ledColors;
if ( priority < PriorityMuxer::LOWEST_PRIORITY)
if (priorityInfo.componentId != _prevCompId)
{
if (priorityInfo.componentId != _prevCompId)
{
bool backlightEnabled = (priorityInfo.componentId != hyperion::COMP_COLOR && priorityInfo.componentId != hyperion::COMP_EFFECT);
_raw2ledAdjustment->setBacklightEnabled(backlightEnabled);
_prevCompId = priorityInfo.componentId;
}
_raw2ledAdjustment->applyAdjustment(_ledBuffer);
bool backlightEnabled = (priorityInfo.componentId != hyperion::COMP_COLOR && priorityInfo.componentId != hyperion::COMP_EFFECT);
_raw2ledAdjustment->setBacklightEnabled(backlightEnabled);
_prevCompId = priorityInfo.componentId;
}
_raw2ledAdjustment->applyAdjustment(_ledBuffer);
// init colororder vector, if empty
if (_ledStringColorOrder.empty())

View File

@@ -78,7 +78,7 @@ void PriorityMuxer::clearAll()
{
for(auto key : _activeInputs.keys())
{
if (key < LOWEST_PRIORITY-1)
if (key < LOWEST_PRIORITY)
{
_activeInputs.remove(key);
}

View File

@@ -14,7 +14,9 @@
{
"type" : "string",
"title" : "edt_conf_gen_name_title",
"default" : "MyHyperionConfig",
"default" : "My Hyperion Config",
"minLength" : 4,
"maxLength" : 20,
"required" : true,
"propertyOrder" : 1
},
@@ -685,7 +687,7 @@
"type" : "integer",
"title" : "edt_conf_general_priority_title",
"minimum" : 100,
"maximum" : 253,
"maximum" : 254,
"default" : 250,
"propertyOrder" : 5
},
@@ -780,12 +782,11 @@
},
"threshold" :
{
"type" : "number",
"type" : "integer",
"title" : "edt_conf_bb_threshold_title",
"minimum" : 0.0,
"maximum" : 1.0,
"default" : 0.05,
"step" : 0.01,
"minimum" : 0,
"maximum" : 100,
"default" : 5,
"append" : "edt_append_percent",
"propertyOrder" : 2
},
@@ -1128,8 +1129,8 @@
"type" : "integer",
"title" : "edt_conf_general_priority_title",
"minimum" : 100,
"maximum" : 253,
"default" : 200,
"maximum" : 254,
"default" : 201,
"propertyOrder" : 3
}
},
@@ -1169,8 +1170,8 @@
"type" : "integer",
"title" : "edt_conf_general_priority_title",
"minimum" : 100,
"maximum" : 253,
"default" : 190,
"maximum" : 254,
"default" : 200,
"propertyOrder" : 4
},
"timeout" :

View File

@@ -617,17 +617,16 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
const Hyperion::InputInfo & priorityInfo = _hyperion->getPriorityInfo(priority);
QJsonObject item;
item["priority"] = priority;
if (priorityInfo.timeoutTime_ms != -1)
if (priorityInfo.timeoutTime_ms != -1 && (priorityInfo.componentId == hyperion::COMP_COLOR || priorityInfo.componentId == hyperion::COMP_EFFECT))
{
item["duration_ms"] = int(priorityInfo.timeoutTime_ms - now);
}
item["owner"] = QString(hyperion::componentToIdString(priorityInfo.componentId));
item["componentId"] = QString(hyperion::componentToIdString(priorityInfo.componentId));
item["origin"] = priorityInfo.origin;
item["component"] = QString(hyperion::componentToString(priorityInfo.componentId));
item["active"] = true;
item["visible"] = (priority == currentPriority);
item["origin"] = priorityInfo.origin;
item["active"] = true;
item["visible"] = (priority == currentPriority);
// remove item from prio register, because we have more valuable information via active priority
QList<QString> prios = priorityRegister.keys(priority);
@@ -816,9 +815,7 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
for(auto comp : components)
{
QJsonObject item;
item["id"] = comp.first;
item["name"] = QString::fromStdString(hyperion::componentToIdString(comp.first));
item["title"] = QString::fromStdString(hyperion::componentToString(comp.first));
item["enabled"] = comp.second;
component.append(item);
@@ -831,6 +828,7 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
QJsonObject hyperion;
hyperion["config_modified" ] = _hyperion->configModified();
hyperion["config_writeable"] = _hyperion->configWriteable();
hyperion["off"] = hyperionIsActive()? false : true;
// sessions
QJsonArray sessions;
@@ -1523,4 +1521,3 @@ void JsonClientConnection::setImage(int priority, const Image<ColorRgb> & image,
}

View File

@@ -109,19 +109,19 @@
"gammaRed": {
"type" : "number",
"required" : false,
"minimum" : 0.0,
"minimum" : 0.1,
"maximum" : 100.0
},
"gammaGreen": {
"type" : "number",
"required" : false,
"minimum" : 0.0,
"minimum" : 0.1,
"maximum" : 100.0
},
"gammaBlue": {
"type" : "number",
"required" : false,
"minimum" : 0.0,
"minimum" : 0.1,
"maximum" : 100.0
},
"backlightThreshold" : {

View File

@@ -13,7 +13,7 @@
"priority": {
"type": "integer",
"minimum" : 1,
"maximum" : 253,
"maximum" : 254,
"required": true
},
"duration": {
@@ -22,6 +22,8 @@
},
"origin": {
"type": "string",
"minLength" : 4,
"maxLength" : 20,
"required": true
},
"color": {

View File

@@ -13,7 +13,7 @@
"priority": {
"type": "integer",
"minimum" : 1,
"maximum" : 253,
"maximum" : 254,
"required": true
},
"duration": {
@@ -22,6 +22,8 @@
},
"origin": {
"type": "string",
"minLength" : 4,
"maxLength" : 20,
"required": true
},
"effect": {

View File

@@ -85,6 +85,10 @@ void QJsonSchemaChecker::validate(const QJsonValue & value, const QJsonObject &s
checkMinimum(value, attributeValue);
else if (attribute == "maximum")
checkMaximum(value, attributeValue);
else if (attribute == "minLength")
checkMinLength(value, attributeValue);
else if (attribute == "maxLength")
checkMaxLength(value, attributeValue);
else if (attribute == "items")
{
if (value.isArray())
@@ -250,6 +254,40 @@ void QJsonSchemaChecker::checkMaximum(const QJsonValue & value, const QJsonValue
}
}
void QJsonSchemaChecker::checkMinLength(const QJsonValue & value, const QJsonValue & schema)
{
if (!value.isString())
{
// only for Strings
_error = true;
setMessage("minLength check only for string fields");
return;
}
if (value.toString().size() < schema.toInt())
{
_error = true;
setMessage("value is too short (minLength=" + schema.toString() + ")");
}
}
void QJsonSchemaChecker::checkMaxLength(const QJsonValue & value, const QJsonValue & schema)
{
if (!value.isString())
{
// only for Strings
_error = true;
setMessage("maxLength check only for string fields");
return;
}
if (value.toString().size() > schema.toInt())
{
_error = true;
setMessage("value is too long (maxLength=" + schema.toString() + ")");
}
}
void QJsonSchemaChecker::checkItems(const QJsonValue & value, const QJsonObject & schema)
{
if (!value.isArray())