From 59096e50db52d85d2252bb5c7de054bd3c8156c5 Mon Sep 17 00:00:00 2001 From: Matthew Barth Date: Mon, 18 Feb 2019 12:23:38 -0600 Subject: Generate zone property persist configs Each zone object's hosted interfaces' properties can be configured to be persisted or not at compile time. Those properties configured to be persisted are set to be persisted after the initial value is set. When this value doesnt change on a system, there's no need to persist it since the initial value is compiled into the fan control application per zone. Once this value is changed and therefore persisted, upon a application restart, initially the value would be what's compiled in until its configured again to be persisted and then restored. Tested: Current property always set to what's persisted between restarts Nothing persisted when Current property doesnt change from default Change-Id: I93109730796af2058ecab0e78e612b7919886b33 Signed-off-by: Matthew Barth --- control/templates/fan_zone_defs.mako.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'control/templates') diff --git a/control/templates/fan_zone_defs.mako.cpp b/control/templates/fan_zone_defs.mako.cpp index cb46986..e05d1fc 100644 --- a/control/templates/fan_zone_defs.mako.cpp +++ b/control/templates/fan_zone_defs.mako.cpp @@ -54,13 +54,15 @@ const std::vector Manager::_zoneLayouts %for p in i['props']: ZoneHandler{ make_zoneHandler(handler::setZoneProperty( - &Zone::${p['name']}, + "${i['name']}", + "${p['name']}", + &Zone::${p['func']}, static_cast<${p['type']}>( %if "vector" in p['type'] or "map" in p['type']: ${p['type']}{ %endif - %for i, v in enumerate(p['values']): - %if (i+1) != len(p['values']): + %for j, v in enumerate(p['values']): + %if (j+1) != len(p['values']): ${v}, %else: ${v} @@ -69,7 +71,8 @@ const std::vector Manager::_zoneLayouts %if "vector" in p['type'] or "map" in p['type']: } %endif - ) + ), + ${p['persist']} )) }, %endfor -- cgit v1.2.1