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.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
Diff: src/ConfigurationHandler/Controls/SetpointControl.cpp
- Revision:
- 91:0e8d76030598
- Parent:
- 90:7d9731dec0da
- Child:
- 92:9a6a1adca19c
--- a/src/ConfigurationHandler/Controls/SetpointControl.cpp Tue Sep 20 17:45:57 2016 +0000 +++ b/src/ConfigurationHandler/Controls/SetpointControl.cpp Tue Sep 20 18:26:08 2016 +0000 @@ -7,6 +7,7 @@ #include "SetpointControl.h" #include "mDot.h" #include "MbedJSONValue.h" +#include "ModbusMasterApi.h" #include "global.h" #include <string> @@ -127,6 +128,17 @@ bool SetpointControl::overLimit(void) { + ModbusValue value; + + ModbusMasterReadRegister( input, &value ); + printf("overLimit: input=%s value=%2.2f, direction=%d\r\n", input, value.value, actingDir); + float high_band = setpoint + (setpoint * .04); + if( (value.value >= high_band && actingDir == true) || (value.value <= high_band && actingDir == false) ) { + printf("overLimit returning TRUE\r\n"); + // over limit + return true; + } + printf("overLimit returning FALSE\r\n"); return false; } @@ -139,6 +151,16 @@ bool SetpointControl::underLimit(void) { + ModbusValue value; + + float low_band = setpoint - (setpoint *.04); + printf("underLimit: input=%s value=%2.2f, direction=%d\r\n", input, value.value, actingDir); + if( (value.value <= low_band && actingDir == true) || (value.value >= low_band && actingDir == false) ) { + // over limit + printf("underLimit returning TRUE\r\n"); + return true; + } + printf("underLimit returning FALSE\r\n"); return false; }