mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Merge pull request #475 from redPanther/bootsequence
make priority of boot effect adjustable. Former-commit-id: a722d2aaaa9248d85002137fc91016c8cc0a29bf
This commit is contained in:
commit
870b74b011
@ -364,6 +364,10 @@
|
|||||||
/// The configuration of the effect engine, contains the following items:
|
/// The configuration of the effect engine, contains the following items:
|
||||||
/// * paths : An array with absolute location(s) of directories with effects
|
/// * paths : An array with absolute location(s) of directories with effects
|
||||||
/// * bootsequence : The effect selected as 'boot sequence'
|
/// * bootsequence : The effect selected as 'boot sequence'
|
||||||
|
/// * effect : name of the effect you want to start. Set to empty if no effect wanted
|
||||||
|
/// * color : switch to static color after effect is done
|
||||||
|
/// * duration_ms : duration of boot effect in ms. 0 means effect stays forever
|
||||||
|
/// * priority : priority of boot effect and static color
|
||||||
"effects" :
|
"effects" :
|
||||||
{
|
{
|
||||||
"paths" :
|
"paths" :
|
||||||
@ -374,8 +378,10 @@
|
|||||||
|
|
||||||
"bootsequence" :
|
"bootsequence" :
|
||||||
{
|
{
|
||||||
"effect" : "Rainbow swirl fast",
|
"color" : [0,0,0],
|
||||||
"duration_ms" : 3000
|
"effect" : "Rainbow swirl fast",
|
||||||
|
"duration_ms" : 3000,
|
||||||
|
"priority" : 0
|
||||||
},
|
},
|
||||||
|
|
||||||
/// The configuration for the frame-grabber, contains the following items:
|
/// The configuration for the frame-grabber, contains the following items:
|
||||||
|
@ -359,6 +359,10 @@
|
|||||||
/// The configuration of the effect engine, contains the following items:
|
/// The configuration of the effect engine, contains the following items:
|
||||||
/// * paths : An array with absolute location(s) of directories with effects
|
/// * paths : An array with absolute location(s) of directories with effects
|
||||||
/// * bootsequence : The effect selected as 'boot sequence'
|
/// * bootsequence : The effect selected as 'boot sequence'
|
||||||
|
/// * effect : name of the effect you want to start. Set to empty if no effect wanted
|
||||||
|
/// * color : switch to static color after effect is done
|
||||||
|
/// * duration_ms : duration of boot effect in ms. 0 means effect stays forever
|
||||||
|
/// * priority : priority of boot effect and static color
|
||||||
"effects" :
|
"effects" :
|
||||||
{
|
{
|
||||||
"paths" :
|
"paths" :
|
||||||
@ -369,8 +373,10 @@
|
|||||||
|
|
||||||
"bootsequence" :
|
"bootsequence" :
|
||||||
{
|
{
|
||||||
"effect" : "Rainbow swirl fast",
|
"color" : [0,0,0],
|
||||||
"duration_ms" : 3000
|
"effect" : "Rainbow swirl fast",
|
||||||
|
"duration_ms" : 3000,
|
||||||
|
"priority" : 900
|
||||||
},
|
},
|
||||||
|
|
||||||
/// The configuration for the frame-grabber, contains the following items:
|
/// The configuration for the frame-grabber, contains the following items:
|
||||||
|
@ -126,20 +126,34 @@ int main(int argc, char** argv)
|
|||||||
// Get the parameters for the bootsequence
|
// Get the parameters for the bootsequence
|
||||||
const std::string effectName = effectConfig["effect"].asString();
|
const std::string effectName = effectConfig["effect"].asString();
|
||||||
const unsigned duration_ms = effectConfig["duration_ms"].asUInt();
|
const unsigned duration_ms = effectConfig["duration_ms"].asUInt();
|
||||||
const int priority = 0;
|
const int priority = effectConfig["priority"].asUInt();
|
||||||
|
const int bootcolor_priority = (priority > 990) ? priority+1 : 990;
|
||||||
|
|
||||||
hyperion.setColor(priority+1, ColorRgb::BLACK, duration_ms, false);
|
if ( ! effectConfig["color"].isNull() && effectConfig["color"].isArray() && effectConfig["color"].size() == 3 )
|
||||||
|
{
|
||||||
|
ColorRgb 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"))
|
if (effectConfig.isMember("args"))
|
||||||
{
|
{
|
||||||
const Json::Value effectConfigArgs = effectConfig["args"];
|
const Json::Value effectConfigArgs = effectConfig["args"];
|
||||||
if (hyperion.setEffect(effectName, effectConfigArgs, priority, duration_ms) == 0)
|
if (hyperion.setEffect(effectName, effectConfigArgs, priority, duration_ms) == 0)
|
||||||
{
|
{
|
||||||
std::cout << "Boot sequence(" << effectName << ") with user-defined arguments created and started" << std::endl;
|
std::cout << "Boot sequence(" << effectName << ") with user-defined arguments created and started" << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Failed to start boot sequence: " << effectName << " with user-defined arguments" << std::endl;
|
std::cout << "Failed to start boot sequence: " << effectName << " with user-defined arguments" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user