From a2bed6ed873b18cd150d3e26845391df03649a78 Mon Sep 17 00:00:00 2001 From: Matthew Barth Date: Thu, 14 Feb 2019 16:07:00 -0600 Subject: Initially use default current mode upon restoring When restoring the persisted current mode, initially set the current mode to what's already provided. When no interface is defined within the zone yaml, a default value of "Default" is already set on the Control.ThermalMode interface. If an interface is provided on the zone yaml, and the Current property is initialized to a value, use this value initially upon restoring. During the restore, this value could change to what was persisted. Tested: Current mode is set correctly upon initialization & restore Change-Id: I0fae247303903d85e95fc044c96fc1809df2fa03 Signed-off-by: Matthew Barth --- control/zone.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/control/zone.cpp b/control/zone.cpp index d4c7a3c..0278de8 100644 --- a/control/zone.cpp +++ b/control/zone.cpp @@ -674,7 +674,7 @@ void Zone::saveCurrentMode() void Zone::restoreCurrentMode() { - std::string current = "Default"; + auto current = ThermalObject::current(); fs::path path{CONTROL_PERSIST_ROOT_PATH}; path /= std::to_string(_zoneNum); path /= "CurrentMode"; @@ -693,7 +693,7 @@ void Zone::restoreCurrentMode() { log(e.what()); fs::remove(path); - current = "Default"; + current = ThermalObject::current(); } this->current(current); -- cgit v1.2.1