Add event init trigger
An event defined with an init trigger will run the event's actions
upon the event initializing. An event initializes when the fan control
application starts or at anytime an event's precondition is valid.
Tested:
Used missing fan action to set a speed at application start
Used missing fan action to set a speed upon valid precondition
Change-Id: I96a36425a2ca345371c27d7b580070bec28acaa1
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/templates/fan_zone_defs.mako.cpp b/control/templates/fan_zone_defs.mako.cpp
index 5eadc6d..4b34c46 100644
--- a/control/templates/fan_zone_defs.mako.cpp
+++ b/control/templates/fan_zone_defs.mako.cpp
@@ -188,6 +188,17 @@
)),
%endfor
%endif
+ %if ('init' in event['pc']['triggers']):
+ %for i in event['pc']['triggers']['init']:
+ make_trigger(trigger::init(
+ %if ('handler' in i):
+ make_handler(\
+ ${indent(genParams(par=i), 3)}\
+ )
+ %endif
+ )),
+ %endfor
+ %endif
},
%endif
},