From 8a906b9d01c247895ceb60f2206b8136b7efa5b5 Mon Sep 17 00:00:00 2001 From: redpanther Date: Sun, 31 Jan 2016 04:34:13 +0100 Subject: [PATCH 1/2] make priority of boot effect adjustable. It is set to 0 to not alter to current behaciour. A value of 900 could be more feasable, because boot effect with prio 0 isn't overwritable by other effects Former-commit-id: 1852339e6ade62c86719cfbb47faa46eb8f8d4ed --- config/hyperion.config.json | 6 ++++-- config/hyperion_x86.config.json | 6 ++++-- src/hyperiond/hyperiond.cpp | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/config/hyperion.config.json b/config/hyperion.config.json index 44931ac4..b16b845e 100644 --- a/config/hyperion.config.json +++ b/config/hyperion.config.json @@ -364,6 +364,7 @@ /// The configuration of the effect engine, contains the following items: /// * paths : An array with absolute location(s) of directories with effects /// * bootsequence : The effect selected as 'boot sequence' + /// * duration_ms : duration of boot effect in ms. 0 means effect stays forever "effects" : { "paths" : @@ -374,8 +375,9 @@ "bootsequence" : { - "effect" : "Rainbow swirl fast", - "duration_ms" : 3000 + "effect" : "Rainbow swirl fast", + "duration_ms" : 3000, + "priority" : 0 }, /// The configuration for the frame-grabber, contains the following items: diff --git a/config/hyperion_x86.config.json b/config/hyperion_x86.config.json index 4abd64db..06e35136 100644 --- a/config/hyperion_x86.config.json +++ b/config/hyperion_x86.config.json @@ -359,6 +359,7 @@ /// The configuration of the effect engine, contains the following items: /// * paths : An array with absolute location(s) of directories with effects /// * bootsequence : The effect selected as 'boot sequence' + /// * duration_ms : duration of boot effect in ms. 0 means effect stays forever "effects" : { "paths" : @@ -369,8 +370,9 @@ "bootsequence" : { - "effect" : "Rainbow swirl fast", - "duration_ms" : 3000 + "effect" : "Rainbow swirl fast", + "duration_ms" : 3000, + "priority" : 0 }, /// The configuration for the frame-grabber, contains the following items: diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index 7357d55f..b6289fe2 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -126,7 +126,7 @@ 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 = 0; + const int priority = effectConfig["priority"].asUInt(); hyperion.setColor(priority+1, ColorRgb::BLACK, duration_ms, false); From 4decb05348fa80c65c26f8f857f57f860d2964ac Mon Sep 17 00:00:00 2001 From: redpanther Date: Sun, 31 Jan 2016 22:38:30 +0100 Subject: [PATCH 2/2] adds ability to set static color on boot. Former-commit-id: 41ca5ba73fde698d73380fac3dcee5e33b310d76 --- config/hyperion.config.json | 4 ++++ config/hyperion_x86.config.json | 6 +++++- src/hyperiond/hyperiond.cpp | 20 +++++++++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/config/hyperion.config.json b/config/hyperion.config.json index b16b845e..34f485cf 100644 --- a/config/hyperion.config.json +++ b/config/hyperion.config.json @@ -364,7 +364,10 @@ /// The configuration of the effect engine, contains the following items: /// * paths : An array with absolute location(s) of directories with effects /// * 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" : { "paths" : @@ -375,6 +378,7 @@ "bootsequence" : { + "color" : [0,0,0], "effect" : "Rainbow swirl fast", "duration_ms" : 3000, "priority" : 0 diff --git a/config/hyperion_x86.config.json b/config/hyperion_x86.config.json index 06e35136..4121c499 100644 --- a/config/hyperion_x86.config.json +++ b/config/hyperion_x86.config.json @@ -359,7 +359,10 @@ /// The configuration of the effect engine, contains the following items: /// * paths : An array with absolute location(s) of directories with effects /// * 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" : { "paths" : @@ -370,9 +373,10 @@ "bootsequence" : { + "color" : [0,0,0], "effect" : "Rainbow swirl fast", "duration_ms" : 3000, - "priority" : 0 + "priority" : 900 }, /// The configuration for the frame-grabber, contains the following items: diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index b6289fe2..032d44db 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -127,19 +127,33 @@ int main(int argc, char** argv) const std::string effectName = effectConfig["effect"].asString(); const unsigned duration_ms = effectConfig["duration_ms"].asUInt(); 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")) { 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; + 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; + std::cout << "Failed to start boot sequence: " << effectName << " with user-defined arguments" << std::endl; } } else