mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Merge pull request #542 from redPanther/bootsequence
fix bootsequence Former-commit-id: a02ab756a8da1de8f863d5b723eed96e46d7777b
This commit is contained in:
commit
66cb9c3714
@ -127,48 +127,43 @@ int main(int argc, char** argv)
|
||||
// Get the parameters for the bootsequence
|
||||
const std::string effectName = effectConfig["effect"].asString();
|
||||
const unsigned duration_ms = effectConfig["duration_ms"].asUInt();
|
||||
const int priority = effectConfig.get("priority",990).asInt();
|
||||
const int priority = (duration_ms != 0) ? 0 : effectConfig.get("priority",990).asInt();
|
||||
const int bootcolor_priority = (priority > 990) ? priority+1 : 990;
|
||||
|
||||
// clear the leds
|
||||
ColorRgb boot_color = ColorRgb::BLACK;
|
||||
hyperion.setColor(bootcolor_priority, boot_color, 0, false);
|
||||
|
||||
// start boot effect
|
||||
if ( ! effectName.empty() )
|
||||
{
|
||||
int result;
|
||||
std::cout << "Boot sequence '" << effectName << "' ";
|
||||
if (effectConfig.isMember("args"))
|
||||
{
|
||||
std::cout << " (with user defined arguments) ";
|
||||
const Json::Value effectConfigArgs = effectConfig["args"];
|
||||
result = hyperion.setEffect(effectName, effectConfigArgs, priority, duration_ms);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = hyperion.setEffect(effectName, priority, duration_ms);
|
||||
}
|
||||
std::cout << ((result == 0) ? "started" : "failed") << std::endl;
|
||||
}
|
||||
|
||||
// static color
|
||||
if ( ! effectConfig["color"].isNull() && effectConfig["color"].isArray() && effectConfig["color"].size() == 3 )
|
||||
{
|
||||
ColorRgb boot_color = {
|
||||
boot_color = {
|
||||
(uint8_t)effectConfig["color"][0].asUInt(),
|
||||
(uint8_t)effectConfig["color"][1].asUInt(),
|
||||
(uint8_t)effectConfig["color"][2].asUInt()
|
||||
};
|
||||
}
|
||||
|
||||
hyperion.setColor(bootcolor_priority, boot_color, 0, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
hyperion.setColor(bootcolor_priority, ColorRgb::BLACK, duration_ms, false);
|
||||
}
|
||||
|
||||
if (effectConfig.isMember("args"))
|
||||
{
|
||||
const Json::Value effectConfigArgs = effectConfig["args"];
|
||||
if (hyperion.setEffect(effectName, effectConfigArgs, priority, duration_ms) == 0)
|
||||
{
|
||||
std::cout << "Boot sequence(" << effectName << ") with user-defined arguments created and started" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Failed to start boot sequence: " << effectName << " with user-defined arguments" << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hyperion.setEffect(effectName, priority, duration_ms) == 0)
|
||||
{
|
||||
std::cout << "Boot sequence(" << effectName << ") created and started" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Failed to start boot sequence: " << effectName << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create XBMC video checker if the configuration is present
|
||||
XBMCVideoChecker * xbmcVideoChecker = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user