Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Commit afc8e8e

Browse files
committed
Merge pull request #100 from MarcDahlem/master
Added ability to define effect arguments for the bootsequence
2 parents af76999 + b9827bb commit afc8e8e

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/hyperiond/hyperiond.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,31 @@ int main(int argc, char** argv)
112112
const std::string effectName = effectConfig["effect"].asString();
113113
const unsigned duration_ms = effectConfig["duration_ms"].asUInt();
114114
const int priority = 0;
115-
116-
if (hyperion.setEffect(effectName, priority, duration_ms) == 0)
115+
116+
if (effectConfig.isMember("args"))
117117
{
118-
std::cout << "Boot sequence(" << effectName << ") created and started" << std::endl;
118+
const Json::Value effectConfigArgs = effectConfig["args"];
119+
if (hyperion.setEffect(effectName, effectConfigArgs, priority, duration_ms) == 0)
120+
{
121+
std::cout << "Boot sequence(" << effectName << ") with user-defined arguments created and started" << std::endl;
122+
}
123+
else
124+
{
125+
std::cout << "Failed to start boot sequence: " << effectName << " with user-defined arguments" << std::endl;
126+
}
127+
119128
}
120129
else
121130
{
122-
std::cout << "Failed to start boot sequence: " << effectName << std::endl;
131+
132+
if (hyperion.setEffect(effectName, priority, duration_ms) == 0)
133+
{
134+
std::cout << "Boot sequence(" << effectName << ") created and started" << std::endl;
135+
}
136+
else
137+
{
138+
std::cout << "Failed to start boot sequence: " << effectName << std::endl;
139+
}
123140
}
124141
}
125142

0 commit comments

Comments
 (0)