From 9014980aa76692cd7f08b5e69565133122c758cd Mon Sep 17 00:00:00 2001 From: Matthew Barth Date: Tue, 15 Aug 2017 10:51:37 -0500 Subject: Add timer option to run set speed event actions For groups within set speed events where the property values of the group may not signal its action to occur, an optional timer may be added to the event. This timer is configured as a repeating timer on the interval provided where upon timer expiration, the event's action is run. Change-Id: I4cbe8a0ab1b734bfc7828706a6515af7f6d78b52 Signed-off-by: Matthew Barth --- control/gen-fan-zone-defs.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'control/gen-fan-zone-defs.py') diff --git a/control/gen-fan-zone-defs.py b/control/gen-fan-zone-defs.py index 45ca774..a2a49a8 100755 --- a/control/gen-fan-zone-defs.py +++ b/control/gen-fan-zone-defs.py @@ -112,6 +112,9 @@ const std::vector Manager::_zoneLayouts %endif %endfor )), + Timer{ + ${event['timer']['interval']} + }, std::vector{ %for s in event['signal']: PropertyChange{ @@ -146,6 +149,9 @@ const std::vector Manager::_zoneLayouts %if ('pc' in event) and (event['pc'] is not None): } )), + Timer{ + ${event['pc']['pctime']['interval']} + }, std::vector{ %for s in event['pc']['pcsig']: PropertyChange{ @@ -264,6 +270,20 @@ def addPrecondition(event, events_data): signal.append(signals) precond['pcsig'] = signal + # Add optional action call timer + timer = {} + interval = "static_cast" + if ('timer' in event['precondition']) and \ + (event['precondition']['timer'] is not None): + timer['interval'] = (interval + + "(" + + str(event['precondition']['timer']['interval']) + + ")") + else: + timer['interval'] = (interval + + "(" + str(0) + ")") + precond['pctime'] = timer + return precond @@ -350,6 +370,18 @@ def getEventsInZone(zone_num, zone_conditions, events_data): signal.append(signals) event['signal'] = signal + # Add optional action call timer + timer = {} + interval = "static_cast" + if ('timer' in e) and \ + (e['timer'] is not None): + timer['interval'] = (interval + + "(" + str(e['timer']['interval']) + ")") + else: + timer['interval'] = (interval + + "(" + str(0) + ")") + event['timer'] = timer + events.append(event) return events -- cgit v1.2.1