adjustable image2led mode for grabbers (#341)

* implement most points for a adjustable image2leds mapping

* implement new adjustable led mapping type
This commit is contained in:
redPanther
2016-12-19 23:59:50 +01:00
committed by GitHub
parent 53924c4fca
commit c5e0299c55
21 changed files with 258 additions and 47 deletions

View File

@@ -545,6 +545,17 @@ void JsonConnection::setAdjustment(const QString &adjustmentId,
parseReply(reply);
}
void JsonConnection::setLedMapping(QString mappingType)
{
QJsonObject command;
command["command"] = QString("processing");
command["mappingType"] = mappingType;
QJsonObject reply = sendMessage(command);
parseReply(reply);
}
QJsonObject JsonConnection::sendMessage(const QJsonObject & message)
{
// serialize message

View File

@@ -90,7 +90,7 @@ public:
/// Clear all priority channels
///
void clearAll();
///
/// Enable/Disable components during runtime
///
@@ -105,12 +105,12 @@ public:
/// @param priority The priority
///
void setSource(int priority);
///
/// Enables auto source, if disabled prio by manual selecting input source
///
void setSourceAutoSelect();
///
/// Print the current loaded Hyperion configuration file
///
@@ -167,6 +167,12 @@ public:
const QColor & greenAdjustment,
const QColor & blueAdjustment);
///
/// sets the image to leds mapping type
///
/// @param mappingType led mapping type
void setLedMapping(QString mappingType);
private:
///
/// Send a json command message and receive its reply

View File

@@ -87,6 +87,7 @@ int main(int argc, char * argv[])
ColorOption & argRAdjust = parser.add<ColorOption> ('R', "redAdjustment" , "Set the adjustment of the red color (requires colors in hex format as RRGGBB)");
ColorOption & argGAdjust = parser.add<ColorOption> ('G', "greenAdjustment", "Set the adjustment of the green color (requires colors in hex format as RRGGBB)");
ColorOption & argBAdjust = parser.add<ColorOption> ('B', "blueAdjustment", "Set the adjustment of the blue color (requires colors in hex format as RRGGBB)");
Option & argMapping = parser.add<Option> ('M', "ledMapping" , "Set the methode for image to led mapping valif values: multicolor:mean, unicolor_mean");
IntOption & argSource = parser.add<IntOption> (0x0, "sourceSelect" , "Set current active priority channel and deactivate auto source switching");
BooleanOption & argSourceAuto = parser.add<BooleanOption>(0x0, "sourceAutoSelect", "Enables auto source, if disabled prio by manual selecting input source");
BooleanOption & argSourceOff = parser.add<BooleanOption>(0x0, "sourceOff", "select no source, this results in leds activly set to black (=off)");
@@ -104,12 +105,16 @@ int main(int argc, char * argv[])
}
// check if at least one of the available color transforms is set
bool colorTransform = parser.isSet(argSaturation) || parser.isSet(argValue) || parser.isSet(argSaturationL) || parser.isSet(argLuminance) || parser.isSet(argLuminanceMin) || parser.isSet(argThreshold) || parser.isSet(argGamma) || parser.isSet(argBlacklevel) || parser.isSet(argWhitelevel);
bool colorTransform = parser.isSet(argSaturation) || parser.isSet(argValue) || parser.isSet(argSaturationL) || parser.isSet(argLuminance)
|| parser.isSet(argLuminanceMin) || parser.isSet(argThreshold) || parser.isSet(argGamma) || parser.isSet(argBlacklevel) || parser.isSet(argWhitelevel);
bool colorAdjust = parser.isSet(argRAdjust) || parser.isSet(argGAdjust) || parser.isSet(argBAdjust);
bool colorModding = colorTransform || colorAdjust;
// check that exactly one command was given
int commandCount = count({parser.isSet(argColor), parser.isSet(argImage), parser.isSet(argEffect), parser.isSet(argCreateEffect), parser.isSet(argDeleteEffect), parser.isSet(argServerInfo), parser.isSet(argClear), parser.isSet(argClearAll), parser.isSet(argEnableComponent), parser.isSet(argDisableComponent), colorModding, parser.isSet(argSource), parser.isSet(argSourceAuto), parser.isSet(argSourceOff), parser.isSet(argConfigGet), parser.isSet(argSchemaGet), parser.isSet(argConfigSet)});
int commandCount = count({ parser.isSet(argColor), parser.isSet(argImage), parser.isSet(argEffect), parser.isSet(argCreateEffect), parser.isSet(argDeleteEffect),
parser.isSet(argServerInfo), parser.isSet(argClear), parser.isSet(argClearAll), parser.isSet(argEnableComponent), parser.isSet(argDisableComponent), colorModding,
parser.isSet(argSource), parser.isSet(argSourceAuto), parser.isSet(argSourceOff), parser.isSet(argConfigGet), parser.isSet(argSchemaGet), parser.isSet(argConfigSet),
parser.isSet(argMapping) });
if (commandCount != 1)
{
qWarning() << (commandCount == 0 ? "No command found." : "Multiple commands found.") << " Provide exactly one of the following options:";
@@ -216,6 +221,10 @@ int main(int argc, char * argv[])
{
connection.setConfig(argConfigSet.value(parser));
}
else if (parser.isSet(argMapping))
{
connection.setLedMapping(argMapping.value(parser));
}
else if (colorModding)
{
if (colorAdjust)