Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: ICE-Application/src/OutputTask/ControlClass/Control.cpp
- Revision:
- 0:61364762ee0e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ICE-Application/src/OutputTask/ControlClass/Control.cpp Tue Jan 24 19:05:33 2017 +0000 @@ -0,0 +1,43 @@ +/****************************************************************************** + * + * File: Control.cpp + * Desciption: ICE Control Class implementation for Output Thread + * + *****************************************************************************/ +#include <Control.h> + +// +// method: getMappedState +// description: convert the control state into its analytics code +// the values here should map to the RELAY_STATUS_* codes +// define in global.h +// +// @param none +// @return relay-status code +// +int Control::getMappedState(void) const +{ + switch (controlType) { + case CONTROL_TIMER: + case CONTROL_SETPOINT: + // automatic control + return (state) ? RELAY_STATUS_AUTO_ON : RELAY_STATUS_AUTO_OFF; + case CONTROL_MANUAL: + // manual control + return (state) ? RELAY_STATUS_MANUAL_ON : RELAY_STATUS_MANUAL_OFF; + case CONTROL_FAILSAFE: + // failsafe control + return (state) ? RELAY_STATUS_FAILSAFE_ON : RELAY_STATUS_FAILSAFE_OFF; + case CONTROL_COMPOSITE: + // FIXME! This is a hack to get the correct mapped relay status + if ( input.compare(0, strlen("i_flowsw"), "i_flowsw") == 0 ) { + return ( state ) ? RELAY_STATUS_FLOW_FAILSAFE_ON : RELAY_STATUS_FLOW_FAILSAFE_OFF; + } else { + return ( state ) ? RELAY_STATUS_AUTO_ON : RELAY_STATUS_AUTO_OFF; + } + case CONTROL_PID: + // not implememented + default: + return -1; + } +}