From f108ae883c1a19eaa74f1c67cd4278815c98538a Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 30 Nov 2020 16:28:16 +0100 Subject: [PATCH] local pool replacement --- thermal/ThermalComponentCore.cpp | 39 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/thermal/ThermalComponentCore.cpp b/thermal/ThermalComponentCore.cpp index 81d9326f..29f9e25d 100644 --- a/thermal/ThermalComponentCore.cpp +++ b/thermal/ThermalComponentCore.cpp @@ -96,26 +96,25 @@ float ThermalComponentCore::getLowerOpLimit() { ReturnValue_t ThermalComponentCore::setTargetState(int8_t newState) { -// GlobDataSet mySet; -// gp_uint8_t writableTargetState(targetState.getDataPoolId(), -// &mySet, PoolVariableIF::VAR_READ_WRITE); -// mySet.read(); -// if ((writableTargetState == STATE_REQUEST_OPERATIONAL) -// && (newState != STATE_REQUEST_IGNORE)) { -// return HasReturnvaluesIF::RETURN_FAILED; -// } -// switch (newState) { -// case STATE_REQUEST_HEATING: -// case STATE_REQUEST_IGNORE: -// case STATE_REQUEST_OPERATIONAL: -// writableTargetState = newState; -// break; -// case STATE_REQUEST_NON_OPERATIONAL: -// default: -// return INVALID_TARGET_STATE; -// } -// mySet.commit(PoolVariableIF::VALID); -// return HasReturnvaluesIF::RETURN_OK; + targetState.setReadWriteMode(pool_rwm_t::VAR_READ_WRITE); + targetState.read(); + if((targetState == STATE_REQUEST_OPERATIONAL) and + (newState != STATE_REQUEST_IGNORE)) { + return HasReturnvaluesIF::RETURN_FAILED; + } + + switch (newState) { + case STATE_REQUEST_HEATING: + case STATE_REQUEST_IGNORE: + case STATE_REQUEST_OPERATIONAL: + targetState = newState; + break; + case STATE_REQUEST_NON_OPERATIONAL: + default: + return INVALID_TARGET_STATE; + } + targetState.setValid(true); + targetState.commit(); return HasReturnvaluesIF::RETURN_OK; }